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

Re: Forcing Vim to use findstr as 'grepprg' on Windows

Expand Messages
  • Ben Fritz
    ... The Vim help tells you exactly what goes on under the hood . ... grepprg gp string (default grep -n , Unix: grep -n $* /dev/null , Win32: findstr
    Message 1 of 6 , Sep 2, 2010
    • 0 Attachment
      On Sep 1, 5:49 pm, Kyro El <zzmy...@...> wrote:
      > I have trouble forcing Vim to use findstr /N as grepprg on Windows. I don't
      > know what tricks does Vim do under the hood, but my grepprg is set to 'grep
      > -nH $*' by default. However, while I do have a copy of grep in my path, it
      > doesn't support the '-H' option.
      >

      The Vim help tells you exactly what goes on "under the hood".

      :help 'grepprg' says:

      'grepprg' 'gp' string (default "grep -n ",
      Unix: "grep -n $* /dev/null",
      Win32: "findstr /n" or "grep -n",
      VMS: "SEARCH/NUMBERS ")

      Note that nowhere is 'grep -nH $*' listed. You must be setting it
      yourself in your configuration somewhere. Use :verbose set grepprg? to
      find out where.

      Note this also, from the same help location:
      For Win32, the default is "findstr /n" if "findstr.exe" can be found,
      otherwise it's "grep -n".

      --
      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
    • Kyro El
      Thanks Ben, I did check the documents before I posted here. In the same section in the help document, it mentions about using -H if your grep supports it.
      Message 2 of 6 , Sep 2, 2010
      • 0 Attachment
        Thanks Ben,
         
        I did check the documents before I posted here. In the same section in the help document, it mentions about using "-H" if your grep supports it. That's why I'm confused and thought vim did something "under the hood" but not documented.
         
        But yes you're right. I later found that I sourced a script in which I myself set grepprg to "grep -nH $*" years ago, because latex-suite suggested doing so (http://vim-latex.sourceforge.net/documentation/latex-suite/recommended-settings.html)

        I should be more careful next time:)
         
        Thanks for the help!
         
        On Thu, Sep 2, 2010 at 6:28 AM, Ben Fritz <fritzophrenic@...> wrote:


        On Sep 1, 5:49 pm, Kyro El <zzmy...@...> wrote:
        > I have trouble forcing Vim to use findstr /N as grepprg on Windows. I don't
        > know what tricks does Vim do under the hood, but my grepprg is set to 'grep
        > -nH $*' by default. However, while I do have a copy of grep in my path, it
        > doesn't support the '-H' option.
        >

        The Vim help tells you exactly what goes on "under the hood".

        :help 'grepprg' says:

        'grepprg' 'gp'          string  (default "grep -n ",
                                               Unix: "grep -n $* /dev/null",
                                               Win32: "findstr /n" or "grep -n",
                                                             VMS: "SEARCH/NUMBERS ")

        Note that nowhere is 'grep -nH $*' listed. You must be setting it
        yourself in your configuration somewhere. Use :verbose set grepprg? to
        find out where.

        Note this also, from the same help location:
               For Win32, the default is "findstr /n" if "findstr.exe" can be found,
               otherwise it's "grep -n".

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

        --
        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
      • Kyro El
        Thanks for the hint, too.I didn t know about :verbose before:) ... -- You received this message from the vim_use maillist. Do not top-post! Type your reply
        Message 3 of 6 , Sep 2, 2010
        • 0 Attachment
          Thanks for the hint, too.I didn't know about :verbose before:)

          On Wed, Sep 1, 2010 at 6:02 PM, John Beckett <johnb.beckett@...> wrote:
          Kyro El wrote:
          > I have trouble forcing Vim to use findstr /N as grepprg on
          > Windows. I don't know what tricks does Vim do under the hood,
          > but my grepprg is set to 'grep -nH $*' by default. However,
          > while I do have a copy of grep in my path, it doesn't support
          > the '-H' option.
          >
          > I then put 'set grepprg=findstr\ /N' in my path. But I still
          > got 'grep -nH $*' then vim is brough up.

          By "in my path" you probably mean "in my vimrc". At any rate,
          start Vim and enter command:

          :verbose set grepprg?

          That reports the current value and where it was set.

          If it says 'findstr /n' that is the command string that will be
          used for :grep.

          At command prompt (not Vim), you could run findstr to verify
          that it is running the standard Windows program (i.e. that you
          do not have something with the same name that is interfering).

          John

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

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