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

69217Re: Rgrep not working on vim 64-bit, win7

Expand Messages
  • Dariusz Gadomski
    Apr 23, 2013
    • 0 Attachment
      Hi

      On Wed, Apr 24, 2013 at 7:28 AM, Yegappan Lakshmanan
      <yegappanl@...> wrote:
      > Hi,
      >
      > On Tue, Apr 23, 2013 at 6:00 PM, Yegappan Lakshmanan
      > <yegappanl@...> wrote:
      >>> >
      >>> > This problem is caused by the shell command line quote escape
      >>> > character in MS-Windows.
      >>> > I have a fix for this issue. I will update the grep plugin and release
      >>> > a new version.
      >>> >
      >>> > - Yegappan
      >>>
      >>> I was trying to analyze this problem further and what I found out that
      >>> actually vim calls something like this underneath:
      >>> cmd /c (C:\msys\bin\find.exe C:\dev\<my-project> -type d ( -name .SVN ) -prune
      >>> -o -type f ( -name *.cpp ) -exec c:\msys\bin\grep.exe -s -n -- TODO {} ;)
      >>>
      >>> When I tried to paste it directly to cmd.exe I got:
      >>> -prune was unexpected at this time.
      >>> So no std output was generated and the process terminated with an error
      >>> on stderr - hence no tmp file created.
      >>> I think those brackets around cmd /c call conflict with brackets that make
      >>> a part of find call itself. When I replace the outer brackets with quotation
      >>> marks:
      >>> cmd /c "C:\msys\bin\find.exe C:\dev\<my-project> -type d ( -name .SVN )
      >>> -prune -o -type f ( -name *.cpp ) -exec c:\msys\bin\grep.exe -s -n --
      >>> TODO {} ;"
      >>> I get no error and expected output is printed.
      >>>
      >>> So my guess is either:
      >>> - a different method is needed in the find call to group the conditions
      >>> (does find even allow a different way of grouping?) or
      >>> - inner brackets need somehow be escaped in the call or
      >>> - vim system() call needs to be fixed to handle brackets in the argument string.
      >>>
      >>> Maybe is there another way to fix it or at least provide a temporary
      >>> work-around?
      >>>
      >>> I would appreciate any hints that would enable me to use Rgrep until this
      >>> problem gets fixed.
      >>>
      >>
      >> The approach that works and used by the taglist plugin is to write the
      >> command line
      >> into a temporary .cmd file and execute it. The grep plugin also will use this
      >> approach.
      >>
      >
      > I have uploaded a new version of the grep plugin to the Vim online website.
      > You can try using the new version and let me know if you see any issues.
      >

      Great, the new version returns no error. Thanks!

      However, the Quickfix list contains no filenames, only line numbers, so it's
      impossible to jump directly from the quicklist to the place that grep found.
      Is there a "-H" flag missing to grep or does the msys version of grep behave
      differently?

      I observe one more strange thing. If I run:
      :Rgrep TODO
      and give the directory to search and file extensions in subsequent prompts
      it all works flawlessly, but if I run:
      :Rgrep TODO *.cpp
      the find command is expanded to:
      (...) -type f ( -name -o -name *.cpp ) (...)
      and returns no results. Providing more than one extension:
      :Rgrep TODO *.cpp *.h
      results with expanding to:
      (...) -type f ( -name -o -name *.cpp -name *.h ) (...)
      which still provides no results.

      Is that behavior expected or is giving file extensions inline not supported?

      Thanks,
      Darek

      --
      --
      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.
    • Show all 19 messages in this topic