From d56a7784d29f61ba7e1b411230522e70f7ae59a0 Mon Sep 17 00:00:00 2001 From: Fintan Date: Mon, 8 Oct 2018 16:50:52 -0400 Subject: [PATCH] Add line number capability to vg() function as additional option. --- Examples.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Examples.md b/Examples.md index d7088e4..834b151 100644 --- a/Examples.md +++ b/Examples.md @@ -103,6 +103,19 @@ vg() { vim $file fi } + +# fuzzy grep open via ag with line number +vg() { + local file + local line + + read -r file line <<<"$(ag --nobreak --noheading $@ | fzf -0 -1 | awk -F: '{print $1, $2}')" + + if [[ -n $file ]] + then + vim $file +$line + fi +} ``` ### Changing directory