tags:

views:

124

answers:

4

When I use vim's quickfix to jump to errors in my build, if the file containing an error isn't already open it opens it in one of my splits, replacing the file I had open.

Is there a way to either reopen last closed file in a split or get quickfix to open files in a new split?

A: 

You can use :cn :cp :cl to jump to previous/next/list errors in a build. This way you can :bn and then :bp. Or use markers: ma, 'a.

Wernight
These are all *buffer* commands, not build commands.
Johnsyweb
Oups *Mea Coupa*. It's `cn`, `cp`, `cl`. HA HA Very sorry.
Wernight
+2  A: 

Try using <C-o> in normal mode. It takes you to the previous position, even if previous position was in other file.

ZyX
This (and what Dave Kirby said) is what I was looking for. Thanks
m0tive
A: 

If you have the quickfix window open then pressing <ctrl-W><enter> while the cursor is on the error you want to go to will open the file in a new split window.

Dave Kirby
This is exactly what I was trying to do... though I think Zyx's answer also solves the problem. Thanks
m0tive
+1  A: 

what I do in this case is the following: before starting the compilation process I first split the window

:sp

After the compilation process I just go to the original window (the one I created with split) and do CTRL-w+o closing other windows and leaving me in the original position.

skeept
You can also split and run a command all in one go, e.g. `:sp make`
Dave Kirby
:sp | make works
skeept