Loading ...
Sorry, an error occurred while loading the content.
 

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

Expand Messages
  • Peng Yu
    Hi, I have the following files. /tmp/**$ cat.sh ../ !/main.txt main.txt == ../!/main.txt main.txt
    Message 1 of 5 , Jan 4, 2013
      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
    • Tony Mechelynck
      ... What is your current directory inside Vim, as seen in reply to :pwd (without the quotes)? In particular, is autochdir set? ... see ... Best regards,
      Message 2 of 5 , Jan 4, 2013
        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
      • Ben Fritz
        ... 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
        Message 3 of 5 , Jan 4, 2013
          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
        • Peng Yu
          ... /private/tmp/** (This is on mac, /tmp is a symbolic link to /private/ tmp) ... noautochdir -- You received this message from the vim_use maillist. Do not
          Message 4 of 5 , Jan 5, 2013
            > 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
          • Peng Yu
            ... 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 **
            Message 5 of 5 , Jan 5, 2013
              > 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
            Your message has been successfully submitted and would be delivered to recipients shortly.