Open file under cursor declared as #include in the C/C++ code in Vim? -


i how can open file under cursor in vim.

is there way open files declared below?

#include <iostream> #include "limits.h" 

you can use:

  • gf edit file name under cursor in current window (requires 'nomodified' on existing buffer in current window).
  • ^wf edit file name under cursor in new window. (note: conveniently, ^w^f works.)
  • ^wgf edit file name under cursor in new tab page.

for work, 'path' setting must contain location of target file.

to give example, here's 'path' on current system:

.,/usr/include,, 

because limits.h located @ /usr/include/limits.h, works automatically.

however, because iostream located @ /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/iostream, not work automatically. can run

set path+=/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++ 

to change to

.,/usr/include,,,/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++ 

and works. exact path differ on system.


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -