1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

41566: _tmux: Complete only attached sessions for detach-session.

This commit is contained in:
Daniel Shahaf 2017-08-18 04:23:44 +00:00
parent eb6c012f64
commit 1e44c649a4
2 changed files with 11 additions and 1 deletions

View file

@ -1,5 +1,8 @@
2017-08-30 Daniel Shahaf <d.s@daniel.shahaf.name>
* 41566: Completion/Unix/Command/_tmux: Complete only attached
sessions for detach-session.
* 41564: Completion/Unix/Command/_tmux: Complete environment
variables and their values for set-environment and
show-environment.

View file

@ -302,7 +302,7 @@ _tmux-detach-client() {
_arguments -s \
'-a[kill all clients except for the named by -t]' \
'-P[send SIGHUP to parent process]' \
'-s+[specify target session and kill its clients]:session:__tmux-sessions' \
'-s+[specify target session and kill its clients]:session:__tmux-sessions-attached' \
'-t+[specify target client]:client:__tmux-clients'
}
@ -1366,6 +1366,13 @@ function __tmux-sessions() {
_describe -t sessions 'sessions' sessions "$@"
}
function __tmux-sessions-attached() {
local -a sessions
sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
sessions=( ${(M)sessions:#*"(attached)"} )
_describe -t sessions 'attached sessions' sessions "$@"
}
function __tmux-socket-name() {
local expl sdir
local curcontext="${curcontext}"