On Fri, Sep 18, 2009 at 09:45:14AM -0700, Gary Johnson wrote:
> Are you aware of vim's built-in :grep command?
>     :help :grep

Yes, but it is unsuitable.  The goal of my script is to create a buffer
with a location list in it.  How does :grep do that?

Jump to the first match is _never_ what I want.  And it's noisy.  And
needs an extra step to get the list, a ":copen".  And there's only one
quickfix list.  Could use :lgrep and :lopen to get multiple location
lists.  (And where does :lopen get off ignoring my setting for
'splitbelow'?)  Is there a way to get the location list associated
with a :grep without jumping to the first file?

> 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

Which does not work work if 'isfname' contains a colon.
I'm mostly working with perl, and ftplugin/perl.vim adds a colon to
'isfname', so this breaks gF.  Yes I could undo it, but there are
reasons to keep it.

And gF does not seem to work right on a location list generated with
:lopen.  I'm not sure what it's doing.  Some kind of quickfix mode -
also something I never want.

> > 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.

The shell does what I want: sorting, ignoring dot directories like .svn
or .git, and ordering by hierarchy depth.  "grep -R" does not even sort.

gm
-- 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Gregory H. Margo
gmargo at yahoo/com, gmail/com, pacbell/net; greg at margofamily/org


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

Reply via email to