about summary refs log tree commit diff
path: root/Completion/Unix/Command/_tmux
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2017-08-17 04:19:10 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2017-08-30 00:12:02 +0000
commit383dc2a6f5d8ad0713311a3dc358cdc71a2dcf03 (patch)
treeca034ecf10b301b4c41349f800f1b60bf7d64f6d /Completion/Unix/Command/_tmux
parent7d1877da4e6fabde8f0b5eb2f9a9f03d83e6c28d (diff)
downloadzsh-383dc2a6f5d8ad0713311a3dc358cdc71a2dcf03.tar.gz
zsh-383dc2a6f5d8ad0713311a3dc358cdc71a2dcf03.tar.xz
zsh-383dc2a6f5d8ad0713311a3dc358cdc71a2dcf03.zip
41558: _tmux: Complete option names for show-options and show-window-options.
Diffstat (limited to 'Completion/Unix/Command/_tmux')
-rw-r--r--Completion/Unix/Command/_tmux29
1 files changed, 23 insertions, 6 deletions
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 7ef20c666..9339d6556 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -745,7 +745,7 @@ _tmux-set-option() {
   local mode=session
   local curcontext="$curcontext" state line ret=1
   typeset -A opt_args
-  _arguments -C -s \
+  _arguments -C -s : \
     '-a[append to string options]' \
     '-g[set a global session option]' \
     '-o[prevent setting of an option that is already set]' \
@@ -769,7 +769,7 @@ _tmux-set-window-option() {
   [[ -n ${tmux_describe} ]] && print "set a window option" && return
   local curcontext="$curcontext" state line ret=1
   typeset -A opt_args
-  _arguments -C -s \
+  _arguments -C -s : \
     '-a[append to string options]' \
     '-g[set a global window option]' \
     '-o[prevent setting of an option that is already set]' \
@@ -820,21 +820,38 @@ _tmux-show-messages() {
 
 _tmux-show-options() {
   [[ -n ${tmux_describe} ]] && print "show session options" && return
-  _arguments -s \
+  local mode=session
+  local curcontext="$curcontext" state line ret=1
+  typeset -A opt_args
+  _arguments -C -s : \
     '-g[show global options]' \
     '-q[suppress errors about unknown or ambiguous options]' \
     '-s[show server options]' \
     '-v[show only the option value, not the name]' \
     '-w[show window options]' \
-    '-t+[specify target session]:target session:__tmux-sessions'
+    '-t+[specify target session]:target session:__tmux-sessions' \
+    '*:: :->name_or_value' && ret=0
+
+  if (( ${+opt_args[-w]} )); then
+    mode=window
+  elif (( ${+opt_args[-s]} )); then
+    mode=server
+  fi
+  __tmux-options-complete ${mode} ${state} && ret=0
+  return ret
 }
 
 _tmux-show-window-options() {
   [[ -n ${tmux_describe} ]] && print "show window options" && return
-  _arguments -s \
+  local curcontext="$curcontext" state line ret=1
+  typeset -A opt_args
+  _arguments -C -s : \
     '-g[show global options]' \
     '-v[show only the option value, not the name]' \
-    '-t+[specify target window]:target window:__tmux-windows'
+    '-t+[specify target window]:target window:__tmux-windows' \
+    '*:: :->name_or_value' && ret=0
+  __tmux-options-complete window ${state} && ret=0
+  return ret
 }
 
 _tmux-source-file() {