summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-07-15 08:05:57 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-07-15 08:05:57 +0000
commit73b3e3750d001497459f22987ceea4f26740c849 (patch)
tree332495812db7e89b7c775d00527e0d0d3dfa8ed7
parentb5a445e0538feb2ae2cfef81cfa9558a23d3a236 (diff)
Add a -k flag to unlink-window which makes it behave the same as the old
kill-window - if a window is linked into only one session it unlinked and destroyed.
-rw-r--r--usr.bin/tmux/cmd-unlink-window.c8
-rw-r--r--usr.bin/tmux/tmux.115
2 files changed, 15 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-unlink-window.c b/usr.bin/tmux/cmd-unlink-window.c
index 9c5557b10bd..181f75247de 100644
--- a/usr.bin/tmux/cmd-unlink-window.c
+++ b/usr.bin/tmux/cmd-unlink-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-unlink-window.c,v 1.2 2009/07/13 23:11:35 nicm Exp $ */
+/* $OpenBSD: cmd-unlink-window.c,v 1.3 2009/07/15 08:05:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -28,8 +28,8 @@ int cmd_unlink_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_unlink_window_entry = {
"unlink-window", "unlinkw",
- CMD_TARGET_WINDOW_USAGE,
- 0, 0,
+ "[-k] " CMD_TARGET_WINDOW_USAGE,
+ 0, CMD_CHFLAG('k'),
cmd_target_init,
cmd_target_parse,
cmd_unlink_window_exec,
@@ -52,7 +52,7 @@ cmd_unlink_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
return (-1);
- if (wl->window->references == 1) {
+ if (!(data->chflags & CMD_CHFLAG('k')) && wl->window->references == 1) {
ctx->error(ctx, "window is only linked to one session");
return (-1);
}
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index b01159ecf12..1e98fedde0f 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.30 2009/07/13 20:14:23 jmc Exp $
+.\" $OpenBSD: tmux.1,v 1.31 2009/07/15 08:05:56 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 13 2009 $
+.Dd $Mdocdate: July 15 2009 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -1555,13 +1555,20 @@ to
Unbind the key bound to
.Ar key .
.It Xo Ic unlink-window
+.Op Fl k
.Op Fl t Ar target-window
.Xc
.D1 (alias: Ic unlinkw )
Unlink
.Ar target-window .
-A window may be unlinked only if it is linked to multiple sessions - windows may
-not be linked to no sessions.
+Unless
+.Fl k
+is given, a window may be unlinked only if it is linked to multiple sessions -
+windows may not be linked to no sessions;
+if
+.Fl k
+is specified and the window is linked to only one session, it is unlinked and
+destroyed.
.It Xo Ic up-pane
.Op Fl p Ar pane-index
.Op Fl t Ar target-window