]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Update the steps to register LSP servers when using vim-plug to install the lsp plugin.
authorYegappan Lakshmanan <4298407+yegappan@users.noreply.github.com>
Fri, 21 Oct 2022 03:16:48 +0000 (20:16 -0700)
committerGitHub <noreply@github.com>
Fri, 21 Oct 2022 03:16:48 +0000 (20:16 -0700)
README.md

index edc5ac114f1a3b69f447f261ddb24073a1e5191d..ad156dff8eb52d35dd8c663c7c7bb888723a44cb 100644 (file)
--- a/README.md
+++ b/README.md
@@ -45,7 +45,7 @@ The following language server protocol (LSP) features are supported:
 
 To use the plugin features with a particular file type(s), you need to first register a LSP server for that file type(s).
 
-To register a LSP server, add the following lines to your .vimrc file (use only the LSP servers that you need from the below list):
+To register a LSP server, add the following lines to your .vimrc file (use only the LSP servers that you need from the below list).  If you used [vim-plug](https://github.com/junegunn/vim-plug) to install the LSP plugin, the steps are described later in this section.
 ```
    let lspServers = [
                \     #{
@@ -115,6 +115,21 @@ args|a list of command-line arguments passed to the LSP server. Each argument is
 
 The LSP servers are added using the LspAddServer() function. This function accepts a list of LSP servers with the above information.
 
+If you used [vim-plug](https://github.com/junegunn/vim-plug) to install the LSP plugin, then you need to use the VimEnter autocmd to initialize the LSP server and to set the LSP server options.  For example:
+```
+    let lspServers = [
+               \     #{
+               \        filetype: ['c', 'cpp'],
+               \        path: '/usr/local/bin/clangd',
+               \        args: ['--background-index']
+               \      }
+               \   ]
+    autocmd VimEnter * call LspAddServer(lspServers)
+   
+    let lspOpts = {'autoHighlightDiags': v:true}
+    autocmd VimEnter * call LspOptionsSet(lspOpts)
+```
+
 ## Supported Commands
 
 The following commands are provided to use the LSP features.