On 2013-05-08, Erik Christiansen wrote: > If you always have a spare xterm or two open, then it is quick to bring > one to the foreground, whack in a quick egrep invocation, and pipe > its output to "more", or redirect it to a file, e.g: > > egrep -n 'line *number' /usr/local/src/vim73/runtime/doc/* > /tmp/vim > > Here I had become impatient with "helpgrep" in vim taking too long to > step (via successive :cnext) to what I was hoping to find. That egrep > invocation put all matches into /tmp/vim, which I opened with vim, then > did a "gf" (go file) on the filename preceding the matching text on the > most promising line I could see. If no good, Ctrl-^ whips us back to > the egrep-generated file index, and we "gf" on the next likely > candidate. Pretty much any text in the filesystem succumbs rather > quickly to such searching.)
You might find this script, which I've named vimgrep, useful. #!/bin/bash tmp=$(mktemp) cat > $tmp exec < /dev/tty vim --cmd 'let &efm=&gfm' -q $tmp "$@" rm $tmp It's invoked like this: grep -Hn <whatever other options and files you want> | vimgrep All the lines that grep finds will be fed to vim as a quickfix list, which you can traverse with :cn, :cp, etc., or browse with :copen. I have mapped <C-N> to :cn and <C-P> to :cp so that I can traverse the quickfix list more easily. Regards, Gary