Tuesday, May 27, 2014

Re: grep and quickfix

On 27 May 2014, Ben Fritz <fritzophrenic@gmail.com> 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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: