diff options
Diffstat (limited to 'config/essentials/shell/functions.sh')
-rw-r--r-- | config/essentials/shell/functions.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index cf10365..2a21655 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -348,3 +348,10 @@ prj () { [ -d "$d" ] || exit 1 cd "$pfx"/"$d" } + +edit_git_file () { + GIT_WORK_TREE="$1" GIT_DIR="$1"/.git git rev-parse --show-toplevel > /dev/null 2>&1 || return 1 + f="$(GIT_WORK_TREE="$1" GIT_DIR="$1"/.git git ls-files | fzf)" + [ "$f" ] || return 2 + $EDITOR "$1"/"$f" +} |