tags:

views:

157

answers:

3

for example, if I have something like this:

#include "filename.h"

when I select filename.h I want to use it as the input for opening the file named filename.h in a split. thanks in advance for any help.

+5  A: 

Place your cursor on the file name and press gf in normal mode.

:help gf

You might want to tweak the 'path' option for a list of directories where the file can be found.

:help 'path'
kemp
Thanks kemp. This also works but opens it in the current window. I prefer to open it in a (horizontal/vertical) split.
gnlnx
+5  A: 

I believe you want a ctrl+wctrl+f. Press these keys with the cursor over the filename.

René Nyffenegger
Thanks Rene. Is there a way to do it using a command? Using ctrl feels too much like emacs ;)
gnlnx
I meant to say a : command. Also Ctrl+w Ctrl+f opens it in horizontal split...do you know if there's a way to open in vertical split? Maybe I should just create a new set of questions :)
gnlnx
I don't know if a horizontal split is possible. I got used to ctrl in vim, but you might want to consider creating a map in order not to use the controls.
René Nyffenegger
+1  A: 

If you want this in a vertical split, and as a command, you can run :vertical wincmd f with your cursor over the word.

You can shorten this to :vert winc f or even nnoremap gf :vert winc f<cr> if you so choose.

Randy Morris