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

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Peng Yu
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

Regards,
Peng

--
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
Reply | Threaded
Open this post in threaded view
|

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

Tony Mechelynck
On 04/01/13 15:26, 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
>
> Regards,
> Peng
>
What is your current directory inside Vim, as seen in reply to ":pwd"
(without the quotes)? In particular, is 'autochdir' set?

        :pwd
        :verbose set acd?

see
        :help :pwd
        :help 'autochdir'

Best regards,
Tony.
--
One way to stop a runaway horse is to bet on him.

--
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
Reply | Threaded
Open this post in threaded view
|

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

Benjamin Fritz
In reply to this post by Peng Yu
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
Reply | Threaded
Open this post in threaded view
|

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

Peng Yu
In reply to this post by Tony Mechelynck
> What is your current directory inside Vim, as seen in reply to ":pwd"
> (without the quotes)? In particular, is 'autochdir' set?
>
>         :pwd

/private/tmp/** (This is on mac, /tmp is a symbolic link to /private/
tmp)

>         :verbose set acd?

noautochdir

--
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
Reply | Threaded
Open this post in threaded view
|

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

Peng Yu
In reply to this post by Benjamin Fritz
> 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.

I'm not sure why you used "If". Isn't it for sure vim use '**' as
wildcard? I have to use wildcard in directory names for some reasons.

The meaning of '**' in a file path in a file usually shall not be
interpreted as wildcards. Therefore, I think that it is not reasonable
that vim does such an interpolation. At least there probably should be
a way to disable the interpolation. Is anybody aware of one?

Regards,
Peng

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