zsh-workers
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: zsh-workers@zsh.org
Subject: [PATCH 03/18] _tmux: Add support for new sub-commands
Date: Mon, 10 Aug 2015 15:27:23 +0200	[thread overview]
Message-ID: <1439213258-14196-4-git-send-email-ft@bewatermyfriend.org> (raw)
In-Reply-To: <1439213258-14196-1-git-send-email-ft@bewatermyfriend.org>

---
 Completion/Unix/Command/_tmux | 100 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 88 insertions(+), 12 deletions(-)

diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 7fb328e..92c9190 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -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.
-- 
2.1.4


  parent reply	other threads:[~2015-08-10 13:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 13:27 [PATCH 00/18] Updates for _tmux Frank Terbeck
2015-08-10 13:27 ` [PATCH 01/18] _tmux: Update command line options Frank Terbeck
2015-08-10 13:27 ` [PATCH 02/18] _tmux: Update options for supported commands Frank Terbeck
2015-08-10 13:27 ` Frank Terbeck [this message]
2015-08-10 13:27 ` [PATCH 04/18] _tmux: Remove dead code Frank Terbeck
2015-08-10 13:27 ` [PATCH 05/18] _tmux: Don't unset, set empty in local scope Frank Terbeck
2015-08-10 13:27 ` [PATCH 06/18] _tmux: No need to unset local variables Frank Terbeck
2015-08-10 13:27 ` [PATCH 07/18] _tmux: Replay all arguments when dispatching to new _tmux() Frank Terbeck
2015-08-10 13:27 ` [PATCH 08/18] _tmux: "local -x" serves no purpose Frank Terbeck
2015-08-10 13:27 ` [PATCH 09/18] _tmux: options => session_options Frank Terbeck
2015-08-10 13:27 ` [PATCH 10/18] Add helper script to check state of _tmux completion Frank Terbeck
2015-08-10 15:20   ` wrapping "local" (was: Re: [PATCH 10/18] Add helper script to check state of _tmux completion) Frank Terbeck
2015-08-10 15:32     ` Peter Stephenson
2015-08-10 15:50       ` [PATCH] Disable ‘local’ keyword in script to make data retrieval work Frank Terbeck
2015-08-10 13:27 ` [PATCH 11/18] _tmux: Remove old sub-commands and their aliases Frank Terbeck
2015-08-10 13:27 ` [PATCH 12/18] _tmux: Add new command aliases Frank Terbeck
2015-08-10 13:27 ` [PATCH 13/18] _tmux: Fix options with changed scope Frank Terbeck
2015-08-10 13:27 ` [PATCH 14/18] _tmux: Remove support for old options Frank Terbeck
2015-08-10 13:27 ` [PATCH 15/18] _tmux: Add new session options Frank Terbeck
2015-08-10 13:27 ` [PATCH 16/18] _tmux: Add support for new server options Frank Terbeck
2015-08-10 13:27 ` [PATCH 17/18] _tmux: Add support for new window options Frank Terbeck
2015-08-10 13:27 ` [PATCH 18/18] _tmux: Update TODO Frank Terbeck
2015-08-10 13:52 ` [PATCH 00/18] Updates for _tmux Peter Stephenson
2015-08-10 14:46 ` [PATCH 19/18] _tmux: Update bell-action and prefix options Frank Terbeck
2015-08-10 14:46   ` [PATCH 20/18] _tmux: Fix \ooo display in completion list Frank Terbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439213258-14196-4-git-send-email-ft@bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).