Make split-window create a new floating pane if used in a floating pane,

rather than just complaining. Also improve documentation. From Dane
Jensen.
This commit is contained in:
nicm
2026-06-27 10:23:14 +00:00
parent 5e0b0a2aa3
commit 79f0f97495
2 changed files with 128 additions and 93 deletions

View File

@@ -96,7 +96,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
if (cmd_get_entry(self) == &cmd_new_pane_entry) if (cmd_get_entry(self) == &cmd_new_pane_entry)
is_floating = !args_has(args, 'L'); is_floating = !args_has(args, 'L');
else else
is_floating = 0; is_floating = window_pane_is_floating(wp);
flags = is_floating ? SPAWN_FLOATING : 0; flags = is_floating ? SPAWN_FLOATING : 0;
if (args_has(args, 'b')) if (args_has(args, 'b'))

219
tmux.1
View File

@@ -2742,6 +2742,15 @@ and
.Fl Y .Fl Y
options set the position of the upper-left corner of the pane. options set the position of the upper-left corner of the pane.
If omitted, new floating panes are cascaded from the top-left of the window. If omitted, new floating panes are cascaded from the top-left of the window.
The
.Fl x ,
.Fl y ,
.Fl X ,
and
.Fl Y
options may be followed by
.Ql %
to specify a percentage of the window size.
.Pp .Pp
If the pane had previously been floating, the position and sizes are restored If the pane had previously been floating, the position and sizes are restored
from the saved values not specified by the from the saved values not specified by the
@@ -3586,7 +3595,7 @@ but a different format may be specified with
.Fl F . .Fl F .
.Tg newp .Tg newp
.It Xo Ic new\-pane .It Xo Ic new\-pane
.Op Fl bdefhIkPvWZ .Op Fl bdefhIkLPvWZ
.Op Fl B Ar border\-lines .Op Fl B Ar border\-lines
.Op Fl c Ar start\-directory .Op Fl c Ar start\-directory
.Op Fl e Ar environment .Op Fl e Ar environment
@@ -3599,101 +3608,49 @@ but a different format may be specified with
.Op Fl S Ar active\-border\-style .Op Fl S Ar active\-border\-style
.Op Fl t Ar target\-pane .Op Fl t Ar target\-pane
.Op Fl T Ar title .Op Fl T Ar title
.Op Fl x Ar width
.Op Fl y Ar height
.Op Fl X Ar x-position
.Op Fl Y Ar y-position
.Op Ar shell\-command Op Ar argument ... .Op Ar shell\-command Op Ar argument ...
.Xc .Xc
.D1 Pq alias: Ic newp .D1 Pq alias: Ic newp
Create a new pane. Creates a new floating pane.
The new pane is created by splitting The
.Ar target\-pane . .Fl x
If and
.Fl d .Fl y
is given, the session does not make the new pane the current pane. options set the width and height of the floating pane in columns and lines
.Fl Z respectively.
zooms if the window is not zoomed, or keeps it zoomed if already zoomed. The default is half the window width and a quarter the window height.
.Fl s The
sets the style for the pane content. .Fl X
.Fl S and
sets the border style when the pane is active and .Fl Y
.Fl R options set the position of the upper-left corner of the pane.
sets the border style when the pane is inactive (see If omitted, new floating panes are cascaded from the top-left of the window.
.Sx STYLES ) . The
.Fl T .Fl x ,
sets the pane title. .Fl y ,
.Fl X ,
and
.Fl Y
options may be followed by
.Ql %
to specify a percentage of the window size.
.Fl B .Fl B
sets the pane border lines for floating panes; see sets the pane border lines for floating panes; see
.Ic pane\-border\-lines . .Ic pane\-border\-lines .
.Pp .Pp
.Fl h
does a horizontal split and
.Fl v
a vertical split; if neither is specified,
.Fl v
is assumed.
The The
.Fl l .Fl L
option specifies the size of the new pane in lines (for vertical split) or in option makes
columns (for horizontal split); .Ic new\-pane
.Ar size behave like
may be followed by .Ic split\-window .
.Ql %
to specify a percentage of the available space.
.Fl p
is a shorthand option for this.
The
.Fl b
option causes the new pane to be created to the left of or above
.Ar target\-pane .
The
.Fl f
option creates a new pane spanning the full window height (with
.Fl h )
or full window width (with
.Fl v ) ,
instead of splitting the active pane.
.Pp
.Fl k
keeps the pane open after the optional
.Ar shell\-command
exits and waits for a key to be pressed before closing it.
The message shown is controlled by the
.Ic remain\-on\-exit\-format
option.
.Fl m Ar message
is equivalent to
.Fl k
but also sets the
.Ic remain\-on\-exit\-format
option for this pane to
.Ar message .
.Pp
.Fl W
Waits until
.Ar shell\-command
exits, then returns its exit status.
For example:
.Bd -literal -offset indent
$ tmux new-pane -W 'vi afile'
$ echo $?
0
.Ed
.Pp
.Fl E ,
or an empty
.Ar shell\-command ,
(\[aq]\[aq]) will create an empty pane with no command running in it;
.Ic display-message
.Fl I
can write to an empty pane.
The
.Fl I
flag will create an empty pane and forward any output from stdin to it.
For example:
.Bd -literal -offset indent
$ make 2>&1|tmux new\-pane \-dI &
.Ed
.Pp .Pp
All other options have the same meaning as for the All other options have the same meaning as for the
.Ic new\-window .Ic split\-window
command. command.
.Tg nextl .Tg nextl
.It Ic next\-layout Op Fl t Ar target\-window .It Ic next\-layout Op Fl t Ar target\-window
@@ -4048,14 +4005,92 @@ the command behaves like
.Op Ar shell\-command Op Ar argument ... .Op Ar shell\-command Op Ar argument ...
.Xc .Xc
.D1 Pq alias: Ic splitw .D1 Pq alias: Ic splitw
Creates a new pane by splitting Create a new pane by splitting
.Ar target\-pane . .Ar target\-pane .
Shares behavior with If
.Ic new\-pane . .Fl d
is given, the session does not make the new pane the current pane.
.Fl Z
zooms if the window is not zoomed, or keeps it zoomed if already zoomed.
.Fl s
sets the style for the pane content.
.Fl S
sets the border style when the pane is active and
.Fl R
sets the border style when the pane is inactive (see
.Sx STYLES ) .
.Fl T
sets the pane title.
.Pp
.Fl h
does a horizontal split and
.Fl v
a vertical split; if neither is specified,
.Fl v
is assumed.
The
.Fl l
option specifies the size of the new pane in lines (for vertical split) or in
columns (for horizontal split);
.Ar size
may be followed by
.Ql %
to specify a percentage of the available space.
.Fl p
is a shorthand option for this.
The
.Fl b
option causes the new pane to be created to the left of or above
.Ar target\-pane .
The
.Fl f
option creates a new pane spanning the full window height (with
.Fl h )
or full window width (with
.Fl v ) ,
instead of splitting the active pane.
.Pp
.Fl k
keeps the pane open after the optional
.Ar shell\-command
exits and waits for a key to be pressed before closing it.
The message shown is controlled by the
.Ic remain\-on\-exit\-format
option.
.Fl m Ar message
is equivalent to
.Fl k
but also sets the
.Ic remain\-on\-exit\-format
option for this pane to
.Ar message .
.Pp
.Fl W
Waits until
.Ar shell\-command
exits, then returns its exit status.
For example:
.Bd -literal -offset indent
$ tmux new-pane -W 'vi afile'
$ echo $?
0
.Ed
.Pp
.Fl E ,
or an empty
.Ar shell\-command ,
(\[aq]\[aq]) will create an empty pane with no command running in it;
.Ic display-message
.Fl I
can write to an empty pane.
The
.Fl I
flag will create an empty pane and forward any output from stdin to it.
For example:
.Bd -literal -offset indent
$ make 2>&1|tmux new\-pane \-dI &
.Ed
.Pp .Pp
See
.Ic new\-pane
for more details.
.Tg swapp .Tg swapp
.It Xo Ic swap\-pane .It Xo Ic swap\-pane
.Op Fl dDUZ .Op Fl dDUZ