open_all {pattern} {extension}
#!/bin/zsh
grep -n $1 **/*$2 | sed 's/^([a-zA-Z_/.]*):([0-9]*).*$/2 1/' | while read line file
do
mvim --remote-tab-silent +$line $file
done
Usage:
# find all occurrences of "def" as a whole word and open the files in separate tabs:
open_all '' .rb