diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 09e326344..436e2671d 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -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