aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-15 08:05:56 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-15 08:05:56 +0000
commitaa3403a3432532984b7057c0f0a34d0c71133c1c (patch)
tree18a39dd45fbea69b7f3518933f13331e713e2600
parent9601b72e4ced58d08f4c1351865746b46ab5895e (diff)
downloadrtmux-aa3403a3432532984b7057c0f0a34d0c71133c1c.tar.gz
rtmux-aa3403a3432532984b7057c0f0a34d0c71133c1c.tar.bz2
rtmux-aa3403a3432532984b7057c0f0a34d0c71133c1c.zip
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--cmd-unlink-window.c6
-rw-r--r--tmux.111
2 files changed, 12 insertions, 5 deletions
diff --git a/cmd-unlink-window.c b/cmd-unlink-window.c
index 1befabd9..2ef1ca04 100644
--- a/cmd-unlink-window.c
+++ b/cmd-unlink-window.c
@@ -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/tmux.1 b/tmux.1
index 172e0e4d..fb5d0cc0 100644
--- a/tmux.1
+++ b/tmux.1
@@ -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