version 1.933, 2023/09/16 16:18:29 |
version 1.934, 2023/12/27 20:20:50 |
|
|
loads the system configuration file from |
loads the system configuration file from |
.Pa /etc/tmux.conf , |
.Pa /etc/tmux.conf , |
if present, then looks for a user configuration file at |
if present, then looks for a user configuration file at |
.Pa ~/.tmux.conf . |
.Pa \[ti]/.tmux.conf . |
.Pp |
.Pp |
The configuration file is a set of |
The configuration file is a set of |
.Nm |
.Nm |
|
|
Split the current pane into two, left and right. |
Split the current pane into two, left and right. |
.It & |
.It & |
Kill the current window. |
Kill the current window. |
.It ' |
.It \[aq] |
Prompt for a window index to select. |
Prompt for a window index to select. |
.It \&( |
.It \&( |
Switch the attached client to the previous session. |
Switch the attached client to the previous session. |
|
|
Swap the current pane with the previous pane. |
Swap the current pane with the previous pane. |
.It } |
.It } |
Swap the current pane with the next pane. |
Swap the current pane with the next pane. |
.It ~ |
.It \[ti] |
Show previous messages from |
Show previous messages from |
.Nm , |
.Nm , |
if any. |
if any. |
|
|
For example, the same |
For example, the same |
.Ic set-option |
.Ic set-option |
command run from the shell prompt, from |
command run from the shell prompt, from |
.Pa ~/.tmux.conf |
.Pa \[ti]/.tmux.conf |
and bound to a key may look like: |
and bound to a key may look like: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ tmux set-option -g status-style bg=cyan |
$ tmux set-option -g status-style bg=cyan |
|
|
.Ql command queue . |
.Ql command queue . |
A global command queue not attached to any client is used on startup |
A global command queue not attached to any client is used on startup |
for configuration files like |
for configuration files like |
.Pa ~/.tmux.conf . |
.Pa \[ti]/.tmux.conf . |
Parsed commands added to the queue are executed in order. |
Parsed commands added to the queue are executed in order. |
Some commands, like |
Some commands, like |
.Ic if-shell |
.Ic if-shell |
|
|
.Pp |
.Pp |
Or: |
Or: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ tmux neww ';' splitw |
$ tmux neww \[aq];\[aq] splitw |
.Ed |
.Ed |
.Pp |
.Pp |
Or from the tmux command prompt: |
Or from the tmux command prompt: |
|
|
.Pp |
.Pp |
Or: |
Or: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ tmux 'neww;' splitw |
$ tmux \[aq]neww;\[aq] splitw |
.Ed |
.Ed |
.Pp |
.Pp |
As in these examples, when running tmux from the shell extra care must be taken |
As in these examples, when running tmux from the shell extra care must be taken |
|
|
For |
For |
.Xr sh 1 |
.Xr sh 1 |
this typically means quoted (such as |
this typically means quoted (such as |
.Ql neww ';' splitw ) |
.Ql neww \[aq];\[aq] splitw ) |
or escaped (such as |
or escaped (such as |
.Ql neww \e\e\e\e; splitw ) . |
.Ql neww \e\e\e\e; splitw ) . |
.It |
.It |
|
|
.Nm ; |
.Nm ; |
for example: |
for example: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ tmux neww 'foo\e\e;' bar |
$ tmux neww \[aq]foo\e\e;\[aq] bar |
$ tmux neww foo\e\e\e\e; bar |
$ tmux neww foo\e\e\e\e; bar |
.Ed |
.Ed |
.It |
.It |
Semicolons that are not individual tokens or trailing another token should only |
Semicolons that are not individual tokens or trailing another token should only |
be escaped once according to shell conventions; for example: |
be escaped once according to shell conventions; for example: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ tmux neww 'foo-;-bar' |
$ tmux neww \[aq]foo-;-bar\[aq] |
$ tmux neww foo-\e\e;-bar |
$ tmux neww foo-\e\e;-bar |
.Ed |
.Ed |
.El |
.El |
|
|
This is called line continuation and applies both inside and outside quoted |
This is called line continuation and applies both inside and outside quoted |
strings and in comments, but not inside braces. |
strings and in comments, but not inside braces. |
.Pp |
.Pp |
Command arguments may be specified as strings surrounded by single (') quotes, |
Command arguments may be specified as strings surrounded by single (\[aq]) quotes, |
double quotes (") or braces ({}). |
double quotes (\[dq]) or braces ({}). |
.\" " |
.\" " |
This is required when the argument contains any special character. |
This is required when the argument contains any special character. |
Single and double quoted strings cannot span multiple lines except with line |
Single and double quoted strings cannot span multiple lines except with line |
|
|
.Sx GLOBAL AND SESSION ENVIRONMENT |
.Sx GLOBAL AND SESSION ENVIRONMENT |
section). |
section). |
.It |
.It |
A leading ~ or ~user is expanded to the home directory of the current or |
A leading \[ti] or \[ti]user is expanded to the home directory of the current or |
specified user. |
specified user. |
.It |
.It |
\euXXXX or \euXXXXXXXX is replaced by the Unicode codepoint corresponding to |
\euXXXX or \euXXXXXXXX is replaced by the Unicode codepoint corresponding to |
|
|
needed when using {}: |
needed when using {}: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
if-shell true { |
if-shell true { |
display -p 'brace-dollar-foo: }$foo' |
display -p \[aq]brace-dollar-foo: }$foo\[aq] |
} |
} |
|
|
if-shell true "display -p 'brace-dollar-foo: }\e$foo'" |
if-shell true "display -p \[aq]brace-dollar-foo: }\e$foo\[aq]" |
.Ed |
.Ed |
.Pp |
.Pp |
Braces may be enclosed inside braces, for example: |
Braces may be enclosed inside braces, for example: |
|
|
or |
or |
.Ql {marked} |
.Ql {marked} |
(alternative form |
(alternative form |
.Ql ~ ) |
.Ql \[ti] ) |
to specify the marked pane (see |
to specify the marked pane (see |
.Ic select-pane |
.Ic select-pane |
.Fl m ) . |
.Fl m ) . |
|
|
commands. |
commands. |
This may be a single argument passed to the shell, for example: |
This may be a single argument passed to the shell, for example: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
new-window 'vi ~/.tmux.conf' |
new-window \[aq]vi \[ti]/.tmux.conf\[aq] |
.Ed |
.Ed |
.Pp |
.Pp |
Will run: |
Will run: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
/bin/sh -c 'vi ~/.tmux.conf' |
/bin/sh -c \[aq]vi \[ti]/.tmux.conf\[aq] |
.Ed |
.Ed |
.Pp |
.Pp |
Additionally, the |
Additionally, the |
|
|
This can avoid issues with shell quoting. |
This can avoid issues with shell quoting. |
For example: |
For example: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ tmux new-window vi ~/.tmux.conf |
$ tmux new-window vi \[ti]/.tmux.conf |
.Ed |
.Ed |
.Pp |
.Pp |
Will run |
Will run |
|
|
|
|
new-window ; split-window -d |
new-window ; split-window -d |
|
|
bind-key R source-file ~/.tmux.conf \e; \e |
bind-key R source-file \[ti]/.tmux.conf \e; \e |
display-message "source-file done" |
display-message "source-file done" |
.Ed |
.Ed |
.Pp |
.Pp |
|
|
|
|
$ tmux new-window \e; split-window -d |
$ tmux new-window \e; split-window -d |
|
|
$ tmux new-session -d 'vi ~/.tmux.conf' \e; split-window -d \e; attach |
$ tmux new-session -d \[aq]vi \[ti]/.tmux.conf\[aq] \e; split-window -d \e; attach |
.Ed |
.Ed |
.Sh CLIENTS AND SESSIONS |
.Sh CLIENTS AND SESSIONS |
The |
The |
|
|
.Nm |
.Nm |
server will exit with no sessions, this is only useful if a session is created |
server will exit with no sessions, this is only useful if a session is created |
in |
in |
.Pa ~/.tmux.conf , |
.Pa \[ti]/.tmux.conf , |
.Ic exit-empty |
.Ic exit-empty |
is turned off, or another command is run as part of the same command sequence. |
is turned off, or another command is run as part of the same command sequence. |
For example: |
For example: |
|
|
$ tmux list-windows |
$ tmux list-windows |
0: ksh [159x48] |
0: ksh [159x48] |
layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0} |
layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0} |
$ tmux select-layout 'bb62,159x48,0,0{79x48,0,0,79x48,80,0}' |
$ tmux select-layout \[aq]bb62,159x48,0,0{79x48,0,0,79x48,80,0}\[aq] |
.Ed |
.Ed |
.Pp |
.Pp |
.Nm |
.Nm |
|
|
and the result executed as a command. |
and the result executed as a command. |
If |
If |
.Ar template |
.Ar template |
is not given, "detach-client -t '%%'" is used. |
is not given, "detach-client -t \[aq]%%\[aq]" is used. |
.Pp |
.Pp |
.Fl O |
.Fl O |
specifies the initial sort field: one of |
specifies the initial sort field: one of |
|
|
and the result executed as a command. |
and the result executed as a command. |
If |
If |
.Ar template |
.Ar template |
is not given, "switch-client -t '%%'" is used. |
is not given, "switch-client -t \[aq]%%\[aq]" is used. |
.Pp |
.Pp |
.Fl O |
.Fl O |
specifies the initial sort field: one of |
specifies the initial sort field: one of |
|
|
substituted by the pane ID. |
substituted by the pane ID. |
The default |
The default |
.Ar template |
.Ar template |
is "select-pane -t '%%'". |
is "select-pane -t \[aq]%%\[aq]". |
With |
With |
.Fl b , |
.Fl b , |
other commands are not blocked from running until the indicator is closed. |
other commands are not blocked from running until the indicator is closed. |
|
|
option only opens a new pipe if no previous pipe exists, allowing a pipe to |
option only opens a new pipe if no previous pipe exists, allowing a pipe to |
be toggled with a single key, for example: |
be toggled with a single key, for example: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P' |
bind-key C-p pipe-pane -o \[aq]cat >>\[ti]/output.#I-#P\[aq] |
.Ed |
.Ed |
.Tg prevl |
.Tg prevl |
.It Xo Ic previous-layout |
.It Xo Ic previous-layout |
|
|
.Pp |
.Pp |
An empty |
An empty |
.Ar shell-command |
.Ar shell-command |
('') will create a pane with no command running in it. |
(\[aq]\[aq]) will create a pane with no command running in it. |
Output can be sent to such a pane with the |
Output can be sent to such a pane with the |
.Ic display-message |
.Ic display-message |
command. |
command. |
|
|
Note that to bind the |
Note that to bind the |
.Ql \&" |
.Ql \&" |
or |
or |
.Ql ' |
.Ql \[aq] |
keys, quotation marks are necessary, for example: |
keys, quotation marks are necessary, for example: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
bind-key '"' split-window |
bind-key \[aq]"\[aq] split-window |
bind-key "'" new-window |
bind-key "\[aq]" new-window |
.Ed |
.Ed |
.Pp |
.Pp |
A command bound to the |
A command bound to the |
|
|
.Ar value . |
.Ar value . |
For example, after: |
For example, after: |
.Pp |
.Pp |
.Dl set -s command-alias[100] zoom='resize-pane -Z' |
.Dl set -s command-alias[100] zoom=\[aq]resize-pane -Z\[aq] |
.Pp |
.Pp |
Using: |
Using: |
.Pp |
.Pp |
|
|
.Pp |
.Pp |
For example: |
For example: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
set -s user-keys[0] "\ee[5;30012~" |
set -s user-keys[0] "\ee[5;30012\[ti]" |
bind User0 resize-pane -L 3 |
bind User0 resize-pane -L 3 |
.Ed |
.Ed |
.El |
.El |
|
|
.Fl H . |
.Fl H . |
The following two commands are equivalent: |
The following two commands are equivalent: |
.Bd -literal -offset indent. |
.Bd -literal -offset indent. |
set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red' |
set-hook -g pane-mode-changed[42] \[aq]set -g status-left-style bg=red\[aq] |
set-option -g pane-mode-changed[42] 'set -g status-left-style bg=red' |
set-option -g pane-mode-changed[42] \[aq]set -g status-left-style bg=red\[aq] |
.Ed |
.Ed |
.Pp |
.Pp |
Setting a hook without specifying an array index clears the hook and sets the |
Setting a hook without specifying an array index clears the hook and sets the |
|
|
.Ic allow-rename |
.Ic allow-rename |
option is turned on): |
option is turned on): |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ printf '\e033kWINDOW_NAME\e033\e\e' |
$ printf \[aq]\e033kWINDOW_NAME\e033\e\e\[aq] |
.Ed |
.Ed |
.It |
.It |
Automatic renaming, which sets the name to the active command in the window's |
Automatic renaming, which sets the name to the active command in the window's |
|
|
When a pane is first created, its title is the hostname. |
When a pane is first created, its title is the hostname. |
A pane's title can be set via the title setting escape sequence, for example: |
A pane's title can be set via the title setting escape sequence, for example: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ printf '\e033]2;My Title\e033\e\e' |
$ printf \[aq]\e033]2;My Title\e033\e\e\[aq] |
.Ed |
.Ed |
.Pp |
.Pp |
It can also be modified with the |
It can also be modified with the |
|
|
.It Li "-" Ta "Marks the last window (previously selected)." |
.It Li "-" Ta "Marks the last window (previously selected)." |
.It Li "#" Ta "Window activity is monitored and activity has been detected." |
.It Li "#" Ta "Window activity is monitored and activity has been detected." |
.It Li "\&!" Ta "Window bells are monitored and a bell has occurred in the window." |
.It Li "\&!" Ta "Window bells are monitored and a bell has occurred in the window." |
.It Li "~" Ta "The window has been silent for the monitor-silence interval." |
.It Li "\[ti]" Ta "The window has been silent for the monitor-silence interval." |
.It Li "M" Ta "The window contains the marked pane." |
.It Li "M" Ta "The window contains the marked pane." |
.It Li "Z" Ta "The window's active pane is zoomed." |
.It Li "Z" Ta "The window's active pane is zoomed." |
.El |
.El |
|
|
and the result executed as a command. |
and the result executed as a command. |
If |
If |
.Ar template |
.Ar template |
is not given, "paste-buffer -b '%%'" is used. |
is not given, "paste-buffer -b \[aq]%%\[aq]" is used. |
.Pp |
.Pp |
.Fl O |
.Fl O |
specifies the initial sort field: one of |
specifies the initial sort field: one of |
|
|
to change the cursor colour from inside |
to change the cursor colour from inside |
.Nm : |
.Nm : |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ printf '\e033]12;red\e033\e\e' |
$ printf \[aq]\e033]12;red\e033\e\e\[aq] |
.Ed |
.Ed |
.Pp |
.Pp |
The colour is an |
The colour is an |
|
|
If set, a sequence such as this may be used |
If set, a sequence such as this may be used |
to change the cursor to an underline: |
to change the cursor to an underline: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ printf '\e033[4 q' |
$ printf \[aq]\e033[4 q\[aq] |
.Ed |
.Ed |
.Pp |
.Pp |
If |
If |
|
|
.El |
.El |
.Sh FILES |
.Sh FILES |
.Bl -tag -width "/etc/tmux.confXXX" -compact |
.Bl -tag -width "/etc/tmux.confXXX" -compact |
.It Pa ~/.tmux.conf |
.It Pa \[ti]/.tmux.conf |
Default |
Default |
.Nm |
.Nm |
configuration file. |
configuration file. |
|
|
Commands to be run when the |
Commands to be run when the |
.Nm |
.Nm |
server is started may be placed in the |
server is started may be placed in the |
.Pa ~/.tmux.conf |
.Pa \[ti]/.tmux.conf |
configuration file. |
configuration file. |
Common examples include: |
Common examples include: |
.Pp |
.Pp |
|
|
Creating new key bindings: |
Creating new key bindings: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
bind-key b set-option status |
bind-key b set-option status |
bind-key / command-prompt "split-window 'exec man %%'" |
bind-key / command-prompt "split-window \[aq]exec man %%\[aq]" |
bind-key S command-prompt "new-window -n %1 'ssh %1'" |
bind-key S command-prompt "new-window -n %1 \[aq]ssh %1\[aq]" |
.Ed |
.Ed |
.Sh SEE ALSO |
.Sh SEE ALSO |
.Xr pty 4 |
.Xr pty 4 |