The closest I can think of is creating a function:
function! W() range execute "e " . getline("'<")[getpos("'<")[2]-1:getpos("'>")[2]] endfu
Then you can select a word and enter :call W() + enter, which should open a new buffer.
EDIT The above function does not work without errors if the buffer containing #include changed. In this case, the following function is better suited:
function! W() range let l:fileName = getline("'<")[getpos("'<")[2]-1:getpos("'>")[2]] new execute "w " . l:fileName endfu
EDIT 2 You can also try entering :e <cfile> (see :help <cfile> ).
EDIT 3 Finally, under :help gf you will find hidden
If you do want to edit a new file, use: > :e <cfile> To make gf always work like that: :map gf :e <cfile><CR>
source share