-
Notifications
You must be signed in to change notification settings - Fork 83
Vim and Neovim
Steven Lang edited this page Oct 6, 2018
·
24 revisions
Vim and Neovim are able to use the Julia LanguageServer via LanguageClient-neovim with completion from nvim-completion-manager.
The following is a basic minimal config (vimrc
for Vim; init.vim
for Neovim) using
vim-plug:
call g:plug#begin()
Plug 'JuliaEditorSupport/julia-vim'
Plug 'autozimu/LanguageClient-neovim', {'branch': 'next', 'do': 'bash install.sh'}
Plug 'roxma/nvim-completion-manager' " optional
call g:plug#end()
" julia
let g:default_julia_version = '0.6'
" language server
let g:LanguageClient_autoStart = 1
let g:LanguageClient_serverCommands = {
\ 'julia': ['julia', '--startup-file=no', '--history-file=no', '-e', '
\ using LanguageServer;
\ server = LanguageServer.LanguageServerInstance(stdin, stdout, false);
\ server.runlinter = true;
\ run(server);
\ '],
\ }
nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
Note:
-
The
LanguageServer
package must be installed in Julia (0.6 or greater), i.e.julia> Pkg.clone("https://github.com/JuliaEditorSupport/LanguageServer.jl")
-
If Julia (0.6 or greater) is not present in the
PATH
environment, either add the julia binary folder toPATH
or directly reference thejulia
binary ing:LanguageClient_serverCommands
, e.g. for macOS:let g:LanguageClient_serverCommands = { \ 'julia': ['/Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia', ...
-
See vim-plug for more details on installing/managing packages in Vim/Neovim