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 | |
parent | 309d98a15eb95698a91be083511a8fd384ee7b05 (diff) | |
download | dotfiles-e6b66752b788aeac9e35d4917b2140a946398e65.tar.gz dotfiles-e6b66752b788aeac9e35d4917b2140a946398e65.tar.bz2 dotfiles-e6b66752b788aeac9e35d4917b2140a946398e65.zip |
Migrate from vim-lsp to yegappan-lsp
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | .vim/after/plugin/lsp.vim | 1 | ||||
-rw-r--r-- | .vim/after/plugin/yegappan-lsp.vim | 34 | ||||
m--------- | .vim/pack/submodule/opt/yegappan-lsp | 0 |
4 files changed, 38 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules index 889677d..b56768d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -58,3 +58,6 @@ [submodule ".vim/pack/nvim/opt/diffview.nvim"] path = .vim/pack/nvim/opt/diffview.nvim url = https://github.com/sindrets/diffview.nvim +[submodule ".vim/pack/submodule/opt/yegappan-lsp"] + path = .vim/pack/submodule/opt/yegappan-lsp + url = https://github.com/yegappan/lsp 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 diff --git a/.vim/pack/submodule/opt/yegappan-lsp b/.vim/pack/submodule/opt/yegappan-lsp new file mode 160000 +Subproject feb71130dabe8ba23ccd0fbc18a5df3103cb2c8 |