Wednesday, January 26, 2011

Re: Vim path not working for me (On ".")

Hi,

Erik Christiansen:
> When I have a full pathname in a file, then gf works fine.
>
> But given only the filename of a file in the current directory, vim
> complains "E447: Can't find file xxx in path"
>
> If I prefix each filename with a superfluous "./", then gf works fine.

yes, because it doesn't use the 'path' option in this case.

> But ":set path" shows it should work OOTB:
>
> path=.,./include,..,../include,/usr/local/include,/usr/include

the dot is a placeholder for the path of the current file, thus if you
happen to be in a file from a different directory, gf will search in
that directory. To search through the current directory you need to
include an empty string in the path option, e.g.,

path=,.,./include,..,../include,/usr/local/include,/usr/include

(or

path=.,,./include,..,../include,/usr/local/include,/usr/include

if you want to search next to the current file first).

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: