From 854e8ae04d15c16b688ba38119656aee134548dd Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 24 Dec 2012 12:38:57 +0000 Subject: [PATCH] Add ^ and $ special command targets to select lowest and highest numbered windows, from Raghavendra D Prabhu. --- cmd.c | 4 ++++ tmux.1 | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/cmd.c b/cmd.c index a9594c07..c0888a2c 100644 --- a/cmd.c +++ b/cmd.c @@ -863,6 +863,10 @@ cmd_find_window(struct cmd_ctx *ctx, const char *arg, struct session **sp) wl = s->curw; else if (winptr[0] == '!' && winptr[1] == '\0') wl = TAILQ_FIRST(&s->lastw); + else if (winptr[0] == '^' && winptr[1] == '\0') + wl = RB_MIN(winlinks, &s->windows); + else if (winptr[0] == '$' && winptr[1] == '\0') + wl = RB_MAX(winlinks, &s->windows); else if (winptr[0] == '+' || winptr[0] == '-') wl = cmd_find_window_offset(winptr, s, &ambiguous); else diff --git a/tmux.1 b/tmux.1 index 349c23f2..7abb8f88 100644 --- a/tmux.1 +++ b/tmux.1 @@ -408,11 +408,15 @@ otherwise the current window in is chosen. The special character .Ql \&! -uses the last (previously current) window, or +uses the last (previously current) window, +.Ql ^ +selects the highest numbered window, +.Ql $ +selects the lowest numbered window, and .Ql + and .Ql - -are the next window or the previous window by number. +select the next window or the previous window by number. When the argument does not contain a colon, .Nm first attempts to parse it as window; if that fails, an attempt is made to @@ -1126,6 +1130,7 @@ This command works only from inside .Ic choose-tree .Op Fl s .Op Fl w +.Op Fl u .Op Fl b Ar session-template .Op Fl c Ar window-template .Op Fl S Ar format @@ -1151,6 +1156,9 @@ If .Fl w is given, will show windows. If +.Fl u +is given, the tree is uncollapsed by default. +If .Fl b is given, will override the default session command. Note that @@ -1639,7 +1647,7 @@ is the same as using the .Ic last-pane command. .It Xo Ic select-window -.Op Fl lnp +.Op Fl lnpT .Op Fl t Ar target-window .Xc .D1 (alias: Ic selectw ) @@ -1655,6 +1663,11 @@ are equivalent to the and .Ic previous-window commands. +If +.Fl T +is given and the selected window is already the current window, +the command behaves like +.Ic last-window . .It Xo Ic split-window .Op Fl dhvP .Op Fl c Ar start-directory