----- Original Message -----
From: "Neil Gabriel" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, November 09, 2006 5:44 PM
Subject: grep.vim support
All,
I am relatively new to vim and gvim and I am trying to install the
grep plugin. So far, everything appears installed properly (i have
access to Grep, Rgrep, etc ... from within gvim). Also, I am running
WinXP with Cygwin. Reading through the plugin's install notes, i set
the following in my _vimrc file.
nnoremap <silent> <F3> :Grep<CR>
let Grep_Path = 'C:\tools\GnuWin32\bin\grep.exe'
let Egrep_Path = 'C:\tools\GnuWin32\bin\grep.exe'
let Grep_Xargs_Path = 'C:\tools\GnuWin32\bin\xargs.exe'
let Grep_Cygwin_Find = 1
(I also downloaded and installed the GNU Win32 tools)
At this point, Grep seems to work. I can issue the command, see the
results in the quickfix window and navigate accordingly. Rgrep (much
more useful to me) does not seem to work. No matter what symbol I'm
looking for or what my current working directory is, I never get a
single match. I had the suspicion that it was a forward-slash vs.
backward-slash issue so i was optimistic when i found the
'Grep_Cygwin_Find' option, but that did not seem to work. Any
suggestions out there?
I use several different solutions for different scenarios. When a basic or extended regex will do, I use mingw grep, invoked from a
Bash script on all of the files in my current "project". (I have a separate Bash script that uses find to build a list of project
source files appropriate to the current project, so that I don't waste time and keystrokes specifying patterns that don't change
from one grep to the next.) Note that this Bash script passes the pattern to grep on stdin, which protects it from any sort of DOS
or Bash shell escaping. This means I can type the pattern on the Vim command line *EXACTLY* as I wish it to be seen by grep. The
importance of this cannot be overstated... Also, I can invoke grep as fgrep, grep, or egrep, depending upon what level of regex
functionality is required. Originally, my Bash script used xargs to invoke grep, but I found that I could achieve significant
execution time savings by running grep on "chunks" of 50-100 files at a time (actual number is an option to the Bash script), rather
than running it once per file as was being done with xargs. (Consider that the grep pattern must be recompiled every time grep is
invoked. The savings are minimal or non-existent for small numbers of files, but become significant when grepping a large number of
files.) I have found that for the majority of grep searches, a basic or extended regex works just fine, and the search is lightning
fast. However, when I need to do a more complex regex search, I have 2 options:
1) vimgrep - Takes a while, but supports Vim's powerful regex dialect
2) pgrep.pl - My own "perl grep" script, which supports multi-line, Perl regex patterns, applied to a "sliding window" of a
specifiable number of lines of leading and trailing context.
Hope that helps...
Brett Stahlman
Thanks