Jerin Joy wrote:
Hi,

I have a lot of source code distributed over a directory hierarchy
structure. I always need to find class declarations, instances where
variables are set etc. Usually I just go to command line and run
something like
find . -name "*.vr" -print | xargs grep 'class foo'

Isn't there an easier way to do this in vim? I can't use cscope since
the source is not in C.

Jerin



        :vimgrep /\<class\_s\+foo\>/ *.vr

which applies to Vim 7 only; in earlier versions of Vim you can use external grep though. The pattern between slashes is a Vim regular expression; I have arbitrarily put in \< (start of word), \> (end of word) and \_s\+ (one or more spaces, tabs and/or line breaks).

The results of vimgrep (or grep) end up in a quickfix "error list" and can be viewed using :cfirst, :cnext, :cprev, :clast, etc.

See
        :help quickfix.txt
and in particular
        :help :vimgrep
        :help :grep
        :help :cnext
etc.


Best regards,
Tony.

Reply via email to