Peng Yu wrote:
On 2/22/07, Jean-Rene David <[EMAIL PROTECTED]> wrote:
* Peng Yu [2007.02.22 11:15]:
> I have a C++ project in some dir say "project"
> or its subdir. Although I can use find and grep
> outside vim to search for any word in "project".
> But this is not very convenient.

Well you can use an external grep from within vim.
One advantage is that it's relatively fast and you
can use the quickfix window. An inconvenient is
that you can't use vim regex.

:h grep
:h grepprg

If you have vim 7, then you can use vimgrep.

:h vimgrep

If your project is large, you could also use an
indexing program like "glimpse". See

http://www.vim.org/tips/tip.php?tip_id=1021

Hi,

I read the help. But I still don't see how to search in all the *.h
and *.cc in a certain directory. Do I have to rely on the external
command "find"?

Thanks,
Peng


To search for the word "word" (without quotes, but as an integral word) using Vim 7:

(a) in all *.c, *.cpp and *.h files in the current directory but not below:

        :vimgrep /\<word\>/g *.cpp *.[ch]

(b) the same, but recurse into subdirectories:

        :vimgrep /\<word\>/g ./**/*.cpp ./**/*.[ch]

If *.[ch] doesn't work on your system, replace it by *.c *.h


Best regards,
Tony.
--
Be assured that a walk through the ocean of most Souls would scarcely
get your Feet wet.  Fall not in Love, therefore: it will stick to your
face.
                -- National Lampoon, "Deteriorata"

Reply via email to