Friday, January 4, 2013

Re: problem with '**' and "!" in path when Ctrl_W_Ctrl_F is pressed?

On Friday, January 4, 2013 8:26:59 AM UTC-6, Peng Yu wrote:
> Hi,
>
>
>
> I have the following files.
>
>
>
> /tmp/**$ cat.sh ../\!/main.txt main.txt
>
> ==> ../!/main.txt <==
>
> in a
>
>
>
> ==> main.txt <==
>
> main.txt
>
>
>
> When I open main.txt, then press Ctrl_W_Ctrl_F on "main.txt", I gets
>
> to /tmp/!/main.txt but not /tmp/**/main.txt. Is it a bug in vim? If
>
> so, does anybody know how to fix it? Thanks!
>
>
>
> /tmp/**$ vim main.txt
>
>

It seems to me that Vim is using the ** directory name as a wildcard instead of a literal path; see :help file-searching. I'm pretty sure having a directory named '**' (and actually '!' as well) is a bad idea, but if you're stuck with it for some reason, you can see if you can work around it using Vim's 'path' option. Try entering the ** path before the current directory in 'path', escaping the * characters with backslash, like:

:set path^=/tmp/\\*\\* " untested

If you don't need this very often, and if I'm right that Vim is using the current directory as wildcards instead of as a literal path, Vim probably also finds /tmp/**/main.txt, but ! is probably before ** in the search path. Try using :2sfind instead of <C-W><C-F>.

If Vim *is* using the current directory as a wildcard instead of as a literal path, then yes I would consider it a bug... but I also think it's asking for trouble to name directories using wildcard characters.

--
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: