From 08dcec61aef0fed78b6d94ff97faeb1312d862e7 Mon Sep 17 00:00:00 2001 From: Oxbian Date: Wed, 23 Jul 2025 23:26:46 +0200 Subject: feat: using COC as LSP + linter + autocompletion --- conf/keymaps.vim | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'conf/keymaps.vim') diff --git a/conf/keymaps.vim b/conf/keymaps.vim index 351520d..cf04181 100644 --- a/conf/keymaps.vim +++ b/conf/keymaps.vim @@ -145,3 +145,56 @@ noremap sa zg " show the list of alternatives for the word noremap s? z= + +"""""""""""""""""""" +" LSP +"""""""""""""""""""" + +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" GoTo code navigation +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window +nnoremap K :call ShowDocumentation() + +function! ShowDocumentation() + if CocAction('hasProvider', 'hover') + call CocActionAsync('doHover') + else + call feedkeys('K', 'in') + endif +endfunction + +" Highlight the symbol and its references when holding the cursor +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Symbol renaming +nmap gR (coc-rename) + +" Formatting selected code +xmap gf (coc-format-selected) +nmap gf (coc-format-selected) + +" Applying code actions to the selected code block +xmap ga (coc-codeaction-selected) +nmap ga (coc-codeaction-selected) + +" Remap keys for applying code actions at the cursor position +nmap gc (coc-codeaction-cursor) +" Remap keys for apply code actions affect whole buffer +nmap gs (coc-codeaction-source) +" Apply the most preferred quickfix action to fix diagnostic on the current line +nmap gqf (coc-fix-current) + +" Remap keys for applying refactor code actions +nmap gr (coc-codeaction-refactor) +xmap r (coc-codeaction-refactor-selected) +nmap r (coc-codeaction-refactor-selected) + +" Run the Code Lens action on the current line +nmap gcl (coc-codelens-action) -- cgit v1.2.3