commit e76680f2b381f20defb34de091456a74c0f88500
parent c31c38afabbc72f0643668a47f7719cd2041d6ec
Author: William Casarin <jb55@jb55.com>
Date: Sat, 10 Jul 2021 09:21:48 -0700
jump tag cmd
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/bin/fuzz-jump-tag b/bin/fuzz-jump-tag
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+set -eou pipefail
+
+TAGS=tags
+
+if [ ! -f tags ]; then
+ TAGS="$(git rev-parse --show-toplevel)/tags"
+
+ if [ ! -f "$TAGS" ]; then
+ printf "no tags found\n" >&2
+ exit 1
+ fi
+fi
+
+cutt() {
+ cut -d $'\t' --output-delimiter=$'\t' "$@"
+}
+
+res=$(grep -v '^!_TAG' "$TAGS" | fzf)
+file=$(<<<"$res" cutt -f2)
+search=$(<<<"$res" cutt -f3- | sed -E -n 's,^([^"]+).*,\1,p')
+
+printf "vim '%s' -c %q -c :noh\n" "$file" "$search"
diff --git a/dotfiles/commands b/dotfiles/commands
@@ -16,6 +16,7 @@ enc edit neomutt config echo edit ~/.config/neomutt/neomuttrc
es email status echo email-status-once
evc edit nvim config echo edit ~/.config/nvim/init.vim
ff create file echo fuzz-create-file
+jt jump tag fuzz-jump-tag
gb git branches echo git bvr
ghi github issues fuzz-gh-issue-list
ghp github prf fuzz-gh-pr-list