Navigate through quickfix history


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?

How useful was this tip?

Average rating 2.5 / 5. Vote count: 587

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Colin Bartlett

105 Posts

Vim enthusiast and software developer for more than 20 years.
View all posts