Make tmux window named after cwd

This commit is contained in:
David Heinemeier Hansson
2026-03-05 11:50:32 -04:00
parent 7e69c87f75
commit 2efc43762a
+15 -5
View File
@@ -12,12 +12,22 @@ alias eff='$EDITOR "$(ff)"'
if command -v zoxide &> /dev/null; then if command -v zoxide &> /dev/null; then
alias cd="zd" alias cd="zd"
zd() { zd() {
if [ $# -eq 0 ]; then if (( $# == 0 )); then
builtin cd ~ && return builtin cd ~ || return
elif [ -d "$1" ]; then elif [[ -d $1 ]]; then
builtin cd "$1" builtin cd "$1" || return
else else
z "$@" && printf "\U000F17A9 " && pwd || echo "Error: Directory not found" if ! z "$@"; then
echo "Error: Directory not found"
return 1
fi
printf "\U000F17A9 "
pwd
fi
if [[ -n $TMUX ]]; then
tmux rename-window "$(basename "$PWD")"
fi fi
} }
fi fi