summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-12-24 12:38:58 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-12-24 12:38:58 +0000
commitd5af3888f41f7abc0ee4571eb3940bc1227fc657 (patch)
treed9c54923215458ef868934fed87b0a20c27fd882 /usr.bin
parent8114c656726aa7d6c8b0182a06a59f377f0c2a2a (diff)
Add ^ and $ special command targets to select lowest and highest
numbered windows, from Raghavendra D Prabhu.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd.c6
-rw-r--r--usr.bin/tmux/tmux.110
2 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index cd46d13cec2..d1f1da30cc2 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.72 2012/11/27 09:20:03 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.73 2012/12/24 12:38:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 834c3f411a7..23235ca8bbe 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.310 2012/12/24 12:34:32 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.311 2012/12/24 12:38:57 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -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