From a9793c04508fdb582d69138dde04583c9f4e5c0f Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Fri, 8 Apr 2022 00:42:57 +0800 Subject: Try removing ycm (vim) --- .vim/after/plugin/lsp.vim | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .vim/after/plugin/lsp.vim (limited to '.vim/after/plugin/lsp.vim') 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 gd (lsp-definition) + nmap gs (lsp-document-symbol-search) + nmap gS (lsp-workspace-symbol-search) + nmap gr (lsp-references) + nmap gi (lsp-implementation) + nmap gy (lsp-type-definition) + nmap rn (lsp-rename) + " nmap [g (lsp-previous-diagnostic) + " nmap ]g (lsp-next-diagnostic) + nmap K (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 -- cgit v1.2.3