I want to use Tim Pope's Vim plugin Fugitive's :Ggrep [regex]
command to search my codebase, but I would like to open the first match in a new split. How can I do this?
Split before you Ggrep
! Either use :split
or <c-w>s
and then grep (:grep
/:vimgrep
/:Ggrep
/:Ack
/etc).
:sp|Ggrep foo
and/or
<c-w>s:Ggrep foo
quickfix
listGrep command typically update the quickfix
list so it is often handy to have good mappings to :cnext
and :cprev
. I use ]q
and [q
respectively which are provided by Tim Pope's unimpaired plugin, along with many other helpful mappings. :copen
will open quickfix
window if you need to look at the results as a whole.
:h :sp
:h ctrl-w_s
:h :Ggrep
:h quickfix
:h :cnext
:h :cope