From fc9f8f93ef7fb7e041d15071cc0bbe8fe0149212 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Fri, 21 Oct 2022 01:51:45 +0200 Subject: [PATCH] vim:coc: Fix issues with new version v0.0.82 - CheckBackspace needs to be used instead of CheckBackspace - Comment out clashing/obtrusive leader/space mappings - Change classobj mappings to use `o` as they were clashing with the comment textobj. - Simulate the default statusline with the help of 'statusline'. Otherwise it would be empty/just containing coc elements. --- .config/vim/vimrc.d/25-coc.vim | 54 ++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/.config/vim/vimrc.d/25-coc.vim b/.config/vim/vimrc.d/25-coc.vim index bba3e5f..0244821 100644 --- a/.config/vim/vimrc.d/25-coc.vim +++ b/.config/vim/vimrc.d/25-coc.vim @@ -22,7 +22,7 @@ inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" " other plugin before putting this into your config. inoremap \ coc#pum#visible() ? coc#pum#next(1): - \ CheckBackspace() ? "\" : + \ CheckBackspace() ? "\" : \ coc#refresh() inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" @@ -72,8 +72,8 @@ autocmd CursorHold * silent call CocActionAsync('highlight') nmap rn (coc-rename) " Formatting selected code. -xmap f (coc-format-selected) -nmap f (coc-format-selected) +" xmap f (coc-format-selected) +" nmap f (coc-format-selected) augroup mygroup autocmd! @@ -94,7 +94,7 @@ nmap ac (coc-codeaction) nmap qf (coc-fix-current) " Run the Code Lens action on the current line. -nmap cl (coc-codelens-action) +nmap rcl (coc-codelens-action) " Map function and class text objects " NOTE: Requires 'textDocument.documentSymbol' support from the language server. @@ -102,10 +102,10 @@ xmap if (coc-funcobj-i) omap if (coc-funcobj-i) xmap af (coc-funcobj-a) omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) +xmap io (coc-classobj-i) +omap io (coc-classobj-i) +xmap ao (coc-classobj-a) +omap ao (coc-classobj-a) " Remap and for scroll float windows/popups. if has('nvim-0.4.0') || has('patch-8.2.0750') @@ -134,22 +134,24 @@ command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.org " Add (Neo)Vim's native statusline support. " NOTE: Please see `:h coc-status` for integrations with external plugins that " provide custom statusline: lightline.vim, vim-airline. -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} +set statusline=%f\ %y%h%w%m%r%= +set statusline+=%{coc#status()}%{get(b:,'coc_current_function','')} +set statusline+=\ \ %l,%c%V\ %P -" Mappings for CoCList -" Show all diagnostics. -nnoremap a :CocList diagnostics -" Manage extensions. -nnoremap e :CocList extensions -" Show commands. -nnoremap c :CocList commands -" Find symbol of current document. -nnoremap o :CocList outline -" Search workspace symbols. -nnoremap s :CocList -I symbols -" Do default action for next item. -nnoremap j :CocNext -" Do default action for previous item. -nnoremap k :CocPrev -" Resume latest coc list. -nnoremap p :CocListResume +" Mappings for CoCList disabled but kept here for look up reference. +" " Show all diagnostics. +" nnoremap a :CocList diagnostics +" " Manage extensions. +" nnoremap e :CocList extensions +" " Show commands. +" nnoremap c :CocList commands +" " Find symbol of current document. +" nnoremap o :CocList outline +" " Search workspace symbols. +" nnoremap s :CocList -I symbols +" " Do default action for next item. +" nnoremap j :CocNext +" " Do default action for previous item. +" nnoremap k :CocPrev +" " Resume latest coc list. +" nnoremap p :CocListResume