As with kill-pane, the "-a" flag will kill all windows but the window
referenced with -t. With no arguments to -t, or its absense, then the
current window is used.
---
cmd-kill-window.c | 18 +++++++++++++-----
tmux.1 | 8 +++++++-
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/cmd-kill-window.c b/cmd-kill-window.c
index 1d26615..661ba16 100644
--- a/cmd-kill-window.c
+++ b/cmd-kill-window.c
@@ -28,8 +28,8 @@ int cmd_kill_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_kill_window_entry = {
"kill-window", "killw",
- "t:", 0, 0,
- CMD_TARGET_WINDOW_USAGE,
+ "at:", 0, 0,
+ "[-a] " CMD_TARGET_WINDOW_USAGE,
0,
NULL,
NULL,
@@ -40,13 +40,21 @@ int
cmd_kill_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
- struct winlink *wl;
+ struct winlink *wl, *wl2;
if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
return (-1);
- server_kill_window(wl->window);
- recalculate_sizes();
+ if (args_has(args, 'a')) {
+ RB_FOREACH(wl2, winlinks, &ctx->curclient->session->windows) {
+ if (wl == wl2)
+ continue;
+
+ server_kill_window(wl2->window);
+ }
+ } else
+ server_kill_window(wl->window);
+ recalculate_sizes();
return (0);
}
diff --git a/tmux.1 b/tmux.1
index 2975268..7069d11 100644
--- a/tmux.1
+++ b/tmux.1
@@ -1161,11 +1161,17 @@ The
.Fl a
option kills all but the pane given with
.Fl t .
-.It Ic kill-window Op Fl t Ar target-window
+.It Ic kill-window
+.Op Fl a
+.Op Fl t Ar target-window
.D1 (alias: Ic killw )
Kill the current window or the window at
.Ar target-window ,
removing it from any sessions to which it is linked.
+The
+.Fl a
+option kills all but the window given with
+.Fl t .
.It Ic last-pane Op Fl t Ar target-window
.D1 (alias: Ic lastp )
Select the last (previously selected) pane.
--
1.7.9.1
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users