search in files

2006-10-31 Thread bolow

hi all,
 I have a question:how to search a keyword in all files in a current
dir(include the sub dirs) by vim? thanks for your reply:)


Re: search in files

2006-10-31 Thread Wolfgang Schmidt

bolow wrote:

hi all,
 I have a question:how to search a keyword in all files in a current
dir(include the sub dirs) by vim? thanks for your reply:)

   Hi,

what you're looking for is grep/vimgrep, I think.

grep uses an external grep command, vimgrep is a built-in functionality 
of vim.


To search the current directory for all files containing String aString:

:vimgrep /aString/ *

To do the same search including sub dirs:

:vimgrep /aString/ **/*

This uses the ** (starstart)-wildcard to match subdirectories.

For more information try
:help grep
:help vimgrep
:help starstar


Kind regards
   Wolfgang