Skip to content

Commit

Permalink
fix(tmux): Remove redundant -t flag
Browse files Browse the repository at this point in the history
  • Loading branch information
detroyejr committed Mar 12, 2024
1 parent fe69772 commit 9a70905
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions plugins/tmux/tmux.plugin.zsh
Expand Up @@ -72,19 +72,17 @@ _tmux-attach-session() {

if [[ $words[1] =~ ta ]]; then
_arguments -s \
'1:sessions' \
'1:session' \
'-c+[specify working directory for the session]:directory:_directories' \
'-d[detach other clients attached to target session]' \
'-f+[set client flags]: :_tmux_client_flags' \
'-r[put the client into read-only mode]' \
'-t+[specify target session]:target session: __tmux-sessions-separately' \
"-E[don't apply update-environment option]" \
'-x[with -d, send SIGHUP to the parent of the attached client]'
elif [[ $words[1] = "tkss" ]]; then
_arguments -s \
'1:sessions' \
'1:session' \
'-a[kill all session except the one specified by -t]' \
'-t+[specify target session]:session:__tmux-sessions' \
'-C[clear alerts (bell, activity, silence) in all windows linked to the session]'
fi

Expand All @@ -96,24 +94,6 @@ _tmux_client_flags() {
'pause-after:time (seconds)' read-only wait-exit
}

__tmux-sessions-separately() {
local ret=1
local -a sessions detached_sessions attached_sessions
sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
detached_sessions=( ${sessions:#*"(attached)"} )
attached_sessions=( ${(M)sessions:#*"(attached)"} )

# ### This seems to work without a _tags loop but not with it. I suspect
# ### that has something to do with _describe doing its own _tags loop.
_tags detached-sessions attached-sessions
# Placing detached before attached means the default behaviour of this
# function better suits its only current caller, _tmux-attach-session().
_requested detached-sessions && _describe -t detached-sessions 'detached session' detached_sessions "$@" && ret=0
_requested attached-sessions && _describe -t attached-sessions 'attached session' attached_sessions "$@" && ret=0

return ret
}

alias tksv='tmux kill-server'
alias tl='tmux list-sessions'
alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
Expand Down

0 comments on commit 9a70905

Please sign in to comment.