On Sep 18, 2:45 pm, Gregory Margo <[email protected]> wrote:
> 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?
>
This is exactly what :grep or :lgrep does.
> Jump to the first match is _never_ what I want.
So use :grep! (with the !)
> And it's noisy.
Huh? It has no more and no less output than whatever your grepprg is
set to.
> And needs an extra step to get the list, a ":copen".
Which you could do in one shot, :grep! blah | botright copen
You could even make a cabbr or a mapping to add whatever you want to
the command for you.
http://vim.wikia.com/wiki/Find_in_files_within_Vim
> And there's only one
> quickfix list. Could use :lgrep and :lopen to get multiple location
> lists.
As you say, you can use :lgrep instead of :grep to get multiple
location lists. What's the issue?
You can also use just :grep and then use :colder and :cnewer to go
back and forth between the results of multiple searches.
> (And where does :lopen get off ignoring my setting for
> 'splitbelow'?).
Don't know, what's it doing now? I've always seen it below the current
window, where does it show up for you?
Is there a way to get the location list associated
> with a :grep without jumping to the first file?
>
: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
>
> 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.
>
Works fine for me. The location list/quickfix list both use filename|
line number|, not filename:line number so it's all right. What is it
doing for you?
There is no "quickfix mode", only a quickfix window.
>
> 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.
>
:grep does whatever your grepprg does, it just parses the results and
puts it in the quickfix list.
Basically, you made a complicated (and probably clever) script, but it
pretty much duplicates built-in functionality.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---