VimTrick: Navigate through quickfix history

Quickly get back to a previous quickfix list with :colder

The quickfix list in Vim was originally designed to show compiler errors. Many plugins use this area to return a list of results, options, or other items that can be cycled through. If you’ve grepped or awked your way through your project, you’ve used the quickfix list.

You can easily see the last quickfix list with :cwin. But every time you grep, awk, or dispatch, you get a new quickfix list. When you’ve replaced its contents with a new one, how do you get back to an older one?

Vim provides an easy way:

  • :colder (to go to an older quickfix list)

  • :cnewer (to go to a newer quickfix list

In the short gif below you can see us using :Ggrep from Fugitive to search. Then, we open the quickfix window with :cwin and see the results. Next we do another search. To get back to our previous, older quickfix window, we use :colder. Then, we can return to the most recent search results with :cnewer.

Are you using Unimpaired for its easy to remember pairs of handy bracket mappings? Well, unfortunately, Unimpaired does not yet support navigating through the quickfix history with shortcuts. But! We can submit a pull request and get it added. If we can collectively think if a good mnemonic that’s as yet unused by Unimpaired. Any ideas?

If you have suggestions for a good bracket mapping for :colder and :cnewer, comment on this post:

View comments

Was this useful? Help us improve!

With your feedback, we can improve VimTricks. Click a link to vote: