vimtricks.wiki Concise Vim tricks, one at a time.

How to navigate between buffers, quickfix entries, and location list items using bracket pairs with vim-unimpaired?

Answer

[b and ]b

Explanation

The vim-unimpaired plugin by Tim Pope adds symmetric [ and ] bracket mappings for navigating common Vim lists. The buffer mappings [b (previous buffer) and ]b (next buffer) turn multi-buffer workflows into fluent keyboard motions, eliminating the need to type :bprev or :bnext every time.

How it works

Buffer navigation:

  • [b — go to the previous buffer (:bprevious)
  • ]b — go to the next buffer (:bnext)
  • [B — jump to the first buffer (:bfirst)
  • ]B — jump to the last buffer (:blast)

The same [ / ] pattern applies across all major Vim lists:

Prefix List Commands
[q / ]q Quickfix :cprevious / :cnext
[l / ]l Location list :lprevious / :lnext
[a / ]a Argument list :previous / :next
[t / ]t Tag stack :tprevious / :tnext

Example

With three files open as buffers:

:ls
  1  "a.py"
  2 %a "b.py"   ← current
  3  "c.py"

Pressing ]b moves to c.py. Pressing [b returns to b.py. Adding a count like 2]b skips forward two buffers at once.

Tips

  • All bracket mappings accept a count prefix: 3]q jumps forward 3 quickfix entries
  • [B and ]B jump directly to the first or last entry in the list — great for resetting position
  • vim-unimpaired also provides option toggles ([ox for crosshairs, yos for spell, etc.) and encoding helpers — the buffer/list navigation is just one part of a much larger toolkit

Next

How do I enable matchit so % jumps between if/else/end style pairs?