From 1e1802eaa9b76109dd2f535e3438b8dd140b0411 Mon Sep 17 00:00:00 2001 From: Avindra Goolcharan Date: Fri, 5 Jul 2024 16:03:53 -0400 Subject: [PATCH] sh/fish: add d, d. and d.. shortcuts --- src/hook.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/hook.go b/src/hook.go index 82d6acb..937d0b8 100644 --- a/src/hook.go +++ b/src/hook.go @@ -33,13 +33,20 @@ dir () { $_DIRP_CD "$stdout" fi } - - export -f dir >/dev/null 2>&1`) + + export -f dir >/dev/null 2>&1 + + alias d=dir + alias d.="dir ." + alias d..="dir .." + `) } // PrintFishHook emits shell code for Fish func PrintFishHook() { - fmt.Println(`function dir + fmt.Println(` + + function dir set stdout (dirp $argv) if [ $status = 2 ] $EDITOR "$stdout" @@ -54,7 +61,13 @@ func PrintFishHook() { echo "Switching to $stdout" pushd "$stdout" - end`) + end + + abbr -a -g d dir + abbr -a -g d. dir . + abbr -a -g d.. dir .. + + `) } // PrintRcHook emits code for rc, the plan 9 shell