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

Can't open file with gf/gF for grep result on windows.

Expand Messages
  • mattn
    Hi list. Try below: C: temp grep Matsumoto c:/vim/src/*.c list C: temp vim list And you can see: c:/vim/src/gui_w48.c:1228: * forcedly redrawn. (Yasuhiro
    Message 1 of 4 , Mar 6, 2014
      Hi list.

      Try below:

      C:\temp>grep Matsumoto c:/vim/src/*.c > list
      C:\temp>vim list

      And you can see:

      c:/vim/src/gui_w48.c:1228: * forcedly redrawn. (Yasuhiro Matsumoto) */
      c:/vim/src/gui_w48.c:1925: /* added for non-MS IME (Yasuhiro Matsumoto) */

      Then, type gf or gF on left side at first line. As you know, isfname contains ":" on windows. So vim occur "E447: Can't find file ...".
      (NOTE: don't say "you can do it with :cfile", this is a problem about gf/gF)

      This is not useful. I wrote a patch for this problem.

      https://gist.github.com/mattn/9388140

      I tested below:

      http://www.google.com/ => HTML content(OK)
      http:/ssdfsdf => E447 Can't find file "http:/ssdfsdf" (OK)
      http:/ssdfsdf/ => E447 Can't find file "http:/ssdfsdf/" (OK)
      p:/ssdfsdf => E447 Can't find file "p:/ssdfsdf" (OK)
      p:/ssdfsdf/ => E447 Can't find file "p:/ssdfsdf/" (OK)
      _:/ssdfsdf/ => E447 Can't find file "_:/ssdfsdf/" (OK)
      _:ssdfsdf/ => E447 Can't find file "_:ssdfsdf/" (OK)
      :ssdfsdf/ => E447 Can't find file ":ssdfsdf/" (OK)
      c:/vim/src/gui_w48.c:1228: => Open the file(OK)
      c:/vim/src/gui_w48.c:1925: => Open the file(OK)
      ../../../vim/src/gui_w48.c:1925: => Open the file(OK)
      :::foo::: => E447 Can't find file ":::foo:::" (OK)

      Please check.

      Thanks.
      - Yasuhiro Matsumoto

      --
      --
      You received this message from the "vim_dev" 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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Antonio Giovanni Colombo
      HI everybody, for what is worth, I strongly agrre with Yasuhiro, and welcome his patch! Antonio -- /|| | Antonio Colombo / || | azc100@gmail.com / ()
      Message 2 of 4 , Mar 6, 2014
        HI everybody,

        for what is worth, I strongly agrre with Yasuhiro, and welcome his patch!

        Antonio
        -- 
              /||\    | Antonio Colombo
          / || \   |  azc100@...  
         /  ()  \  |  antonio@...  
        (___||___) |   azc10@...

        --
        --
        You received this message from the "vim_dev" 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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Bram Moolenaar
        ... I have also been wondering if we can make gf a bit more clever. I sometimes end up copying a path because its end is not clear. The way you detect a :
        Message 3 of 4 , Mar 8, 2014
          Yasuhiro Matsumoto wrote:

          > Try below:
          >
          > C:\temp>grep Matsumoto c:/vim/src/*.c > list
          > C:\temp>vim list
          >
          > And you can see:
          >
          > c:/vim/src/gui_w48.c:1228: * forcedly redrawn. (Yasuhiro Matsumoto) */
          > c:/vim/src/gui_w48.c:1925: /* added for non-MS IME (Yasuhiro Matsumoto) */
          >
          > Then, type gf or gF on left side at first line. As you know, isfname contains ":" on windows. So vim occur "E447: Can't find file ...".
          > (NOTE: don't say "you can do it with :cfile", this is a problem about gf/gF)
          >
          > This is not useful. I wrote a patch for this problem.
          >
          > https://gist.github.com/mattn/9388140
          >
          > I tested below:
          >
          > http://www.google.com/ => HTML content(OK)
          > http:/ssdfsdf => E447 Can't find file "http:/ssdfsdf" (OK)
          > http:/ssdfsdf/ => E447 Can't find file "http:/ssdfsdf/" (OK)
          > p:/ssdfsdf => E447 Can't find file "p:/ssdfsdf" (OK)
          > p:/ssdfsdf/ => E447 Can't find file "p:/ssdfsdf/" (OK)
          > _:/ssdfsdf/ => E447 Can't find file "_:/ssdfsdf/" (OK)
          > _:ssdfsdf/ => E447 Can't find file "_:ssdfsdf/" (OK)
          > :ssdfsdf/ => E447 Can't find file ":ssdfsdf/" (OK)
          > c:/vim/src/gui_w48.c:1228: => Open the file(OK)
          > c:/vim/src/gui_w48.c:1925: => Open the file(OK)
          > ../../../vim/src/gui_w48.c:1925: => Open the file(OK)
          > :::foo::: => E447 Can't find file ":::foo:::" (OK)

          I have also been wondering if we can make "gf" a bit more clever.
          I sometimes end up copying a path because its end is not clear.

          The way you detect a ":" terminating the name looks a bit too simple.
          How about file://c:/path ?
          It would be good to add a comment to explain what it's doing at least.

          A crude but effective solution would be to first take the longest path,
          see if it exists. If not, then try removing a part at the end and try
          again. This would require a list of "optional file name characters".
          We should not have more than two or three tries to avoid this taking a
          long time (it's disk operations, and $PATH can contain many directories).

          - Bram

          --
          To the optimist, the glass is half full.
          To the pessimist, the glass is half empty.
          To the engineer, the glass is twice as big as it needs to be.

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ an exciting new programming language -- http://www.Zimbu.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

          --
          --
          You received this message from the "vim_dev" 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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • mattn
          ... Updated patch: https://gist.github.com/mattn/9388140 (Not modified code, just only add comments) file://c:path should be worked correctly. The file: URL is
          Message 4 of 4 , Mar 9, 2014
            > I have also been wondering if we can make "gf" a bit more clever.
            > I sometimes end up copying a path because its end is not clear.
            >
            > The way you detect a ":" terminating the name looks a bit too simple.
            > How about file://c:/path ?
            > It would be good to add a comment to explain what it's doing at least.
            >
            > A crude but effective solution would be to first take the longest path,
            > see if it exists. If not, then try removing a part at the end and try
            > again. This would require a list of "optional file name characters".
            > We should not have more than two or three tries to avoid this taking a
            > long time (it's disk operations, and $PATH can contain many directories).

            Updated patch: https://gist.github.com/mattn/9388140
            (Not modified code, just only add comments)

            file://c:path should be worked correctly. The file: URL is passed to netrw,
            and netrw open the local paths.
            I'm thinking that it don't need to check the file is exists. Do you mean
            that the path which contains whitespace?

            Thanks.

            - Yasuhiro Matsumoto

            --
            --
            You received this message from the "vim_dev" 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

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          Your message has been successfully submitted and would be delivered to recipients shortly.