Make tmux window named after cwd
This commit is contained in:
+15
-5
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user