Skip to content

Commit

Permalink
sh/fish: add d, d. and d.. shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
avindra committed Jul 5, 2024
1 parent 017704f commit 1e1802e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit 1e1802e

Please sign in to comment.