fix(tmux): do not pass empty flags to aliases (#12232)

This enables compatibility with tmux >3.3a

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
Jonathan De Troye 2024-02-29 13:05:54 -05:00 committed by GitHub
parent 6a65ac9025
commit 65b23a3328
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,14 +47,27 @@ fi
: ${ZSH_TMUX_UNICODE:=false} : ${ZSH_TMUX_UNICODE:=false}
# ALIASES # ALIASES
alias ta='tmux attach -t' function _build_tmux_alias {
alias tad='tmux attach -d -t' eval "function $1 {
alias ts='tmux new-session -s' if [[ -z \$1 ]] || [[ \${1::1} == '-' ]]; then
alias tl='tmux list-sessions' tmux $2 \"\$@\"
else
tmux $2 $3 \"\$@\"
fi
}"
}
alias tksv='tmux kill-server' alias tksv='tmux kill-server'
alias tkss='tmux kill-session -t' alias tl='tmux list-sessions'
alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG' alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
_build_tmux_alias "ta" "attach" "-t"
_build_tmux_alias "tad" "attach -d" "-t"
_build_tmux_alias "ts" "new-session" "-s"
_build_tmux_alias "tkss" "kill-session" "-t"
unfunction _build_tmux_alias
# Determine if the terminal supports 256 colors # Determine if the terminal supports 256 colors
if [[ $terminfo[colors] == 256 ]]; then if [[ $terminfo[colors] == 256 ]]; then
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR