From: Gregory Anders Date: Wed, 30 Mar 2022 14:57:15 +0000 (-0600) Subject: Fire event when LSP client is attached to a buffer X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=5902a132a987d077e0a5f69af545c3fa8ec52d43;p=vim-lsp.git Fire event when LSP client is attached to a buffer This provides a hook for users to configure buffers that use LSP. For example, autocmd User LspAttached { nnoremap LspGotoDefinition } --- diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index e4f4c8b..9c8accb 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -406,6 +406,8 @@ export def AddFile(bnr: number): void endif augroup END + doautocmd User LspAttached + buf.BufLspServerSet(bnr, lspserver) enddef diff --git a/doc/lsp.txt b/doc/lsp.txt index 0ad70a0..6d7be53 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -543,5 +543,11 @@ default. The following example disables omni-completion for python: > \ ] < ============================================================================== +7. Autocommands *lsp-autocmds* + + *LspAttached* +LspAttached A |User| autocommand fired when the LSP client + attaches to a buffer. Can be used to configure + buffer-local mappings or options. vim:tw=78:ts=8:noet:ft=help:norl: