On 2006-12-05, "A.J.Mechelynck" <[EMAIL PROTECTED]> wrote: > Greg Matheson wrote: > > On Tue, 05 Dec 2006, A.J.Mechelynck wrote: > > > >> KLEIN Stéphane wrote: > >>> Hi, > > > >> This is actually OT for Vim, since grep is an external program; but you > >> can use > > > >> grep -r --exclude=PATTERN > > > >> to skip any directory matching the pattern (at least with GNU grep). > > > > Apparently this doesn't work for GNU grep. It only excludes > > matches on file basenames, I am told. > > > > Correct me if I am wrong. > > > >> In Vim you would use (IIUC) > > > >> :set grepprg=grep\ -r\ --exclude=*.svn > >> :grep \<word\> ~/dir/subdir/* > > > > > > Hmm... In "man grep" I read > > -R, -r, --recursive > Read all files under each directory, recursively; this is > equiv- > alent to the -d recurse option. > > --include=PATTERN > Recurse in directories only searching file matching PATTERN. > > --exclude=PATTERN > Recurse in directories skip file matching PATTERN. > > so maybe you're right. I haven't tested it.
I was going to suggest --exclude in response to the original post, so I tested it. It doesn't work. However, you could use 'find' and 'xargs' with 'grep', something like this: set grepprg=find\ .\ -name\ svn\ -prune\ -o\ -print\\\|\xargs\ grep\ -n It's getting late, so that _is_ untested, although I've done something similar before on a computer I don't have access to at the moment. HTH, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA