vim:coc: Fix issues with new version v0.0.82

- CheckBackspace needs to be used instead of <SID>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.
This commit is contained in:
2022-10-21 01:51:45 +02:00
parent 928b1e8647
commit fc9f8f93ef

View File

@@ -22,7 +22,7 @@ inoremap <silent><expr> <C-p> coc#pum#visible() ? coc#pum#prev(1) : "\<C-n>"
" other plugin before putting this into your config. " other plugin before putting this into your config.
inoremap <silent><expr> <TAB> inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1): \ coc#pum#visible() ? coc#pum#next(1):
\ <SID>CheckBackspace() ? "\<Tab>" : \ CheckBackspace() ? "\<Tab>" :
\ coc#refresh() \ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>" inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
@@ -72,8 +72,8 @@ autocmd CursorHold * silent call CocActionAsync('highlight')
nmap <leader>rn <Plug>(coc-rename) nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code. " Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected) " xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected) " nmap <leader>f <Plug>(coc-format-selected)
augroup mygroup augroup mygroup
autocmd! autocmd!
@@ -94,7 +94,7 @@ nmap <leader>ac <Plug>(coc-codeaction)
nmap <leader>qf <Plug>(coc-fix-current) nmap <leader>qf <Plug>(coc-fix-current)
" Run the Code Lens action on the current line. " Run the Code Lens action on the current line.
nmap <leader>cl <Plug>(coc-codelens-action) nmap <leader>rcl <Plug>(coc-codelens-action)
" Map function and class text objects " Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server. " NOTE: Requires 'textDocument.documentSymbol' support from the language server.
@@ -102,10 +102,10 @@ xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i) omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a) xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a) omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i) xmap io <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i) omap io <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a) xmap ao <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a) omap ao <Plug>(coc-classobj-a)
" Remap <C-f> and <C-b> for scroll float windows/popups. " Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750') 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. " Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that " NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline. " 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 " Mappings for CoCList disabled but kept here for look up reference.
" Show all diagnostics. " " Show all diagnostics.
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr> " nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions. " " Manage extensions.
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr> " nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Show commands. " " Show commands.
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr> " nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document. " " Find symbol of current document.
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr> " nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols. " " Search workspace symbols.
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr> " nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item. " " Do default action for next item.
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR> " nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
" Do default action for previous item. " " Do default action for previous item.
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR> " nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list. " " Resume latest coc list.
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR> " nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>