From d5af3888f41f7abc0ee4571eb3940bc1227fc657 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 24 Dec 2012 12:38:58 +0000 Subject: Add ^ and $ special command targets to select lowest and highest numbered windows, from Raghavendra D Prabhu. --- usr.bin/tmux/cmd.c | 6 +++++- usr.bin/tmux/tmux.1 | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'usr.bin') 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 @@ -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 .\" @@ -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 -- cgit v1.2.3