I often jump from a file to file, while working a large codebase. I typically do this by way of putting cursor on the file, say foo.h, and typing "gf". I wonder if I can do the same thing, yet open the file in a split window.
One obvious solution is to simply type: vsp (sp) filename.
Put the cursor on the filename and type gf (in command mode). Or use CTRL + W | CTRL + F to open in another window.
Use the g f shortcut. Move your cursor on a path string, the exact cursor position is not important and then press g f in normal mode. g f stands for "goto file".
CTRL-^ Edit the alternate file. Mostly the alternate file is the previously edited file. This is a quick way to toggle between two files. It is equivalent to ":e #", except that it also works when there is no file name.
<c-w>gf
open in a new tab (Ctrl-w gf
)
<c-w>f
for split window <-- this is the answer you are seeking (Ctrl-w f
)
source: http://vim.wikia.com/wiki/Open_file_under_cursor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With