Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _tmux: new options, command and updates
- X-seq: zsh-workers 27586
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: _tmux: new options, command and updates
- Date: Sun, 10 Jan 2010 01:21:16 +0100
- 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
This adds support for server options to the tmux completion. So far
there are the options 'quiet' and 'escape-time' and they are handled.
This also adds support for the new 'join-pane' command. And this also
updates the 'split-window' completion to behave the way the new tmux
development moved.
And finally, there are a number of new options that make it possible to
colourise the border of panes (and especially the active one). With this
patch, _tmux knows about those, too.
Regards, Frank
---
Completion/Unix/Command/_tmux | 57 ++++++++++++++++++++++++++++++++++++++--
1 files changed, 54 insertions(+), 3 deletions(-)
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 7d8adf7..7b29a9f 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -69,6 +69,7 @@ _tmux_aliasmap=(
displayp display-panes
downp down-pane
findw find-window
+ joinp join-pane
killp kill-pane
killw kill-window
last last-window
@@ -398,6 +399,21 @@ function _tmux-if-shell() {
_arguments ${args}
}
+function _tmux-join-pane() {
+ [[ -n ${tmux_describe} ]] && print "Split a pane and move an existing one into the new space" && return
+ local -a args
+ args=(
+ '-d[Do not make the new window become the active one]'
+ '-h[Split horizontally]'
+ '-v[Split vertically]'
+ '-l[Define new pane'\''s size]: :_guard "[0-9]#" "numeric value"'
+ '-p[Define new pane'\''s size in percent]: :_guard "[0-9]#" "numeric value"'
+ '-s[Choose source pane]:window:__tmux-panes'
+ '-t[Choose target pane]:window:__tmux-panes'
+ )
+ _arguments ${args} && return
+}
+
function _tmux-kill-pane() {
[[ -n ${tmux_describe} ]] && print "Destroy a given pane" && return
local -a args
@@ -855,10 +871,17 @@ function _tmux-set-option() {
'-g[Set a global session option]'
'-u[Unset a non-global option]'
'-w[Change window (not session) options]'
+ '-s[Change server (not session) options]'
'-t[Choose a target session]:target session:__tmux-sessions'
'*:: :->name_or_value'
)
- __tmux-got-option-already -w && mode=window || mode=session
+ if __tmux-got-option-already -w; then
+ mode=window
+ elif __tmux-got-option-already -s; then
+ mode=server
+ else
+ mode=session
+ fi
_arguments -C ${args}
__tmux-options-complete ${mode} ${state}
}
@@ -950,7 +973,7 @@ function _tmux-source-file() {
}
function _tmux-split-window() {
- [[ -n ${tmux_describe} ]] && print "Creates a new pane" && return
+ [[ -n ${tmux_describe} ]] && print "Splits a pane into two" && return
local -a args
args=(
'-d[Do not make the new window become the active one]'
@@ -958,7 +981,11 @@ function _tmux-split-window() {
'-v[Split vertically]'
'-l[Define new pane'\''s size]: :_guard "[0-9]#" "numeric value"'
'-p[Define new pane'\''s size in percent]: :_guard "[0-9]#" "numeric value"'
- '-t[Choose target window]:window:__tmux-windows'
+ # Yes, __tmux_pane is correct here. The behaviour was changed
+ # in recent tmux versions and makes more sense. Except that
+ # changing the command's name might annoy users. So it stays like
+ # this.
+ '-t[Choose target pane]:window:__tmux-panes'
'*:: :_command'
)
_arguments ${args} && return
@@ -1186,6 +1213,10 @@ function __tmux-option-guard() {
'message-fg:__tmux-colours'
'message-limit:'${int_guard}
'mouse-select-pane:DESC:on off'
+ 'pane-border-bg:__tmux-colours'
+ 'pane-border-fg:__tmux-colours'
+ 'pane-active-border-bg:__tmux-colours'
+ 'pane-active-border-fg:__tmux-colours'
'prefix:MSG:comma-seperated key list'
'repeat-time:'${int_guard}
'set-remain-on-exit:DESC:on off'
@@ -1215,6 +1246,11 @@ function __tmux-option-guard() {
'visual-bell:DESC:on off'
'visual-content:DESC:on off'
)
+ elif [[ ${mode} == 'server' ]]; then
+ options=(
+ 'escape-time:'${int_guard}
+ 'quiet:DESC:on off'
+ )
else
options=(
'aggressive-resize:DESC:on off'
@@ -1291,6 +1327,10 @@ function __tmux-options() {
'message-fg:Set status line message foreground colour'
'message-limit:Set size of message log per client'
'mouse-select-pane:Make mouse clicks select window panes'
+ 'pane-border-bg:Set pane border foreground colour'
+ 'pane-border-fg:Set pane border background colour'
+ 'pane-active-border-bg:Set active pane border foreground colour'
+ 'pane-active-border-fg:Set active pane border background colour'
'prefix:Comma seperated line of keys accepted as prefix key'
'repeat-time:Time for multiple commands without prefix-key presses'
'set-remain-on-exit:Set remain-on-exit window option'
@@ -1330,6 +1370,8 @@ function __tmux-options-complete() {
name_or_value)
if (( CURRENT == 1 )) && [[ ${mode} == 'session' ]]; then
__tmux-options
+ elif (( CURRENT == 1 )) && [[ ${mode} == 'server' ]]; then
+ __tmux-server-options
elif (( CURRENT == 1 )) && [[ ${mode} == 'window' ]]; then
__tmux-window-options
elif (( CURRENT == 2 )); then
@@ -1362,6 +1404,15 @@ function __tmux-panes() {
fi
}
+function __tmux-server-options() {
+ local -a tmux_server_options
+ tmux_server_options=(
+ 'escape-time:Set timeout to detect single escape characters (in msecs)'
+ 'quiet:Enable/disable the display of various informational messages'
+ )
+ _describe -t tmux-server-options 'tmux server option' tmux_server_options
+}
+
function __tmux-sessions() {
local expl
local -a sessions
--
1.6.6.rc1.31.g1a56b
Messages sorted by:
Reverse Date,
Date,
Thread,
Author