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

How do I browse through my previous quickfix lists?

Answer

:colder / :cnewer

Explanation

Vim remembers up to 10 previous quickfix lists. The :colder command goes to an older list, and :cnewer goes to a newer one. This means you can run multiple searches or builds without losing previous results.

How it works

:vimgrep /TODO/ **/*.go    " Creates quickfix list #1
:vimgrep /FIXME/ **/*.go   " Creates quickfix list #2
:vimgrep /BUG/ **/*.go     " Creates quickfix list #3

:colder       " Go back to FIXME results (list #2)
:colder       " Go back to TODO results (list #1)
:cnewer       " Forward to FIXME results (list #2)
:cnewer       " Forward to BUG results (list #3)

Viewing quickfix history

:chi           " Short for :chistory — shows all quickfix lists

Output:

  1: 15 entries   :vimgrep /TODO/ **/*.go
  2: 8 entries    :vimgrep /FIXME/ **/*.go
> 3: 3 entries    :vimgrep /BUG/ **/*.go

The > marker shows the current list.

Practical uses

  • Run :make multiple times and compare error lists
  • Search for different patterns and keep all results accessible
  • Use :grep for different queries without losing previous results
  • Compare linting results before and after a fix

Location list equivalents

:lolder     " Older location list
:lnewer     " Newer location list
:lhi        " Location list history

Tips

  • Vim stores the last 10 quickfix lists — older ones are discarded
  • Each :vimgrep, :grep, :make, :cgetexpr, etc. creates a new list
  • :colder 3 jumps back 3 lists at once
  • The quickfix window (:copen) automatically updates when you switch lists
  • This feature eliminates the need to re-run searches — your history is preserved
  • Documented under :help :colder

Next

How do I run the same command across all windows, buffers, or tabs?