To my .vimrc
I added a hook which automates entering the quickfix after :grep
processing:
autocmd QuickFixCmdPost [^l]* nested cwindow 20
Another thing I care about but can't achieve is automation of applying highlight/color of all found occurrences while being in the quickfix. What I observed, it's really easy to do manually:
/pattern
by re-typing the same pattern which went to the :grep
we will get all occurrences highlighted in all of the files referenced by the quickfix.
Is it possible to program it so that vim will know the grep
's matches (or at least the pattern passed) and automatically perform the /pattern
search command after :cwindow
is executed - or perform any other method to apply that highlight?
UPDATE
Assuming we can deliver a custom command for :grep
in .vimrc
, like:
command! -nargs=+ G execute "grep -rIn <args> ."
now the pattern itself is provided by the means of a custom command which might be helpful(?).
I admit I'm not a good vim programmer. Can it all be somehow chained together (as another autocmd
/function
and preserving the effect of cwindow
hook) to get that highlight to be applied?