From 15c41e001a8b5510cc6ac36141c5e4b48d21f498 Mon Sep 17 00:00:00 2001 From: detroyejr Date: Wed, 21 Feb 2024 15:26:06 -0500 Subject: [PATCH] fix(tmux): Replace aliases that use empty flags with functions. --- plugins/tmux/tmux.plugin.zsh | 37 ++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 72cdd4818..eaf83f96f 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -37,14 +37,43 @@ 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' alias tksv='tmux kill-server' -alias tkss='tmux kill-session -t' alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG' +function ts() { + if [[ $@ == -* ]]; then + tmux new-session $@ + else + tmux new-session ${@:+-s}$@ + fi +} + +function tkss() { + if [[ $@ == -* ]]; then + tmux kill-session $@ + else + tmux kill-session ${@:+-t}$@ + fi +} + +function ta() { + if [[ $@ == -* ]]; then + tmux attach-session $@ + else + tmux attach-session ${@:+-t}$@ + + fi +} + +function tad() { + if [[ $@ == -* ]]; then + tmux attach-session -d $@ + else + tmux attach-session -d ${@:+-t}$@ + fi +} + # Determine if the terminal supports 256 colors if [[ $terminfo[colors] == 256 ]]; then export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR