From deb8c82256535f811ae5d13aff1a438091b65f0d Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sun, 31 May 2020 20:22:55 +0200 Subject: [PATCH] vim: Add more languageclient mappings --- home/.config/nvim/init.vim | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim index 0e8b0e1..8259952 100644 --- a/home/.config/nvim/init.vim +++ b/home/.config/nvim/init.vim @@ -80,7 +80,17 @@ let g:LanguageClient_serverCommands = { \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'], \ } -nnoremap :call LanguageClient_contextMenu() +function LC_maps() + if has_key(g:LanguageClient_serverCommands, &filetype) + nnoremap :call LanguageClient_contextMenu() + nnoremap K :call LanguageClient#textDocument_hover() + nnoremap gd :call LanguageClient#textDocument_definition() + nnoremap :call LanguageClient#textDocument_rename() + set formatexpr=LanguageClient#textDocument_rangeFormatting_sync() + endif +endfunction + +autocmd FileType * call LC_maps() " Multi-entry selection UI Plug 'junegunn/fzf'