Coc.nvim: Change ]c to ]C to avoid conflicting with vimdiff

Created on 27 Aug 2019  ·  3Comments  ·  Source: neoclide/coc.nvim

The readme suggests creating these mappings:

" Use [c and ]c to navigate diagnostics.
nmap [c (coc-diagnostic-prev)
nmap ]c (coc-diagnostic-next)

but doing so will stop those shortcuts from working with vimdiff. I recommend changing the README to suggesting capitalized versions ]C and [C to not conflict.

Thanks

Most helpful comment

I use ]g and [g to navigate diagnostics:

nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)

And ]c and [c to navigate coc-git diff chunks so that the mapping matches vimdiff:

nmap <silent> <expr> [c &diff ? '[c' : '<Plug>(coc-git-prevchunk)'
nmap <silent> <expr> ]c &diff ? ']c' : '<Plug>(coc-git-nextchunk)'

I guess if you like ]c for navigating diagnostics but don't want it to conflict with vimdiff you can have similar mappings:

nmap <silent> <expr> [c &diff ? '[c' : '<Plug>(coc-diagnostic-prev)'
nmap <silent> <expr> ]c &diff ? ']c' : '<Plug>(coc-diagnostic-next)'

All 3 comments

I don't like uppercase letter with keymapping.

@chemzqm well doesn't have to be uppercase, just a suggestion.

I use ]g and [g to navigate diagnostics:

nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)

And ]c and [c to navigate coc-git diff chunks so that the mapping matches vimdiff:

nmap <silent> <expr> [c &diff ? '[c' : '<Plug>(coc-git-prevchunk)'
nmap <silent> <expr> ]c &diff ? ']c' : '<Plug>(coc-git-nextchunk)'

I guess if you like ]c for navigating diagnostics but don't want it to conflict with vimdiff you can have similar mappings:

nmap <silent> <expr> [c &diff ? '[c' : '<Plug>(coc-diagnostic-prev)'
nmap <silent> <expr> ]c &diff ? ']c' : '<Plug>(coc-diagnostic-next)'
Was this page helpful?
0 / 5 - 0 ratings