aboutsummaryrefslogtreecommitdiff
path: root/.vim/after/plugin/yegappan-lsp.vim
blob: 42bb6cfd1533e0c66d93b023076e3172b57594ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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