diff options
author | Guangxiong Lin <[email protected]> | 2024-01-15 20:26:09 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2024-01-15 20:26:09 +0800 |
commit | e6b66752b788aeac9e35d4917b2140a946398e65 (patch) | |
tree | f9d4b7acbc0bc60ed1f2a0011e0c2174c721dd0a /.vim/after/plugin | |
parent | 309d98a15eb95698a91be083511a8fd384ee7b05 (diff) | |
download | dotfiles-e6b66752b788aeac9e35d4917b2140a946398e65.tar.gz dotfiles-e6b66752b788aeac9e35d4917b2140a946398e65.tar.bz2 dotfiles-e6b66752b788aeac9e35d4917b2140a946398e65.zip |
Migrate from vim-lsp to yegappan-lsp
Diffstat (limited to '.vim/after/plugin')
-rw-r--r-- | .vim/after/plugin/lsp.vim | 1 | ||||
-rw-r--r-- | .vim/after/plugin/yegappan-lsp.vim | 34 |
2 files changed, 35 insertions, 0 deletions
diff --git a/.vim/after/plugin/lsp.vim b/.vim/after/plugin/lsp.vim index be41ceb..6b323c8 100644 --- a/.vim/after/plugin/lsp.vim +++ b/.vim/after/plugin/lsp.vim @@ -1,3 +1,4 @@ +finish if has('nvim') finish endif diff --git a/.vim/after/plugin/yegappan-lsp.vim b/.vim/after/plugin/yegappan-lsp.vim new file mode 100644 index 0000000..42bb6cf --- /dev/null +++ b/.vim/after/plugin/yegappan-lsp.vim @@ -0,0 +1,34 @@ +packadd yegappan-lsp + +" Go language server +call LspAddServer([#{ + \ name: 'golang', + \ filetype: ['go', 'gomod'], + \ omnicompl: v:true, + \ path: exepath('gopls'), + \ args: ['serve'], + \ syncInit: v:true + \ }]) + +call LspOptionsSet(#{ + \ aleSupport: v:true, + \ autoComplete: v:false, + \ omniComplete: v:true, + \ completionMatcher: "fuzzy", + \ }) + +function! s:on_lsp_attached() abort + setlocal tagfunc=lsp#lsp#TagFunc + setlocal keywordprg=:LspHover + " setlocal formatexpr=lsp#lsp#FormatExpr() + + nnoremap <buffer> <localleader>rn :LspRename<CR> + nnoremap <buffer> gr :LspShowReferences<CR> + + autocmd! BufWritePre *.rs,*.go call execute('LspFormat') +endfunction + +augroup lsp_attached + au! + autocmd User LspAttached call s:on_lsp_attached() +augroup END |