m0tive
m0tive

Reputation: 2946

Reopen a file closed by vim quickfix

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?

Upvotes: 5

Views: 1993

Answers (4)

skeept
skeept

Reputation: 12413

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.

Upvotes: 2

Dave Kirby
Dave Kirby

Reputation: 26552

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.

Upvotes: 3

Wernight
Wernight

Reputation: 37600

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.

Upvotes: 0

ZyX
ZyX

Reputation: 53604

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

Upvotes: 7

Related Questions