tags:

views:

117

answers:

1

A common programming task for me in vim is:

:s/some pattern/ do some work n # finds the next entry do some work n # finds the next entry ...

Now, s/.... only searches in the current file.

Is there a way I can do this, but search across a directory of files? Say do "s/..../" over all files in subdirectoires of pwd that ends in *.hpp of *.cpp ?

Thanks!

+3  A: 

You can simply use the :grep command: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:grep or for a more complete integration of search tools, use the grep.vim extension http://www.vim.org/scripts/script.php?script_id=311

Simply type ":help grep" to get a nice documentation of what is available out of the box in vim Using :grep foo *.?pp should do what you want. This will open a Quick Fix list, just like the one you get using :make, enabling to jump to the found occurrences.

tonio