mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-19 11:31:26 +01:00
36062: _tmux: Add support for new sub-commands
This commit is contained in:
parent
742f4da3d9
commit
e2495da3c2
2 changed files with 91 additions and 12 deletions
|
@ -6,6 +6,9 @@
|
|||
* 36048: Completion/Unix/Command/_tmux: _tmux: Update options for
|
||||
supported commands
|
||||
|
||||
* 36062: Completion/Unix/Command/_tmux: _tmux: Add support for new
|
||||
sub-commands
|
||||
|
||||
2015-08-10 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 36045: Test/A05execution.ztst: make effect of failures
|
||||
|
|
|
@ -43,18 +43,10 @@
|
|||
#
|
||||
# TODO:
|
||||
#
|
||||
# Missing sub-commands:
|
||||
#
|
||||
# - choose-tree
|
||||
# - last-pane
|
||||
# - move-pane
|
||||
# - respawn-pane
|
||||
# - choose-buffer
|
||||
# - wait-for
|
||||
#
|
||||
# In addition, the way options (set/show etc) are handled needs to be reviewed.
|
||||
# For example, set-option can set every type of option now. I hope this is
|
||||
# rather simple to improve.
|
||||
# The way options (set/show etc) are handled needs to be reviewed.
|
||||
# For example, set-option can set every type of option now. I hope
|
||||
# this is rather simple to improve. Also, there are new options that
|
||||
# need to be supported.
|
||||
|
||||
# Global variables; setup the first time _tmux is called.
|
||||
# For $_tmux_commands[] generation, see the very end of this file.
|
||||
|
@ -88,9 +80,11 @@ _tmux_aliasmap=(
|
|||
killp kill-pane
|
||||
killw kill-window
|
||||
last last-window
|
||||
lastp last-pane
|
||||
linkw link-window
|
||||
lsp list-panes
|
||||
lsw list-windows
|
||||
movep move-pane
|
||||
movew move-window
|
||||
neww new-window
|
||||
nextl next-layout
|
||||
|
@ -99,6 +93,7 @@ _tmux_aliasmap=(
|
|||
prev previous-window
|
||||
renamew rename-window
|
||||
resizep resize-pane
|
||||
respawnp respawn-pane
|
||||
respawnw respawn-window
|
||||
rotatew rotate-window
|
||||
selectl select-layout
|
||||
|
@ -146,6 +141,7 @@ _tmux_aliasmap=(
|
|||
lock lock-server
|
||||
run run-shell
|
||||
info server-info
|
||||
wait wait-for
|
||||
)
|
||||
|
||||
# --- Sub-command functions ---
|
||||
|
@ -231,6 +227,17 @@ function _tmux-capture-pane() {
|
|||
_arguments ${args}
|
||||
}
|
||||
|
||||
function _tmux-choose-buffer() {
|
||||
[[ -n ${tmux_describe} ]] && print "Put a window into buffer choice mode" && return
|
||||
local -a args
|
||||
args=(
|
||||
'-F[specify format of output]:format:__tmux-format'
|
||||
'-t[choose a target window]:sessions:__tmux-windows'
|
||||
'*:: :->tmpl'
|
||||
)
|
||||
_arguments ${args} && return
|
||||
}
|
||||
|
||||
function _tmux-choose-client() {
|
||||
[[ -n ${tmux_describe} ]] && print "Put a window into client choice mode" && return
|
||||
local -a args
|
||||
|
@ -253,6 +260,23 @@ function _tmux-choose-session() {
|
|||
_arguments ${args} && return
|
||||
}
|
||||
|
||||
function _tmux-choose-tree() {
|
||||
[[ -n ${tmux_describe} ]] && print "Put a window into tree choice mode" && return
|
||||
local -a args
|
||||
args=(
|
||||
'-b[override default session command]:session-command:'
|
||||
'-c[override default window command]:window-command:'
|
||||
'-S[specify session format]:session-format:__tmux-formats'
|
||||
'-s[choose among sessions]'
|
||||
'-t[choose a target window]:sessions:__tmux-windows'
|
||||
'-u[show generated tree uncollapsed at startup]'
|
||||
'-W[specify window format]:window-format:__tmux-formats'
|
||||
'-w[choose among windows]'
|
||||
'*:: :->tmpl'
|
||||
)
|
||||
_arguments ${args} && return
|
||||
}
|
||||
|
||||
function _tmux-choose-window() {
|
||||
[[ -n ${tmux_describe} ]] && print "Put a window into window choice mode" && return
|
||||
local -a args
|
||||
|
@ -493,6 +517,17 @@ function _tmux-kill-window() {
|
|||
_arguments ${args}
|
||||
}
|
||||
|
||||
function _tmux-last-pane() {
|
||||
[[ -n ${tmux_describe} ]] && print "Select the previously selected pane" && return
|
||||
local -a args
|
||||
args=(
|
||||
'-d[disable input to the pane]'
|
||||
'-e[enable input to the pane]'
|
||||
'-t[choose a session]:sessions:__tmux-sessions'
|
||||
)
|
||||
_arguments ${args} && return
|
||||
}
|
||||
|
||||
function _tmux-last-window() {
|
||||
[[ -n ${tmux_describe} ]] && print "Select the previously selected window" && return
|
||||
local -a args
|
||||
|
@ -602,6 +637,22 @@ function _tmux-lock-session() {
|
|||
_arguments ${args} && return
|
||||
}
|
||||
|
||||
function _tmux-move-pane() {
|
||||
[[ -n ${tmux_describe} ]] && print "Move a pane into a new space" && return
|
||||
local -a args
|
||||
args=(
|
||||
'-b[join source pane left of or above target pane]'
|
||||
'-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-move-window() {
|
||||
[[ -n ${tmux_describe} ]] && print "Move a window to another" && return
|
||||
local -a args
|
||||
|
@ -760,6 +811,17 @@ function _tmux-resize-pane() {
|
|||
_arguments ${args}
|
||||
}
|
||||
|
||||
function _tmux-respawn-pane() {
|
||||
[[ -n ${tmux_describe} ]] && print "Reuse a pane in which a command has exited" && return
|
||||
local -a args
|
||||
args=(
|
||||
'-k[kill window if it is in use]'
|
||||
'-t[choose target pane]:window:__tmux-pane'
|
||||
'*::command:_command'
|
||||
)
|
||||
_arguments ${args}
|
||||
}
|
||||
|
||||
function _tmux-respawn-window() {
|
||||
[[ -n ${tmux_describe} ]] && print "Reuse a window in which a command has exited" && return
|
||||
local -a args
|
||||
|
@ -1123,6 +1185,20 @@ function _tmux-up-pane() {
|
|||
_arguments ${args}
|
||||
}
|
||||
|
||||
function _tmux-wait-for() {
|
||||
[[ -n ${tmux_describe} ]] && print "Wait for an event or trigger it" && return
|
||||
local state
|
||||
local -a args
|
||||
args=(
|
||||
'-L[lock the named channel]'
|
||||
'-S[send signal to channel]'
|
||||
'-U[unlock the named channel]'
|
||||
'*:: :->channel'
|
||||
)
|
||||
_arguments ${args} && return
|
||||
__tmux-lastarg ${state} 'channel' 1 "event channel"
|
||||
}
|
||||
|
||||
# --- Utility functions ---
|
||||
# They should be called __tmux-*() and kept seperate from the
|
||||
# sub-command functions.
|
||||
|
|
Loading…
Reference in a new issue