Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 1/2] _tmux: Complete option names for show-options and show-window-options.
- X-seq: zsh-workers 41558
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 1/2] _tmux: Complete option names for show-options and show-window-options.
- Date: Thu, 17 Aug 2017 04:19:10 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=JNHIHY 6mVHfyhz091lZFpSHBAfUBUGPjSMCjpv+VWck=; b=NmwDcStk1MIDFjOnsWzW8L 49wgiOPr4biTmjrumPs0hhrOjf6M8TkpretP6YiFey6EUd5tqa4QkEba4VbafZmg aWMxMgpwVOjQNNaQDtPP+Nn8a2g/wqM9cMeBiuDiTyz2DnT4+7nH0M4nm/uUHnWK Ki5Us5AoWX2HZ2LUpoWu3jZapNOEpvepeku6zSdx+U3Si7bz1v7/ATz0YoU8/FXD 5tcFqOh2iLMbmqE5lKwdHtV8SpB70c42lmYu9lf2G9kRvFDXqYSh1JJo7m7BGY8r v2ltiZ/zEL+STWIJafM2jBAv7cZwUCvFOZwU5RgjxeCP9tW6zNVwdPlaWXGiiVWQ ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=JNHIHY 6mVHfyhz091lZFpSHBAfUBUGPjSMCjpv+VWck=; b=g2vOyjdSwmywcQ+IeXewPI 8EP5Lv/tSSS5/Bi/rlWuJL3Rbr1U1VzSSldEJh5dhQ5EDotAWq2GBHhQG1cBjBV9 3mGj0FYgPN1FFfWq3c+1Z8Pfy33v0GhA1JPVw30CvgnrzqrbPj31JTUUYHym71ZA IN1/tGGLvuXDON1rQsWVcPlVRINUZcw2RJmiOf7zBxT3F+rggqABNj2nhdsfX++f WOaUC4v02fz67AJYsi1ACsX4tkSrtlzwlyIBn2YD4NwEESi7UOC+pdK3BD2AK/OS xybhH8yylUNPgdzKCs5bPpQ1saC1f8XWBAfuUqeZcrCaL0nAsoOGG4aCQYHG192w ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
---
Completion/Unix/Command/_tmux | 29 +++++++++++++++++++++++------
1 file 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() {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author