vim: grep/vimgrep on quickfix window and error:E499

283 Views Asked by At

I want to search and list patterns in a file, so I can use vimgrep pattern % Now this will create a quickfix window, if we type :cw or :cwindow it opens the search results.

Now I want to grep or vimgrep on this quickfix window, to filter further.

eg: filename: tmp

IRQ test A - pass    
REG_WR test A - pass
REG_RD A:0 pass    
REG_RD A:1 fail    
REG_RD A:2 pass    
REG_RD test A - fail    
IRQ test B - pass    
REG_WR test B - pass  

REG_RD B:0 pass    
REG_RD B:1 pass    
REG_RD B:2 pass    
REG_RD test B - pass

Now first I use vimgrep test % to get the below in quickfix window.

tmp|1 col 9| IRQ test A - pass    
tmp|2 col 12| REG_WR test A - pass
tmp|6 col 12| REG_RD test A - fail    
tmp|7 col 9| IRQ test B - pass    
tmp|8 col 12| REG_WR test B - pass  
tmp|13 col 12| REG_RD test B - pass

Now immediately i want to search for all passed tests.

If give :vimgrep pass % on quickfix window, it states that,

e499:empty filename for '%' or '#', only works with ":p:h"

I'm now saving this results to temporary file and then grepping over it, Is there a easy solution?

My Gvim: IM - Vi IMproved 7.2 (2008 Aug 9, compiled Jun 6 2019 12:19:18)

1

There are 1 best solutions below

3
On

I have found the Cfilter command to be of great use:

" load this plugin that ships with vim in a package
packadd cfilter
vimgrep ...
Cfilter pass