vimgrep vs. lvimgrep

392 views
Skip to first unread message

Kev

unread,
Aug 13, 2007, 2:27:40 PM8/13/07
to vim...@googlegroups.com
I understand the difference between vimgrep and lvimgrep as far as the
locaion list or the quickfix list, but am unclear on reasons for using
one over the other.

I usually use vimgrep as an alternative to :g/pattern/# to find
matches if I expect to find a large number of matches that I need to
work through. Are there any benefits to using :vimgrep over :lvimgrep
or the other way around?

TIA,
Kevin

Tony Mechelynck

unread,
Aug 13, 2007, 3:09:17 PM8/13/07
to vim...@googlegroups.com

With :lvimgrep you may have several location lists at the same time (in
different windows), and do a new search without clobbering the other lists.
Thus you may go to the first/previous/next/last match in one list, and compare
it in another window with the last/next/previous/first match in another list.

I don't use it, :vimgrep is good enough for me.

The advantage of :vimgrep over :g is that it can work on many files at once,
for example

:vimgrep /\<Plantagenet\>/g ../**/*.htm


Best regards,
Tony.
--
Do what comes naturally now. Seethe and fume and throw a tantrum.

Yegappan Lakshmanan

unread,
Aug 13, 2007, 6:51:09 PM8/13/07
to vim...@googlegroups.com
On 8/13/07, Tony Mechelynck <antoine.m...@gmail.com> wrote:
>
> Kev wrote:
> > I understand the difference between vimgrep and lvimgrep as far as the
> > locaion list or the quickfix list, but am unclear on reasons for using
> > one over the other.
> >
> > I usually use vimgrep as an alternative to :g/pattern/# to find
> > matches if I expect to find a large number of matches that I need to
> > work through. Are there any benefits to using :vimgrep over :lvimgrep
> > or the other way around?
> >
> > TIA,
> > Kevin
>
> With :lvimgrep you may have several location lists at the same time (in
> different windows), and do a new search without clobbering the other lists.
> Thus you may go to the first/previous/next/last match in one list, and compare
> it in another window with the last/next/previous/first match in another list.
>

The extension of the above mentioned advantage is that if you use tabs
to display multiple files, then you can have a separate grep output
for each tab. If you use the "vimgrep" command then you have only
one global list for the grep output.

- Yegappan

Tony Mechelynck

unread,
Aug 13, 2007, 6:59:13 PM8/13/07
to vim...@googlegroups.com

s/tab/window/g

see ":help location-list"


Best regards,
Tony.
--
A parent can be arrested if his child cannot hold back a burp during a church
service.
[real standing law in Nebraska, United States of America]

Reply all
Reply to author
Forward
0 new messages