grep.vim vs :grep

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

grep.vim vs :grep

Maciej Kalisiak-3
I've seen mention to grep.vim a number of times now, and decided to check
it out.  Having looked at the script's description on www.vim.org I'm still
unclear: what is the difference between grep.vim and Vim's built-in ":grep"
command?  Obviously the script seems to allow for more flexibility and
tweakable options, but is that all there is?  I'm wondering if I'm missing
some "killer feature" and/or way of using it that would make it a
"compulsory install" for me... :)

--
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: grep.vim vs :grep

Denis Perelyubskiy
On Wed, 10 Aug 2005 12:40:07 -0400, "M.K." <[hidden email]> said:
> I've seen mention to grep.vim a number of times now, and decided to check
> it out.  Having looked at the script's description on www.vim.org I'm
> still
> unclear: what is the difference between grep.vim and Vim's built-in
> ":grep"

I started with grep.vim since I was under impression that grep does not
have the flexibility to pick files with which extensions to search (i am
on windows), nor a good way to prune which files i am searching (i.e.
looking in c:/projects I don't want to spend time grepping through
c:/projects/lib folder). I don't claim that I am correct in my
assumption that built-in grep does not allow such usage, but grep.vim is
at least a second plugin I've seen that combines find with grep to
achieve the desired result.

-d
--
// mailto: Denis Perelyubskiy <lists at overwhelmTAKECAPITALSOUT dot net>
// icq   : 12359698

Reply | Threaded
Open this post in threaded view
|

Re: grep.vim vs :grep

A.J.Mechelynck
----- Original Message -----
From: "Denis Perelyubskiy" <[hidden email]>
To: "Vim" <[hidden email]>
Sent: Wednesday, August 10, 2005 7:24 PM
Subject: Re: grep.vim vs :grep


> On Wed, 10 Aug 2005 12:40:07 -0400, "M.K." <[hidden email]> said:
>> I've seen mention to grep.vim a number of times now, and decided to check
>> it out.  Having looked at the script's description on www.vim.org I'm
>> still
>> unclear: what is the difference between grep.vim and Vim's built-in
>> ":grep"
>
> I started with grep.vim since I was under impression that grep does not
> have the flexibility to pick files with which extensions to search (i am
> on windows), nor a good way to prune which files i am searching (i.e.
> looking in c:/projects I don't want to spend time grepping through
> c:/projects/lib folder). I don't claim that I am correct in my
> assumption that built-in grep does not allow such usage, but grep.vim is
> at least a second plugin I've seen that combines find with grep to
> achieve the desired result.
>
> -d
> --
> // mailto: Denis Perelyubskiy <lists at overwhelmTAKECAPITALSOUT dot net>
> // icq   : 12359698

Note: Vim 7 has a new ":vimgrep" command which extends to any user-specified
set of files the search facilities available for Vim help (using
":helpgrep") since 6.1.423. It uses vim-style regexps and no external
program.

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: grep.vim vs :grep

Hari Krishna Dara
In reply to this post by Maciej Kalisiak-3

On Wed, 10 Aug 2005 at 10:24am, Denis Perelyubskiy wrote:

> On Wed, 10 Aug 2005 12:40:07 -0400, "M.K." <[hidden email]> said:
> > I've seen mention to grep.vim a number of times now, and decided to check
> > it out.  Having looked at the script's description on www.vim.org I'm
> > still
> > unclear: what is the difference between grep.vim and Vim's built-in
> > ":grep"
>
> I started with grep.vim since I was under impression that grep does not
> have the flexibility to pick files with which extensions to search (i am
> on windows), nor a good way to prune which files i am searching (i.e.
> looking in c:/projects I don't want to spend time grepping through
> c:/projects/lib folder). I don't claim that I am correct in my
> assumption that built-in grep does not allow such usage, but grep.vim is
> at least a second plugin I've seen that combines find with grep to
> achieve the desired result.
>
> -d
>

I have been using --include and --exclude options along with the -r (for
recursive) with the cygwin grep for a long time and it works pretty
well. There is no need to combine with find unless a different type of
selector is needed (such as say, the timestamp). I am assuming you have
cygwin grep already, because you have find, but if you are using a
different toolkit such as MKS, your grep might not support these
options.

--
HTH,
Hari


               
__________________________________
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html 

Reply | Threaded
Open this post in threaded view
|

Re: grep.vim vs :grep

Denis Perelyubskiy
On Wed, 10 Aug 2005 10:57:22 -0700 (PDT), "Hari Krishna Dara"
<[hidden email]> said:
[quoted message snipped]
> I have been using --include and --exclude options along with the -r (for
> recursive) with the cygwin grep for a long time and it works pretty
> well. There is no need to combine with find unless a different type of
> selector is needed (such as say, the timestamp). I am assuming you have
> cygwin grep already, because you have find, but if you are using a
> different toolkit such as MKS, your grep might not support these
> options.

Ah, interesting. I do have cygwin grep (I also tried unixutils, but
xargs there broke). I remember seeing --include/--exclude, but could not
quite tell if it worked with multiple matches (i.e. '*.c *.cpp Makefile
*.h *.H'). I quickly tried it, it did not work, so I just found the
grep.vim and got that one to work instead :)

What would the syntax for multiple matches be ?

-d
--
// mailto: Denis Perelyubskiy <lists at overwhelmTAKECAPITALSOUT dot net>
// icq   : 12359698

Reply | Threaded
Open this post in threaded view
|

Re: grep.vim vs :grep

Hari Krishna Dara
In reply to this post by Maciej Kalisiak-3

On Wed, 10 Aug 2005 at 1:14pm, Denis Perelyubskiy wrote:

> On Wed, 10 Aug 2005 10:57:22 -0700 (PDT), "Hari Krishna Dara"
> <[hidden email]> said:
> [quoted message snipped]
> > I have been using --include and --exclude options along with the -r (for
> > recursive) with the cygwin grep for a long time and it works pretty
> > well. There is no need to combine with find unless a different type of
> > selector is needed (such as say, the timestamp). I am assuming you have
> > cygwin grep already, because you have find, but if you are using a
> > different toolkit such as MKS, your grep might not support these
> > options.
>
> Ah, interesting. I do have cygwin grep (I also tried unixutils, but
> xargs there broke). I remember seeing --include/--exclude, but could not
> quite tell if it worked with multiple matches (i.e. '*.c *.cpp Makefile
> *.h *.H'). I quickly tried it, it did not work, so I just found the
> grep.vim and got that one to work instead :)
>
> What would the syntax for multiple matches be ?
>
> -d
>

You would just repeat the option multiple times: "--include *.c
--include *.cpp etc.". The man pages are not clear on this usage, and
until someone here pointed it out, I also didn't know. Unfortunately,
there is no short option equivalent, so you might want to have a cabbr
(something like --i).

HTH,
Hari

--
Thanks,
Hari


               
__________________________________
Yahoo! Mail for Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail