aboutsummaryrefslogtreecommitdiff
path: root/.vim/after/plugin/yegappan-lsp.vim
diff options
context:
space:
mode:
Diffstat (limited to '.vim/after/plugin/yegappan-lsp.vim')
-rw-r--r--.vim/after/plugin/yegappan-lsp.vim34
1 files changed, 34 insertions, 0 deletions
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