Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim problem with gf command

Tags:

vim

I am using Vim and I have set the path (set path+= c:/work/etc/etc) to my project directory (for C#), but still using command 'gf' give me error:

E:447 Can't find file.

Is there anything I am doing wrong over here?

like image 388
gearsin Avatar asked Dec 19 '09 10:12

gearsin


2 Answers

G'day,

To get a bit more detail on your current path settings you can see what's being included and the files vim can't find by entering the command:

:checkpath

and you'll get a dump of the files not found, e.g.

--- Included files not found in path --- 
<io.h> 
vim.h --> 
  <functions.h> 
  <clib/exec_protos.h>

Or you can get a listing of all included files, both found and not found, by entering

:checkpath!

Enter

:help path

to get more info on the path syntax.

Edit: Don't forget that using the syntax

set path=/work

will completely reset your path variable to what you've just declared. I'd suggest using

set path+=/work

instead. This won't clobber the current path and will just add your /work directory instead.

HTH

like image 170
Rob Wells Avatar answered Oct 15 '22 19:10

Rob Wells


I also found out that

:set path+=./foo/bar

adds a search location relative to the directory of the current file, just like '.' does.

My vim didn't want to search for such include

#include <common/util/string.h>

So what I needed to do was

:set path+=foo/bar

instead of

:set path+=./foo/bar

The former adds a search path relative to current working directory. Hopefully it helps someone.

like image 8
Yuri Pozniak Avatar answered Oct 15 '22 18:10

Yuri Pozniak