* [PATCH 1/2] _tmux: Complete option names for show-options and show-window-options.
@ 2017-08-17 4:19 Daniel Shahaf
2017-08-17 4:19 ` [PATCH 2/2] _tmux: show-environment, set-environment: Make -g,-t mutually exclusive Daniel Shahaf
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Shahaf @ 2017-08-17 4:19 UTC (permalink / raw)
To: zsh-workers
---
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() {
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] _tmux: show-environment, set-environment: Make -g,-t mutually exclusive.
2017-08-17 4:19 [PATCH 1/2] _tmux: Complete option names for show-options and show-window-options Daniel Shahaf
@ 2017-08-17 4:19 ` Daniel Shahaf
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2017-08-17 4:19 UTC (permalink / raw)
To: zsh-workers
tmux does not error out on the combination, but it does ignore one of
the two when both are specified.
---
Completion/Unix/Command/_tmux | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 9339d6556..0f142bb0e 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -733,10 +733,10 @@ _tmux-set-buffer() {
_tmux-set-environment() {
[[ -n ${tmux_describe} ]] && print "(un)set an environment variable" && return
_arguments -s -A "-*" -S \
- '-g[modify global environment]' \
+ '(-t)-g[modify global environment]' \
'-r[remove variable before starting new processes]' \
'-u[unset a variable]' \
- '-t[specify target session]:target session:__tmux-sessions' \
+ '(-g)-t[specify target session]:target session:__tmux-sessions' \
':name' ':value'
}
@@ -805,9 +805,9 @@ _tmux-show-buffer() {
_tmux-show-environment() {
[[ -n ${tmux_describe} ]] && print "display the environment" && return
_arguments -s \
- '-g[show global environment]' \
+ '(-t)-g[show global environment]' \
'-s[format output as Bourne shell commands]' \
- '-t+[specify target session]:target session:__tmux-sessions'
+ '(-g)-t+[specify target session]:target session:__tmux-sessions' \
}
_tmux-show-messages() {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-17 4:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-17 4:19 [PATCH 1/2] _tmux: Complete option names for show-options and show-window-options Daniel Shahaf
2017-08-17 4:19 ` [PATCH 2/2] _tmux: show-environment, set-environment: Make -g,-t mutually exclusive Daniel Shahaf
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).