How do I navigate quickfix and location list entries with intuitive bracket mappings?
Answer
[q / ]q
Explanation
The vim-unimpaired plugin by Tim Pope provides bracket-pair mappings for navigating quickfix and location list entries: [q moves to the previous entry and ]q moves to the next — mirroring the mental model of [ for backward and ] for forward throughout the plugin.
These mappings eliminate the need to remember :cprev and :cnext, and fit naturally with unimpaired's consistent bracket convention across many Vim workflows.
How it works
[q—:cprev— jump to the previous quickfix entry]q—:cnext— jump to the next quickfix entry[Q—:cfirst— jump to the very first entry]Q—:clast— jump to the very last entry
For the location list (window-local), the same pattern applies with l:
[l/]l—:lprev/:lnext[L/]L—:lfirst/:llast
Example
After running :make or a grep search that populates the quickfix list:
:grep -r "TODO" src/
Navigate results without leaving the keyboard home row:
]q → jump to next match
]q → jump to next match
[q → jump back to previous match
]Q → jump to last match
[Q → jump to first match
Tips
- Unimpaired provides identical bracket pairs for arguments (
[a/]a), buffers ([b/]b), and tabs ([t/]t) — all with the same first/last shortcuts via uppercase - When the quickfix list is exhausted in one direction, unimpaired wraps around to the other end
- Use
[l/]lin plugins that use location lists (e.g., ALE, coc.nvim) for per-window diagnostics - Install:
tpope/vim-unimpaired(vim-plug:Plug 'tpope/vim-unimpaired')