Thursday, September 2, 2010

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

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@gmail.com> wrote:


On Sep 1, 5:49 pm, Kyro El <zzmy...@gmail.com> 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

No comments: