if has('nvim') finish endif let g:lsp_diagnostics_enabled = 0 let g:lsp_document_code_action_signs_enabled = 0 let g:lsp_use_native_client = 1 let g:lsp_fold_enabled = 1 packadd vim-lsp packadd vim-lsp-snippets packadd vim-lsp-ultisnips " This package will help enable diagnostic config of vim-lsp and then it " can help send the result to ALE. Pay attention of the loading order. packadd vim-lsp-ale if executable('pylsp') au User lsp_setup call lsp#register_server({ \ 'name': 'pylsp', \ 'cmd': {server_info->['pylsp']}, \ 'allowlist': ['python'], \ }) endif if executable('gopls') au User lsp_setup call lsp#register_server({ \ 'name': 'gopls', \ 'cmd': {server_info->['gopls']}, \ 'allowlist': ['go'], \ 'initialization_options': { \ 'ui.completion.usePlaceholders': v:true, \ }, \ }) endif if executable('clangd') au User lsp_setup call lsp#register_server({ \ 'name': 'clangd', \ 'cmd': {server_info->['clangd']}, \ 'allowlist': ['c', 'cpp'], \ }) endif if executable('omnisharp') au User lsp_setup call lsp#register_server({ \ 'name': 'omnisharp', \ 'cmd': {server_info->['omnisharp', '-lsp']}, \ 'allowlist': ['cs'], \ }) endif if executable('godot') au User lsp_setup \ call lsp#register_server({ \ 'name': 'godot', \ 'tcp': {server_info->'localhost:6008'}, \ 'allowlist': ['gdscript', 'gdscript3'] \ }) endif if executable('solargraph') au User lsp_setup call lsp#register_server({ \ 'name': 'solargraph', \ 'cmd': {server_info->['solargraph', 'stdio']}, \ 'allowlist': ['ruby'], \ }) endif " https://github.com/mickael-menu/zk " if executable('zk') " au User lsp_setup call lsp#register_server({ " \ 'name': 'zk', " \ 'cmd': {server_info->['zk', 'lsp']}, " \ 'allowlist': ['markdown'], " \ }) " endif if executable('rust-analyzer') au User lsp_setup call lsp#register_server({ \ 'name': 'rust-analyzer', \ 'cmd': {server_info->['rust-analyzer']}, \ 'allowlist': ['rust'], \ }) endif function! s:on_lsp_buffer_enabled() abort setlocal omnifunc=lsp#complete setlocal nocscopetag if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif nmap gd (lsp-definition) nmap gs (lsp-document-symbol) nmap gS (lsp-workspace-symbol) nmap gr (lsp-references) nmap gi (lsp-implementation) nmap gy (lsp-type-definition) nmap rn (lsp-rename) 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