]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Add g:loaded_lsp variable for easy detection
authorC.D. MacEachern <craig.daniel.maceachern@gmail.com>
Wed, 30 Nov 2022 14:11:15 +0000 (09:11 -0500)
committerC.D. MacEachern <craig.daniel.maceachern@gmail.com>
Wed, 30 Nov 2022 18:37:42 +0000 (13:37 -0500)
Useful to detect if the plugin was loaded before doing things in,
for example, `.vim/after/plugin/lsp.vim` by doing:

```
if !get(g:, 'loaded_lsp') | finish | endif
```

plugin/lsp.vim

index ddf43b2aa5ea810a817d153378205221df898d80..28cdccbb23ffb4846b060ef55bdfbd30938b36c3 100644 (file)
@@ -7,9 +7,15 @@ vim9script
 
 # Language Server Protocol (LSP) plugin for vim
 
+if exists('g:loaded_lsp')
+  finish
+endif
+g:loaded_lsp = 1
+
 import autoload '../autoload/lsp/options.vim'
 import autoload '../autoload/lsp/lsp.vim'
 
+
 # Set LSP plugin options from 'opts'.
 def g:LspOptionsSet(opts: dict<any>)
   options.OptionsSet(opts)