Add new-pane command, currently this is equivalent to split-window but

it will have minor differences for floating panes in future. Also add
-R/-s/-S/-k/-m flags to control border and style and behaviour, like
popups. GitHub issue 5027 from Dane Jensen.
This commit is contained in:
nicm
2026-05-17 10:44:53 +00:00
parent 281e8ff766
commit 4cea1c7189
5 changed files with 254 additions and 104 deletions

153
tmux.1
View File

@@ -3268,6 +3268,98 @@ By default, it uses the format
.Ql #{session_name}:#{window_index}
but a different format may be specified with
.Fl F .
.Tg newp
.It Xo Ic new\-pane
.Op Fl bdefhIkPvZ
.Op Fl c Ar start\-directory
.Op Fl e Ar environment
.Op Fl F Ar format
.Op Fl l Ar size
.Op Fl m Ar message
.Op Fl p Ar percentage
.Op Fl R Ar inactive\-border\-style
.Op Fl s Ar style
.Op Fl S Ar active\-border\-style
.Op Fl t Ar target\-pane
.Op Ar shell\-command Op Ar argument ...
.Xc
.D1 Pq alias: Ic newp
Create a new pane.
The new pane is created by splitting
.Ar target\-pane .
If
.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 ) .
.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
An empty
.Ar shell\-command
(\[aq]\[aq]) will create a pane with no command running in it.
The
.Fl I
flag (if
.Ar shell\-command
is not specified or empty)
will create an empty pane and forward any output from stdin to it.
For example:
.Bd -literal -offset indent
$ make 2>&1|tmux splitw \-dI &
.Ed
.Pp
All other options have the same meaning as for the
.Ic new\-window
command.
.Tg nextl
.It Ic next\-layout Op Fl t Ar target\-window
.D1 Pq alias: Ic nextl
@@ -3592,65 +3684,28 @@ the command behaves like
.Ic last\-window .
.Tg splitw
.It Xo Ic split\-window
.Op Fl bdfhIvPZ
.Op Fl bdefhIkPvZ
.Op Fl c Ar start\-directory
.Op Fl e Ar environment
.Op Fl F Ar format
.Op Fl l Ar size
.Op Fl m Ar message
.Op Fl p Ar percentage
.Op Fl R Ar inactive\-border\-style
.Op Fl s Ar style
.Op Fl S Ar active\-border\-style
.Op Fl t Ar target\-pane
.Op Ar shell\-command Op Ar argument ...
.Xc
.D1 Pq alias: Ic splitw
Create a new pane by splitting
.Ar target\-pane :
.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.
The
.Fl b
option causes the new pane to be created to the left of or above
Creates a new pane by splitting
.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.
.Fl Z
zooms if the window is not zoomed, or keeps it zoomed if already zoomed.
Shares behavior with
.Ic new\-pane .
.Pp
An empty
.Ar shell\-command
(\[aq]\[aq]) will create a pane with no command running in it.
Output can be sent to such a pane with the
.Ic display\-message
command.
The
.Fl I
flag (if
.Ar shell\-command
is not specified or empty)
will create an empty pane and forward any output from stdin to it.
For example:
.Bd -literal -offset indent
$ make 2>&1|tmux splitw \-dI &
.Ed
.Pp
All other options have the same meaning as for the
.Ic new\-window
command.
See
.Ic new\-pane
for more details.
.Tg swapp
.It Xo Ic swap\-pane
.Op Fl dDUZ