I am using Vim for windows installed in Unix mode. Thanks to this site I now use the gf
command to go to a file under the cursor.
I\'m looking for a com
I don't know the answer to part 2 of your question, but I can help with part 1. Use
:e#
Vim maintains a list of files (buffers) that it's editing. If you type
:buffers
it will list all the files you are currently editing. The file in that list with a % beside it is the current file. The one with the # beside it is the alternate file. :e# will switch between the current and alternate file. Rather than type that much, I map F2 to :e# so I can easily flip between the current and alternate files. I map the command to F2 by adding this to .vimrc
nmap `<F2> :e#<CR>`
Just use :e#
followed by Enter - that basically says to edit the last (most recent) file.
Ctrl-Shift-6 is one.
:e#↲
is another.
I use Ctrl-O
I frequently use Ctrl-6 for this.
It's handy because it allows me to quickly jump back and forth between the two files.
You might want to use CTRL-W gf
to open the file in a new tab.
You can close the newly opened file as always with :bd
, or use CTRL-6
and other usual ways of changing buffers.