diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-03-12 13:31:10 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-03-12 13:31:10 +0000 |
commit | dcc3914a4db1fda33c34f6a6c36c1b0c9a3b9d1a (patch) | |
tree | 27bbf7465776da32c506dd1b7b6270158f063d1f /usr.bin | |
parent | babd63e898003224b53f54fd3561505445f910ba (diff) |
Add -P/-F flags to break-pane too, from George Nachman.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/cmd-break-pane.c | 27 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 14 |
2 files changed, 35 insertions, 6 deletions
diff --git a/usr.bin/tmux/cmd-break-pane.c b/usr.bin/tmux/cmd-break-pane.c index 84f5d982897..81d62768a99 100644 --- a/usr.bin/tmux/cmd-break-pane.c +++ b/usr.bin/tmux/cmd-break-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-break-pane.c,v 1.12 2012/02/02 00:10:11 nicm Exp $ */ +/* $OpenBSD: cmd-break-pane.c,v 1.13 2012/03/12 13:31:09 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -30,8 +30,8 @@ int cmd_break_pane_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_break_pane_entry = { "break-pane", "breakp", - "dt:", 0, 0, - "[-d] " CMD_TARGET_PANE_USAGE, + "dPF:t:", 0, 0, + "[-dP] [-F format] " CMD_TARGET_PANE_USAGE, 0, NULL, NULL, @@ -49,6 +49,10 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx) char *name; char *cause; int base_idx; + struct client *c; + struct format_tree *ft; + const char *template; + char *cp; if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL) return (-1); @@ -88,5 +92,22 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx) server_redraw_session(s); server_status_session_group(s); + if (args_has(args, 'P')) { + template = "#{session_name}:#{window_index}"; + if (args_has(args, 'F')) + template = args_get(args, 'F'); + ft = format_create(); + if ((c = cmd_find_client(ctx, NULL)) != NULL) + format_client(ft, c); + format_session(ft, s); + format_winlink(ft, s, wl); + format_window_pane(ft, wp); + + cp = format_expand(ft, template); + ctx->print(ctx, "%s", cp); + xfree(cp); + + format_free(ft); + } return (0); } diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 4e894d73440..64b57f8fa3d 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.279 2012/03/04 20:50:53 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.280 2012/03/12 13:31:09 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: March 4 2012 $ +.Dd $Mdocdate: March 12 2012 $ .Dt TMUX 1 .Os .Sh NAME @@ -996,7 +996,8 @@ from which the layout was originally defined. Commands related to windows and panes are as follows: .Bl -tag -width Ds .It Xo Ic break-pane -.Op Fl d +.Op Fl dP +.Op Fl F Ar format .Op Fl t Ar target-pane .Xc .D1 (alias: Ic breakp ) @@ -1006,6 +1007,13 @@ off from its containing window to make it the only pane in a new window. If .Fl d is given, the new window does not become the current window. +The +.Fl P +option prints information about the new window after it has been created. +By default, it uses the format +.Ql #{session_name}:#{window_index} +but a different format may be specified with +.Fl F . .It Xo Ic capture-pane .Op Fl b Ar buffer-index .Op Fl E Ar end-line |