[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vim
Subject:    Re: find a pattern in multiple files
From:       "Antoine J. Mechelynck" <antoine.mechelynck () belgacom ! net>
Date:       2005-02-25 11:00:55
Message-ID: 421F0567.5020908 () belgacom ! net
[Download RAW message or body]

François Pinard wrote:
> [Antoine J. Mechelynck]
> 
> 
>>In Vim version 7 (ALPHA!), you can use the :vimgrep command:
> 
> 
>>	:vimgrep /pattern/ *.txt
> 
> 
>>then your matches will appear in the quickfix window (see ":help 
>>quickfix.txt").
> 
> 
>>In version 6 and earlier it isn't as easy.
> 
> 
> I did not try Vim 7, but I am curious nevertheless.  Besides quoting
> matters and regexp weaknesses, I presume :grep in version 6 is just as
> easy?  In many cases, quoting is not (much of) a problem, and regexps
> are powerful enough.
> 
 From ":help grep" in version 7 help (and I'm quoting it rather than 
pointing to it, for the benefit of those who haven't installed vim 7 yet):

-----
5. Using :vimgrep and :grep				*grep* *lid*

Vim has two ways to find matches for a pattern: Internal and external.
The advantage of the internal grep is that it works on all systems and
uses the powerful Vim search patterns.  An external grep program can be
used when the Vim grep does not do what you want.

The internal method will be slower, because files are read into memory.
The advantages are:
- Line separators and encoding are automatically recognized, as if a
file is being edited.
- Uses Vim search patterns.  Multi-line patterns can be used.
- When plugins are enabled: compressed and remote files can be searched.
	|gzip| |netrw|
- When 'hidden' is set the files are kept loaded, thus repeating a
search is much faster.  Uses a lot of memory though!
-----

Best regards,
Tony.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic