Wednesday, January 26, 2011

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

Hi,

Erik Christiansen schrieb:
> On Wed, Jan 26, 2011 at 01:42:23PM +0100, Jürgen Krämer wrote:
>> Erik Christiansen:
>
>>> But ":set path" shows it should work OOTB:
>>>
>>> path=.,./include,..,../include,/usr/local/include,/usr/include
>
> ...
>
>> 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).
>
> Many thanks Jürgen! The first work-around fixes the problem. :-)
>
> I still don't understand why vim lists cwd ('.') in path by default, but

in the 'path' option '.' is not a placeholder for the current directory,
but for the directory of the current file. You can see the current
directory by executing :cwd in Vim.

> then fails to honour that declaration. This default distinctly seems to
> be incorrect and misleading behaviour description in 'path'.

The directory of the current file is not necessarily the same as the
current directory, e.g., you might have opened /usr/include/stdio.h (or
whatever the path to the standard C headers is) while still being in
your home directory. Then the dot in 'path' tells Vim to search in
/usr/include, but the empty string tells it to search in your home
directory.

> I'm sorry, but the purpose of the second work-around eludes me, so far.
> But the first one already allows vim to search in cwd (i.e. "next to the
> current file"), so I'm very happy with that.

The second one just differs in the order in which the directory of the
current file (first) and the current directory (second) are searched
through.

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: