diff options
author | Guangxiong Lin <[email protected]> | 2022-04-08 00:42:57 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2022-04-08 00:42:57 +0800 |
commit | a9793c04508fdb582d69138dde04583c9f4e5c0f (patch) | |
tree | c47443766be74ec248f1bbc1825d6cec1ae3708a /.vim/after/plugin/lsp.vim | |
parent | 40e266a131d8bfc9f2f48c5e40846436a9c9e64f (diff) | |
download | dotfiles-a9793c04508fdb582d69138dde04583c9f4e5c0f.tar.gz dotfiles-a9793c04508fdb582d69138dde04583c9f4e5c0f.tar.bz2 dotfiles-a9793c04508fdb582d69138dde04583c9f4e5c0f.zip |
Try removing ycm (vim)
Diffstat (limited to '.vim/after/plugin/lsp.vim')
-rw-r--r-- | .vim/after/plugin/lsp.vim | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/.vim/after/plugin/lsp.vim b/.vim/after/plugin/lsp.vim new file mode 100644 index 0000000..0f53146 --- /dev/null +++ b/.vim/after/plugin/lsp.vim @@ -0,0 +1,42 @@ +let g:lsp_diagnostics_enabled = 0 +let g:lsp_document_code_action_signs_enabled = 0 + +if executable('pyls') + au User lsp_setup call lsp#register_server({ + \ 'name': 'pyls', + \ 'cmd': {server_info->['pyls']}, + \ 'allowlist': ['python'], + \ }) +endif + +if executable('gopls') + au User lsp_setup call lsp#register_server({ + \ 'name': 'gopls', + \ 'cmd': {server_info->['gopls']}, + \ 'allowlist': ['go'], + \ }) +endif + +function! s:on_lsp_buffer_enabled() abort + setlocal omnifunc=lsp#complete + setlocal signcolumn=yes + if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif + nmap <buffer> gd <plug>(lsp-definition) + nmap <buffer> gs <plug>(lsp-document-symbol-search) + nmap <buffer> gS <plug>(lsp-workspace-symbol-search) + nmap <buffer> gr <plug>(lsp-references) + nmap <buffer> gi <plug>(lsp-implementation) + nmap <buffer> gy <plug>(lsp-type-definition) + nmap <buffer> <leader>rn <plug>(lsp-rename) + " nmap <buffer> [g <plug>(lsp-previous-diagnostic) + " nmap <buffer> ]g <plug>(lsp-next-diagnostic) + nmap <buffer> K <plug>(lsp-hover) + + let g:lsp_format_sync_timeout = 1000 + autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync') +endfunction + +augroup lsp_install + au! + autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() +augroup END |