A simple plug-in for nvim support Julia.
- Julia REPLCompletion based completions.
- Eval code in current line or current block and get its result.
- Docstring generation. Support from AtsushiSakai/julia.vim
- Quick comment.
- Julia 1.0+
- Python3
- Neovim
1. Install VimCompletion.jl
2. Install pynvim
Installation with Vim-Plug
Plug 'wangl-cc/juliatools-nvim', { 'do' : ':UpdateRemotePlugins' }
Because the official julia-vim plug-in uses the omnifunc
as its complete method, this plug-in uses completefunc
as complete method wich is used for Insert mode completion with CTRL-X CTRL-U
.
Like Juno this plug-in can send code to term split (open default, if you exit, completion and eval code would be disable then you should call Reconnect()
) and eval it then display its result (not inline but by echo). There are two functions: JLRunLine
and JLRunBlock
to eval code in current line and current block. Map your own shortcut to use this feature.
There is a function juliadocstring#JuliaDocstring
being used to generate docstring. Map your own shortcut as above.
There is a function comment#Comment(julia_comment_symbol)
being used to comment and remove comment. Map your own shortcut as above.
There are some configurations for using this plugin, which should be append to file ~/.vim/ftplugin/julia.vim
for vim or ~/.config/nvim/ftplugin/julia.vim
for nvim:
if !exists("g:julia_comment_symbol")
let julia_comment_symbol = '#'
endif
" key map
nnoremap <buffer> <leader>l :call JLRunLine()<cr>
nnoremap <buffer> <leader>b :call JLRunBlock()<cr>
nnoremap <buffer> <leader>/ :call comment#Comment(julia_comment_symbol)<cr>
nnoremap <buffer> <leader>d :call juliadocstring#JuliaDocstring()<cr>
" autoclose
augroup JuliaAutoClose
autocmd!
autocmd bufenter * if (winnr("$") == 1 && bufname("$") =~ "julia") | q | endif
augroup END