WARNING: VERY BETA SOFTWARE
Literate programming with Neovim and markdown.
There is no denying the power and awesomeness of Org Mode and its ecosystem. But it's not coming to Neovim anytime soon. Doesn't mean we can't steal some ideas and enjoy what our ecosystem is capable of. This is our moonshot.
Neovim Nigthly 0.5 is required to run moonshot
Install with your favorite package manager.
Using vim-plug
Plug 'skbolton/moonshot.nvim`
Using packer
use 'skbolton/moonshot.nvim'
Add fenced code blocks to your markdown documents.
```sh
echo "Hello Literate Programming"
```
With your cursor in the block you can run:
:lua require'moonshot'.run_cursor()
And you should see the following.
```sh
echo "Hello, Literate Programming"
```
:RESULTS:
"Hello, Literate Programming
Add as many of these code blocks as you'd like. If you decide you want to run them all at the same time you can run this:
:lua require'moonshot'.run_all()`
We aren't just limited to running echo
either. Any command can be ran in a block. For example if you have the github cli try running this block.
gh pr list
The following are all the available commands. Bind them to the keys of your choice, no default key bindings are put in place.
" run/refresh all the blocks
nnoremap <leader>> <cmd>lua require'moonshot'.run_all()<CR>
" run/refresh block under cursor
nnoremap <leader>= <cmd>lua require'moonshot'.run_cursor()<CR>
" Remove all result blocks
nnoremap <leader>< <cmd>lua require'moonshot'.clean_all()<CR>
" Remove block under cursor
nnoremap <leader>< <cmd>lua require'moonshot'.clean_cursor()<CR>