This commit is contained in:
parent
c449dfcb5f
commit
559939e2f4
49 changed files with 729 additions and 252 deletions
26
.local/share/completions/_ta
Normal file
26
.local/share/completions/_ta
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#compdef ta
|
||||
|
||||
# from builtin _tmux
|
||||
function __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
|
||||
}
|
||||
|
||||
_ta() {
|
||||
_arguments '*:: : __tmux-sessions-separately'
|
||||
}
|
||||
|
||||
_ta "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue