grep and quickfix

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

grep and quickfix

Mark Volkmann-2
When I run this:
:grep some-word **/*.js
it outputs lots of matches.
Then I run this:
:copen
and there is nothing in the quickfix list.
Isn't the grep command supposed to populate that?
Any ideas what I might be doing wrong?
I have not modified the grepprg or grepformat options.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: grep and quickfix

Jean-Rene David-4
* Mark Volkmann [2014.05.25 20:44]:
> When I run this:
> :grep some-word **/*.js
> it outputs lots of matches.
> Then I run this:
> :copen
> and there is nothing in the quickfix list.
> Isn't the grep command supposed to populate that?
> Any ideas what I might be doing wrong?
> I have not modified the grepprg or grepformat options.

The most likely error is that grepformat doesn't
match the output that you get. But you're not
giving us much to go on.

Can you perhaps show us what one line of output
looks like?

And while you're at it, can you show us the values
of grepprg and grepformat, just to be sure?

--
JR

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: grep and quickfix

Tony Mechelynck
On 26/05/14 03:18, Jean-Rene David wrote:

> * Mark Volkmann [2014.05.25 20:44]:
>> When I run this:
>> :grep some-word **/*.js
>> it outputs lots of matches.
>> Then I run this:
>> :copen
>> and there is nothing in the quickfix list.
>> Isn't the grep command supposed to populate that?
>> Any ideas what I might be doing wrong?
>> I have not modified the grepprg or grepformat options.
>
> The most likely error is that grepformat doesn't
> match the output that you get. But you're not
> giving us much to go on.
>
> Can you perhaps show us what one line of output
> looks like?
>
> And while you're at it, can you show us the values
> of grepprg and grepformat, just to be sure?
>

Or you might try using :vimgrep (q.v.) instead of :grep, unless your
*.js files are too big for Vim's memory space.

Best regards,
Tony.
--
Some people live life in the fast lane.  You're in oncoming traffic.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: grep and quickfix

Mark Volkmann-2
In reply to this post by Mark Volkmann-2
The issue is a conflict is between grep and jshint.vim. When I search for .js files that contain a given string, it finds them, then runs jshint on the first file. It finds no issues in the file, but that replaces the quickfix list that had been populated with search results with an empty list of jshint warnings. Any idea how I can make those two coexist?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: grep and quickfix

Mark Volkmann-2
On Monday, May 26, 2014 5:28:11 PM UTC-5, Mark Volkmann wrote:
> The issue is a conflict is between grep and jshint.vim. When I search for .js files that contain a given string, it finds them, then runs jshint on the first file. It finds no issues in the file, but that replaces the quickfix list that had been populated with search results with an empty list of jshint warnings. Any idea how I can make those two coexist?

Looks like the key is to use
:colder
to get to the previous quickfix list created by grep.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: grep and quickfix

Benjamin Fritz
On Monday, May 26, 2014 6:47:53 PM UTC-5, Mark Volkmann wrote:
> On Monday, May 26, 2014 5:28:11 PM UTC-5, Mark Volkmann wrote:
> > The issue is a conflict is between grep and jshint.vim. When I search for .js files that contain a given string, it finds them, then runs jshint on the first file. It finds no issues in the file, but that replaces the quickfix list that had been populated with search results with an empty list of jshint warnings. Any idea how I can make those two coexist?
>
> Looks like the key is to use
> :colder
> to get to the previous quickfix list created by grep.

Ah, so you have a plugin that runs when you open the first file, overriding your quickfix list.

I have two suggestions then:

1. Use :grep! instead of :grep to avoid opening the first match automatically.
2. Use ':noautocmd grep' to avoid running any plugins when the file is opened. Note this will prevent the filetype/syntax rules from loading as well, so it's probably better to use the first suggestion.

I mainly suggest method (2) because it can be very useful with :vimgrep, especially using the ! variant :vimgrep!. It often speeds up your search. See http://vim.wikia.com/wiki/Find_in_files_within_Vim

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: grep and quickfix

LCD 47
On 27 May 2014, Ben Fritz <[hidden email]> wrote:

> On Monday, May 26, 2014 6:47:53 PM UTC-5, Mark Volkmann wrote:
> > On Monday, May 26, 2014 5:28:11 PM UTC-5, Mark Volkmann wrote:
> > > The issue is a conflict is between grep and jshint.vim. When I
> > > search for .js files that contain a given string, it finds them,
> > > then runs jshint on the first file. It finds no issues in the
> > > file, but that replaces the quickfix list that had been populated
> > > with search results with an empty list of jshint warnings. Any
> > > idea how I can make those two coexist?
> >
> > Looks like the key is to use
> > :colder
> > to get to the previous quickfix list created by grep.
>
> Ah, so you have a plugin that runs when you open the first file,
> overriding your quickfix list.
>
> I have two suggestions then:
>
> 1. Use :grep! instead of :grep to avoid opening the first match
> automatically.
> 2. Use ':noautocmd grep' to avoid running any plugins when the file is
> opened. Note this will prevent the filetype/syntax rules from loading
> as well, so it's probably better to use the first suggestion.
>
> I mainly suggest method (2) because it can be very useful with
> :vimgrep, especially using the ! variant :vimgrep!. It often speeds up
> your search. See http://vim.wikia.com/wiki/Find_in_files_within_Vim

    Alternatively:

3.  Use :lgrep / :lvimgrep instead of :grep / :vimgrep, to put search
    results in a loclist, rather than in the quickfix list.

3'. Use something like syntastic to run jshint checks, which
    automatically puts check results in a loclist.

    I personally prefer syntastic combined with Ack, which is a frontend
to ack, which in turn is a (much) better grep:

        http://beyondgrep.com/

    /lcd

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.