-
Notifications
You must be signed in to change notification settings - Fork 91
Vim and Neovim
Atsushi Sakai edited this page Feb 8, 2019
·
27 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 = '1.0'
" language server
let g:LanguageClient_autoStart = 1
let g:LanguageClient_serverCommands = {
\ 'julia': ['julia', '--startup-file=no', '--history-file=no', '-e', '
\ using LanguageServer;
\ using Pkg;
\ import StaticLint;
\ import SymbolServer;
\ env_path = dirname(Pkg.Types.Context().env.project_file);
\ debug = false;
\
\ server = LanguageServer.LanguageServerInstance(stdin, stdout, debug, env_path, "", Dict());
\ 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,SymbolServerandStaticLintpackages must be installed in Julia (1.x), i.e.julia> using Pkg julia> Pkg.add("LanguageServer") julia> Pkg.add("SymbolServer") julia> Pkg.add("StaticLint")
-
If Julia (0.6 or greater) is not present in the
PATHenvironment, either add the julia binary folder toPATHor directly reference thejuliabinary 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
SpaceVim have a layer to use LanguageServer.jl, the setup is automatic once you installed the Julia layer.