diff options
-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 |