g: open file at matching line §

A tiny but incredibly useful script.

Run ''g <what-you-look-for>'', select the file with pick (or fzy, choice, fzf...) : it is opened in vi editor at the searched line.

https://github.com/mptre/pick

#!/bin/sh

test -n "$*" && eval "$(grep -nIRs "$*" |\
        pick |\
        awk -F ':' '{ printf("vi +%s %s", $2, $1) } ')"