From: Philippe Hürlimann
Date: Mon, 24 Jan 2022 01:17:36 +0000 (+0100)
Subject: Switch language client bindings to use
X-Git-Url: https://git.hurlimann.org/?a=commitdiff_plain;h=9f2b6791d9cfe1077b0c9eefdf636125d6d13759;p=vimfiles.git
Switch language client bindings to use
---
diff --git a/init.vim b/init.vim
index f5e407b..8b15afd 100644
--- a/init.vim
+++ b/init.vim
@@ -76,15 +76,23 @@ let g:LanguageClient_serverCommands = {
\ 'rust': ['rust-analyzer'],
\}
-nnoremap :call LanguageClient_contextMenu()
-nnoremap :call LanguageClient#textDocument_rename()
-nnoremap gd :call LanguageClient#textDocument_definition()
-nnoremap gD v:call LanguageClient#textDocument_definition()
-nnoremap la :call LanguageClient#textDocument_codeAction()
-nnoremap lb :call LanguageClient#textDocument_references()
-nnoremap lf :call LanguageClient#textDocument_formatting()
-nnoremap lk :call LanguageClient#textDocument_hover()
-nnoremap ls :call LanguageClient#textDocument_documentSymbol()
+function LC_maps()
+ if has_key(g:LanguageClient_serverCommands, &filetype)
+ nmap (lcn-menu)
+ nmap K (lcn-hover)
+ nmap gd (lcn-definition)
+ nmap (lcn-rename)
+ nmap gD (lcn-type-definition)
+ nmap la (lcn-code-action)
+ nmap lb (lcn-references)
+ nmap lf (lcn-format)
+ nmap ls (lcn-symbols)
+ nmap lh (lcn-highlight)
+ endif
+endfunction
+
+autocmd FileType * call LC_maps()
+autocmd BufWritePre * :call LanguageClient#textDocument_formatting_sync()
imap (neosnippet_expand_or_jump)
smap (neosnippet_expand_or_jump)