Re: Do a grep -r without match .svn directory ?

2006-12-06 Thread john_oshea
KLEIN Stéphane wrote:
 Hi,
 
 In vim, I would like do a :grep -r but don't match .svn directory.
 Grep or vim have this feature ?

You may, possibly, be interested in 'ack':

http://petdance.com/ack/

ack is a replacement for grep, aimed at programmers with large trees of
heterogeneous source code.

Top 10 reasons to use ack instead of grep.

   1. Searches recursively through directories by default, while
ignoring .svn, CVS and other VCS directories.
  * Which would you rather type?
$ grep pattern $(find . | grep -v .svn)
$ ack pattern
   2. ack ignores most of the crap you don't want to search
  * VCS directories
  * blib, the Perl build directory
  * backup files like foo~
  * binary files
   3. Lets you specify file types to search, as in --perl or --nohtml.
  * Which would you rather type?
$ grep pattern $(find . -name '*.pl' -or -name '*.pm' -or
-name '*.pod' | grep -v .svn)
$ ack --perl pattern 


-- 
John O'Shea
Wordbank Limited
33 Charlotte Street, London W1T 1RR
Direct line: +44 (0) 20 7903 8829
Fax: +44 (0) 20 7903 
http://www.wordbank.com/


Re: Do a grep -r without match .svn directory ?

2006-12-06 Thread Pádraig Brady
 On 12/4/06, KLEIN Stéphane [EMAIL PROTECTED] wrote:
 Hi,

 In vim, I would like do a :grep -r but don't match .svn directory.
 Grep or vim have this feature ?

Have a look at http://www.pixelbeat.org/scripts/findrepo

Pádraig.


Re: Do a grep -r without match .svn directory ?

2006-12-05 Thread Bob Davis

I tested it with '*svn*' and on cygwin grep which is:

grep (GNU grep) 2.5.1

and it worked.

Strangely enough if I put '*.svn*' it didn't work.

bob

Gary Johnson wrote:

Hi Bob,

That doesn't seem to work either.  I executed the following:

cd ~/.vim
grep -Rli --exclude=\*syntax\* maintainer .

and the results included files such as

./syntax/Decho.vim

I also tried variations including

--exclude=syntax
--exclude=*syntax*
--exclude='*syntax*'
'--exclude=*syntax*'

all with the same results.

Regards,
Gary



--
Bob Davis | Senior Advisory Software Developer - Applications
[EMAIL PROTECTED]
Work: 603-926-9696 x3456 Direct#: 603-929-8956
Home: 603-778-0781
Cell#: 603-793-6403
Aim: dad1732
Yim: rsdavis9


Re: Do a grep -r without match .svn directory ?

2006-12-04 Thread Yegappan Lakshmanan

Hi,

On 12/4/06, KLEIN Stéphane [EMAIL PROTECTED] wrote:

Hi,

In vim, I would like do a :grep -r but don't match .svn directory.
Grep or vim have this feature ?



If you use the grep.vim plugin, then you can set the Grep_Skip_Dirs
variable to skip the .svn directory. You can get this plugin from:

http://vim.sourceforge.net/scripts/script.php?script_id=311

- Yegappan


Re: Do a grep -r without match .svn directory ?

2006-12-04 Thread A.J.Mechelynck

KLEIN Stéphane wrote:

Hi,

In vim, I would like do a :grep -r but don't match .svn directory.
Grep or vim have this feature ?

Thanks for you help
Stephane



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

In Vim you would use (IIUC)

:set grepprg=grep\ -r\ --exclude=*.svn
:grep \word\ ~/dir/subdir/*


Best regards,
Tony.


Re: Do a grep -r without match .svn directory ?

2006-12-04 Thread Greg Matheson
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/*


-- 
Greg MathesonAll teaching is teaching 
 under difficult circumstances.
 --Dr Bean


Re: Do a grep -r without match .svn directory ?

2006-12-04 Thread A.J.Mechelynck

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.


Best regards,
Tony.