Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH 1/2] _tmux: Complete only attached sessions for detach-session.



---
 Completion/Unix/Command/_tmux | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 7999be3eb..48fe29aee 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -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}"



Messages sorted by: Reverse Date, Date, Thread, Author