diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2023-11-25 18:35:31 +0100 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2023-11-25 18:35:31 +0100 |
| commit | 7e8450f3e1890e02ea92723e24f142dcfa9e2f03 (patch) | |
| tree | 7c34d0a5ca4ab668c88f36cf742e31e023c36c40 /vimrc | |
| parent | cfede14f814ca8a1263cc802a866f341b4c83599 (diff) | |
vim: call lsp functions only when plugin has been loaded
Diffstat (limited to 'vimrc')
| -rw-r--r-- | vimrc | 70 |
1 files changed, 36 insertions, 34 deletions
@@ -146,40 +146,42 @@ let g:airline#extensions#tabline#enabled=1 " LSP settings packadd lsp -call LspOptionsSet(#{ - \ autoHighlight: v:true, - \ showDiagOnStatusLine: v:true, - \ showDiagWithVirtualText: v:true, - \ usePopupInCodeAction: v:true, - \ }) - -if executable("clangd") -call LspAddServer([#{ - \ name: 'clangd', - \ filetype: ['c', 'cpp'], - \ path: 'clangd', - \ args: ['--background-index'] - \ }]) -endif - -if executable("rust-analyzer") -call LspAddServer([#{ - \ name: 'rust-analyzer', - \ filetype: ['rust'], - \ path: 'rust-analyzer', - \ args: [], - \ syncInit: v:true, - \ initializationOptions: #{ - \ inlayHints: #{ - \ typeHints: #{ - \ enable: v:true - \ }, - \ parameterHints: #{ - \ enable: v:true - \ } - \ }, - \ } - \ }]) +if exists("g:loaded_lsp") + call LspOptionsSet(#{ + \ autoHighlight: v:true, + \ showDiagOnStatusLine: v:true, + \ showDiagWithVirtualText: v:true, + \ usePopupInCodeAction: v:true, + \ }) + + if executable("clangd") + call LspAddServer([#{ + \ name: 'clangd', + \ filetype: ['c', 'cpp'], + \ path: 'clangd', + \ args: ['--background-index'] + \ }]) + endif + + if executable("rust-analyzer") + call LspAddServer([#{ + \ name: 'rust-analyzer', + \ filetype: ['rust'], + \ path: 'rust-analyzer', + \ args: [], + \ syncInit: v:true, + \ initializationOptions: #{ + \ inlayHints: #{ + \ typeHints: #{ + \ enable: v:true + \ }, + \ parameterHints: #{ + \ enable: v:true + \ } + \ }, + \ } + \ }]) + endif endif " vim: set et:sw=4:sts=4 |
