Created
October 29, 2019 03:49
-
-
Save h-michael/40fa5d3ccec743f145fde084ff7cd016 to your computer and use it in GitHub Desktop.
minimal vimrc for testing lsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
call plug#begin('~/.vim/plugged') | |
Plug 'Shougo/deoplete.nvim' | |
Plug 'Shougo/deoplete-lsp' | |
call plug#end() | |
" If you use deoplete, remove comment out and comment out line 55. | |
" let g:deoplete#enable_at_startup = 1 | |
let g:language_server_client_log_level = 'debug' | |
call lsp#add_server_config({ | |
\ 'server_name': 'gopls', | |
\ 'filetype': ['go'], | |
\ 'cmd': 'gopls', | |
\ 'server_config': {} | |
\ }) | |
call lsp#add_server_config({ | |
\ 'server_name': 'rls', | |
\ 'filetype': ['rust'], | |
\ 'cmd': 'rls', | |
\ 'capabilities': { | |
\ 'clippy_preference': 'on', | |
\ 'all_targets': v:false, | |
\ 'build_on_save': v:true, | |
\ 'wait_to_build': 0 | |
\ }}) | |
call lsp#add_server_config({ | |
\ "server_name": "pyls", | |
\ "filetype": "python", | |
\ "cmd": "pyls" | |
\ }) | |
call lsp#add_server_config({ | |
\ "server_name": "clangd", | |
\ "filetype": ["c", "cpp"], | |
\ "cmd": "clangd -background-index", | |
\ "capabilities": { | |
\ "offsetEncoding": ["utf-8", "utf-16"] | |
\ } | |
\ }) | |
call lsp#add_server_config({ | |
\ 'filetype': ['typescript', 'typescript.tsx'], | |
\ 'cmd': ['npx', 'javascript-typescript-langserver'] | |
\ }) | |
call luaeval("vim.lsp.config.set_all_builtin_callbacks()") | |
autocmd Filetype rust,python,go,c,cpp inoremap <buffer> <c-l> <c-r>=lsp#text_document_completion()<CR> | |
nnoremap <silent> ;lh :call lsp#text_document_hover()<CR> | |
nnoremap <silent> ;ls :call lsp#text_document_signature_help()<CR> | |
nnoremap <silent> ;lr :call lsp#text_document_references()<CR> | |
nnoremap <silent> ;ldc :call lsp#text_document_declaration()<CR> | |
nnoremap <silent> ;ldf :call lsp#text_document_definition()<CR> | |
nnoremap <silent> ;ltd :call lsp#text_document_type_definition()<CR> | |
nnoremap <silent> ;li :call lsp#text_document_implementation()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment