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}
# ALIASES
alias ta='tmux attach -t'
alias tad='tmux attach -d -t'
alias ts='tmux new-session -s'
alias tl='tmux list-sessions'
function _build_tmux_alias {
eval "function $1 {
if [[ -z \$1 ]] || [[ \${1::1} == '-' ]]; then
tmux $2 \"\$@\"
else
tmux $2 $3 \"\$@\"
fi
}"
}
alias tksv='tmux kill-server'
alias tkss='tmux kill-session -t'
alias tl='tmux list-sessions'
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
if [[ $terminfo[colors] == 256 ]]; then
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR