Wednesday, June 23, 2010

Re: grepping a string from a large code base

On Tue, Jun 22, 2010 at 07:27:42PM -0700, Jim Green wrote:
> Hi vim community,
> I need to constantly perform a grepping of a string(eg, sth in logs)
> from a large code base, now I use grep on the command line to do this.
> I just started using ctags but it can not do the grepping of arbitrary
> string for me.
>
> could any vim users point me to a popular tool that I can use to
> improve my efficiency, I use only vim to browse and write code so I
> hope this is not off topic here.
>
> Thank you,
> Jim

I've been using ack (http://betterthangrep.com) which is a clever
little Perl program that smartly navigates your source tree and avoids
version control files (eg. .git, .svn, CVS, etc.). I highly recommend
it.

After you install it to your $PATH, add a line like this to your
ftplugin/cpp.vim to integrate it:

setlocal grepprg=ack\ --no-heading\ --smart-case\ -H\ --cpp

--
Erik Falor
Registered Linux User #445632 http://counter.li.org

No comments: