How do I navigate through the quickfix list?
Answer
:cnext and :cprev
Explanation
The quickfix list holds a set of file positions, typically from compiler errors, grep results, or other tools. You navigate it with :cnext and :cprev to step through each entry.
How it works
:cnext(or:cn) moves to the next quickfix entry:cprev(or:cp) moves to the previous entry:cfirstand:clastjump to the first and last entries:copenopens the quickfix window
Example
After running :make and getting 5 errors:
:cnext " Jump to error 2
:cnext " Jump to error 3
:cprev " Back to error 2
Tips
:clistshows all quickfix entries:cc Njumps to entry number N]qand[qare unimpaired-style mappings (with vim-unimpaired plugin)- The location list (
:lnext/:lprev) is the per-window equivalent