summaryrefslogtreecommitdiff
path: root/vimrc
diff options
context:
space:
mode:
authorReiner Herrmann <reiner@reiner-h.de>2023-11-25 18:35:31 +0100
committerReiner Herrmann <reiner@reiner-h.de>2023-11-25 18:35:31 +0100
commit7e8450f3e1890e02ea92723e24f142dcfa9e2f03 (patch)
tree7c34d0a5ca4ab668c88f36cf742e31e023c36c40 /vimrc
parentcfede14f814ca8a1263cc802a866f341b4c83599 (diff)
vim: call lsp functions only when plugin has been loaded
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc70
1 files changed, 36 insertions, 34 deletions
diff --git a/vimrc b/vimrc
index 64d94b4..88f84af 100644
--- a/vimrc
+++ b/vimrc
@@ -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