On 2009-09-18, Gregory Margo wrote:
> On Fri, Sep 18, 2009 at 11:29:48PM +0800, Steven Woody wrote:
> > I feel happy with ctags except one thing:  while I can jump to a
> > function/variable definition, I can not however get  a list for all the
> > references to the function/variable?  How vim gurus do it?
> 
> 
> I tend to use a big blunt instrument: grep.  It works on any
> language, not the limited few that cscope/id-utils/global support.
> And it works on any string, not just functions/variables.
> 
> Here are two scripts/mappings from my .vimrc that I use all the time.
> The "_lg" mapping creates a new buffer with the matches, and
> the "_le" mapping opens the appropriate file from a given match.

Are you aware of vim's built-in :grep command?

    :help :grep

For jumping to particular lines in files from a <file name>:<line
number> pair in a buffer there are:

    :help CTRL-W_F
    :help gF

> It is limited to grepping from the current directory downward, but I
> generally always work from the top level of a project.

To have grep search recursively through a directory hierarchy, just
use the -r or -R option.  Then you can easily specify the top-level
directory and whether or not you want to search recursively.  The
--include and --exclude options can also help narrow your search if
your directories contain a mix of file types.

HTH,
Gary



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to