Written March 24, 2014. Tagged Vim.
There are some useful commands to navigate the quickfix list.
You probably already know that you can use
:cnext) to jump to the next result and
:cprevious) to jump to the previous result.
Maybe you even know about
:cpfile) to jump to the next or previous file with a result.
But my favorite quickfix list command is
Say you project-search for "foo" to look into an issue. You hit
:cn a few times.
But then you realize the rabbit hole runs deeper. What's that "bar" doing there?
So you project-search for "bar" and navigate that quickfix list for a while.
Now you want to get back to "foo".
You could search for "foo" again… or you could run
:cold jumps back to the last (older) list. It even remembers which item in the list you were on.
This effectively gives you a stack of project searches. You can make searches within searches and then jump back to previous ones.
To go forward again, there's
:cnewer). Vim remembers the ten last used lists for you.