* PATCH: _tmux: Add support for the -w option of set-option
@ 2009-12-05 9:29 Frank Terbeck
2009-12-05 18:06 ` Frank Terbeck
0 siblings, 1 reply; 2+ messages in thread
From: Frank Terbeck @ 2009-12-05 9:29 UTC (permalink / raw)
To: zsh-workers
That option lets the user change window options with set-option instead
of the default session options. So,
% tmux set-option -w <tab>
should behave exactly like this:
% tmux set-window-option <tab>
This patch does that.
It is based on top of the changes in zsh-workers-27450.
Regards, Frank
---
Completion/Unix/Command/_tmux | 52 ++++++++++++++++++++++-------------------
1 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 7a64400..7d8adf7 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -848,27 +848,19 @@ function _tmux-set-environment() {
function _tmux-set-option() {
[[ -n ${tmux_describe} ]] && print "Set a session option" && return
+ local mode
local -a args
args=(
'-a[Append to string options]'
'-g[Set a global session option]'
'-u[Unset a non-global option]'
+ '-w[Change window (not session) options]'
'-t[Choose a target session]:target session:__tmux-sessions'
'*:: :->name_or_value'
)
+ __tmux-got-option-already -w && mode=window || mode=session
_arguments -C ${args}
-
- case ${state} in
- name_or_value)
- if (( CURRENT == 1 )); then
- __tmux-options
- elif (( CURRENT == 2 )); then
- __tmux-option-guard 'session' ${words[1]}
- else
- __tmux-nothing-else
- fi
- ;;
- esac
+ __tmux-options-complete ${mode} ${state}
}
function _tmux-set-window-option() {
@@ -882,18 +874,7 @@ function _tmux-set-window-option() {
'*:: :->name_or_value'
)
_arguments -C ${args}
-
- case ${state} in
- name_or_value)
- if (( CURRENT == 1 )); then
- __tmux-window-options
- elif (( CURRENT == 2 )); then
- __tmux-option-guard 'window' ${words[1]}
- else
- __tmux-nothing-else
- fi
- ;;
- esac
+ __tmux-options-complete window ${state}
}
function _tmux-show-buffer() {
@@ -1144,6 +1125,11 @@ function __tmux-get-optarg() {
done
}
+function __tmux-got-option-already() {
+ [[ -n ${(M)words:#$1} ]] && return 0
+ return 1
+}
+
function __tmux-key-tables() {
local expl
local -a tables
@@ -1337,6 +1323,24 @@ function __tmux-options() {
_describe -t tmux-options 'tmux option' tmux_options
}
+function __tmux-options-complete() {
+ local mode="$1" state="$2"
+
+ case ${state} in
+ name_or_value)
+ if (( CURRENT == 1 )) && [[ ${mode} == 'session' ]]; then
+ __tmux-options
+ elif (( CURRENT == 1 )) && [[ ${mode} == 'window' ]]; then
+ __tmux-window-options
+ elif (( CURRENT == 2 )); then
+ __tmux-option-guard ${mode} ${words[1]}
+ else
+ __tmux-nothing-else
+ fi
+ ;;
+ esac
+}
+
function __tmux-panes() {
local expl line
local -i num
--
1.6.5.rc2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: _tmux: Add support for the -w option of set-option
2009-12-05 9:29 PATCH: _tmux: Add support for the -w option of set-option Frank Terbeck
@ 2009-12-05 18:06 ` Frank Terbeck
0 siblings, 0 replies; 2+ messages in thread
From: Frank Terbeck @ 2009-12-05 18:06 UTC (permalink / raw)
To: zsh-workers
Frank Terbeck <ft@bewatermyfriend.org>:
[...]
> It is based on top of the changes in zsh-workers-27450.
Um, I've seen that the "set-option -w" patch was committed, but the
capture-pane support from zsh-workers-27450 seems have fallen through
the cracks (or maybe, I'm just a little too impatient).
That would be this patch:
<http://www.zsh.org/mla/workers/2009/msg01236.html>
Seems like it still applies cleanly even on top of the set-option
patch.
Regards, Frank
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-05 18:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-05 9:29 PATCH: _tmux: Add support for the -w option of set-option Frank Terbeck
2009-12-05 18:06 ` Frank Terbeck
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).