Is your feature request related to a problem? Please describe.
As it stands, there appears to be no way to jump to the first/last/any error in the current buffers. This unctionality would be very helpful during refactoring and saves time not having to open the Denite-based diagnostics list and look through that.
Describe the solution you'd like
Perhaps a code action could be implemented, "nextProblem" or something like that.
Describe alternatives you've considered
N/A
Additional context
ALE has something similar, with an :ALENext command.
You can navigate errors by setup mapping of <Plug>(coc-diagnostic-next) and <Plug>(coc-diagnostic-prev), see :h coc-diagnostic-next.
If your want to use command ,use
command! -nargs=0 Next :call CocAction('diagnosticNext')<CR>
command! -nargs=0 Prev :call CocAction('diagnosticPrevious')<CR>
I don't like setup commands in plugin because they pollute the command list of vim.
@chemzqm thanks!
Is it possible to navigate only to next/prev error, bypassing warnings?
@dakom Use Denite coc-diagnostic, errors would be on top, and you can use keymap like:
nnoremap <silent> <space>j :Denite -resume -cursor-pos=+1 -immediately<CR>
nnoremap <silent> <space>k :Denite -resume -cursor-pos=-1 -immediately<CR>
to jump.
Hmmm haven't installed Denite yet... guess I'll need to give it a shot ;)
Thanks!
btw those are my bindings too! (well, I have Leader set to spacebar and use Leader-j/k, but same thing) :)
I tried it out... maybe it's because I never used Denite before, but it was really buggy
I had to first open the diagnostics, and only then after closing it did the bindings work properly
Would be great if there was simply a coc-diagnostic-next-error / coc-diagnostic-prev-error alternative so I could map it directly like this:
nmap <silent> <Leader>j <Plug>(coc-diagnostic-next-error)
nmap <silent> <Leader>k <Plug>(coc-diagnostic-prev-error)
@dakom Answer is what I went with. A mixture of one of the earlier answers
try
nmap <silent> [c :call CocAction('diagnosticNext')<cr>
nmap <silent> ]c :call CocAction('diagnosticPrevious')<cr>
endtry
Then I can press [c to go to the next Diagnostic, and ]c to go back to the previous Diagnostic.
Issuing: :CocDiagnostics will bring up a new window that can be used to navigate and review diagnostic detections.
Most helpful comment
You can navigate errors by setup mapping of
<Plug>(coc-diagnostic-next)and<Plug>(coc-diagnostic-prev), see:h coc-diagnostic-next.If your want to use command ,use
I don't like setup commands in plugin because they pollute the command list of vim.