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

How do I navigate between multiple quickfix lists from previous searches or builds?

Answer

:colder

Explanation

Vim maintains a history stack of up to 10 quickfix lists. Every time you run :make, :vimgrep, :grep, or :cexpr, a new list is pushed onto the stack — and you can navigate back and forth with :colder and :cnewer. This lets you switch between a previous search and a new one without losing either.

How it works

  • :colder [N] — moves back N levels in the quickfix history stack (default 1)
  • :cnewer [N] — moves forward N levels (default 1)
  • Each :vimgrep, :make, or :grep call adds a new entry to the stack
  • The stack holds up to 10 lists; the oldest are discarded when the limit is reached

Example

:vimgrep /TODO/ **/*.js     " quickfix now has TODO hits
:vimgrep /FIXME/ **/*.js    " quickfix now has FIXME hits
:colder                     " back to the TODO list
:cnewer                     " forward to the FIXME list

Tips

  • Use :chistory to view a numbered list of all quickfix lists in the stack — it shows which one is currently active
  • The same concept applies to the location list: :lolder and :lnewer navigate its history
  • Jump directly to a specific entry with :colder 3 (go back 3 levels at once)

Next

How do I duplicate every line matching a pattern, placing a copy directly below each one?