mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
-a option to kill all except current pane. From Tiago Cunha, thanks!
This commit is contained in:
parent
c2b8f3b55a
commit
df818c1b69
@ -30,8 +30,8 @@ int cmd_kill_pane_exec(struct cmd *, struct cmd_ctx *);
|
|||||||
|
|
||||||
const struct cmd_entry cmd_kill_pane_entry = {
|
const struct cmd_entry cmd_kill_pane_entry = {
|
||||||
"kill-pane", "killp",
|
"kill-pane", "killp",
|
||||||
CMD_TARGET_PANE_USAGE,
|
"[-a] " CMD_TARGET_PANE_USAGE,
|
||||||
0, 0,
|
0, CMD_CHFLAG('a'),
|
||||||
cmd_target_init,
|
cmd_target_init,
|
||||||
cmd_target_parse,
|
cmd_target_parse,
|
||||||
cmd_kill_pane_exec,
|
cmd_kill_pane_exec,
|
||||||
@ -44,7 +44,7 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
{
|
{
|
||||||
struct cmd_target_data *data = self->data;
|
struct cmd_target_data *data = self->data;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
struct window_pane *wp;
|
struct window_pane *loopwp, *nextwp, *wp;
|
||||||
|
|
||||||
if ((wl = cmd_find_pane(ctx, data->target, NULL, &wp)) == NULL)
|
if ((wl = cmd_find_pane(ctx, data->target, NULL, &wp)) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -56,8 +56,21 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
layout_close_pane(wp);
|
if (data->chflags & CMD_CHFLAG('a')) {
|
||||||
window_remove_pane(wl->window, wp);
|
loopwp = TAILQ_FIRST(&wl->window->panes);
|
||||||
|
while (loopwp != NULL) {
|
||||||
|
nextwp = TAILQ_NEXT(loopwp, entry);
|
||||||
|
if (loopwp != wp) {
|
||||||
|
layout_close_pane(loopwp);
|
||||||
|
window_remove_pane(wl->window, loopwp);
|
||||||
|
}
|
||||||
|
loopwp = nextwp;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
layout_close_pane(wp);
|
||||||
|
window_remove_pane(wl->window, wp);
|
||||||
|
}
|
||||||
server_redraw_window(wl->window);
|
server_redraw_window(wl->window);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
9
tmux.1
9
tmux.1
@ -740,10 +740,17 @@ If only one window is matched, it'll be automatically selected, otherwise a
|
|||||||
choice list is shown.
|
choice list is shown.
|
||||||
This command only works from inside
|
This command only works from inside
|
||||||
.Nm .
|
.Nm .
|
||||||
.It Ic kill-pane Op Fl t Ar target-pane
|
.It Xo Ic kill-pane
|
||||||
|
.Op Fl a
|
||||||
|
.Op Fl t Ar target-pane
|
||||||
|
.Xc
|
||||||
.D1 (alias: Ic killp )
|
.D1 (alias: Ic killp )
|
||||||
Destroy the given pane.
|
Destroy the given pane.
|
||||||
If no panes remain in the containing window, it is also destroyed.
|
If no panes remain in the containing window, it is also destroyed.
|
||||||
|
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 t Ar target-window
|
||||||
.D1 (alias: Ic killw )
|
.D1 (alias: Ic killw )
|
||||||
Kill the current window or the window at
|
Kill the current window or the window at
|
||||||
|
Loading…
Reference in New Issue
Block a user