When I populate the quickfix window (say with grep or Ag.vim), I can scroll through the entries, and all the positions inside the quickfix window show up in :jumps. But as soon as I navigate away (say I gf on a quickfix entry to go to the file), and then attempt to <c-o>, it doesn't take me back to the quickfix window, and indeed :jumps has been pruned of all my quickfix locations.

I would like to gf into a file, poke around, and then <c-o> back to the quickfix buffer -- is there anyway to get this behavior?

I believe I've seen this behavior before but I'm not sure if there's some option I set to change it.

  • Why exactly do you gf in the quickfix window? Use <CR> to open a quickfix entry. Also, use <C-w>p to put the cursor in the previous window.
    – romainl
    May 19, 2015 at 22:01

2 Answers 2


I don't think you took the time to read :help quickfix.

Your :grep results populate the "quickfix list" which is then optionally displayed in the "quickfix window". The whole quickfix mechanism is completely independent from the jumplist.

When using the quickfix window, you are supposed to press <CR> to jump to the location of the current entry while leaving the window open for further use. <C-w>p is the generic command for jumping back to the previous window; you can use it to go back to the quickfix window.

Furthermore, Vim makes it possible to go down and up that list with :cnext, :cprevious, :clast and so on without opening the quickfix window. This means that you can still navigate the list if you accidentally closed the quickfix window.

Jumps and gf are totally useless when dealing with the quickfix list/window.

My setup is probably a bit too heavily customized for the gif below to be a good demo but I tried to show how one typically uses the quickfix list and the quickfix window.


  • 3
    Right away map :cnext and :cprev to something convenient. Personally I use ]q and [q which are provided by unimpaired.vim. If you pick good mappings you will be surprised how little you need the quickfix window. May 19, 2015 at 23:46
  • 1
    Indeed, :cn and :cp become tedious very quickly, even with @:. I have them mapped to <End> and <Home> respectively.
    – romainl
    May 20, 2015 at 7:08

I would recommend the vim-unimpaired plugin, which has convenient mappings for quickfix motions (and then some). It's not the most minimal solution, but check the source code if you want to roll your own mappings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.