xref: /openbsd-src/usr.bin/tmux/tmux.1 (revision 3374c67d44f9b75b98444cbf63020f777792342e)
1.\" $OpenBSD: tmux.1,v 1.910 2022/12/22 19:53:23 kn Exp $
2.\"
3.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
14.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
15.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: December 22 2022 $
18.Dt TMUX 1
19.Os
20.Sh NAME
21.Nm tmux
22.Nd terminal multiplexer
23.Sh SYNOPSIS
24.Nm tmux
25.Bk -words
26.Op Fl 2CDlNuVv
27.Op Fl c Ar shell-command
28.Op Fl f Ar file
29.Op Fl L Ar socket-name
30.Op Fl S Ar socket-path
31.Op Fl T Ar features
32.Op Ar command Op Ar flags
33.Ek
34.Sh DESCRIPTION
35.Nm
36is a terminal multiplexer:
37it enables a number of terminals to be created, accessed, and
38controlled from a single screen.
39.Nm
40may be detached from a screen
41and continue running in the background,
42then later reattached.
43.Pp
44When
45.Nm
46is started, it creates a new
47.Em session
48with a single
49.Em window
50and displays it on screen.
51A status line at the bottom of the screen
52shows information on the current session
53and is used to enter interactive commands.
54.Pp
55A session is a single collection of
56.Em pseudo terminals
57under the management of
58.Nm .
59Each session has one or more
60windows linked to it.
61A window occupies the entire screen
62and may be split into rectangular panes,
63each of which is a separate pseudo terminal
64(the
65.Xr pty 4
66manual page documents the technical details of pseudo terminals).
67Any number of
68.Nm
69instances may connect to the same session,
70and any number of windows may be present in the same session.
71Once all sessions are killed,
72.Nm
73exits.
74.Pp
75Each session is persistent and will survive accidental disconnection
76(such as
77.Xr ssh 1
78connection timeout) or intentional detaching (with the
79.Ql C-b d
80key strokes).
81.Nm
82may be reattached using:
83.Pp
84.Dl $ tmux attach
85.Pp
86In
87.Nm ,
88a session is displayed on screen by a
89.Em client
90and all sessions are managed by a single
91.Em server .
92The server and each client are separate processes which communicate through a
93socket in
94.Pa /tmp .
95.Pp
96The options are as follows:
97.Bl -tag -width "XXXXXXXXXXXX"
98.It Fl 2
99Force
100.Nm
101to assume the terminal supports 256 colours.
102This is equivalent to
103.Fl T Ar 256 .
104.It Fl C
105Start in control mode (see the
106.Sx CONTROL MODE
107section).
108Given twice
109.Xo ( Fl CC ) Xc
110disables echo.
111.It Fl c Ar shell-command
112Execute
113.Ar shell-command
114using the default shell.
115If necessary, the
116.Nm
117server will be started to retrieve the
118.Ic default-shell
119option.
120This option is for compatibility with
121.Xr sh 1
122when
123.Nm
124is used as a login shell.
125.It Fl D
126Do not start the
127.Nm
128server as a daemon.
129This also turns the
130.Ic exit-empty
131option off.
132With
133.Fl D ,
134.Ar command
135may not be specified.
136.It Fl f Ar file
137Specify an alternative configuration file.
138By default,
139.Nm
140loads the system configuration file from
141.Pa /etc/tmux.conf ,
142if present, then looks for a user configuration file at
143.Pa ~/.tmux.conf .
144.Pp
145The configuration file is a set of
146.Nm
147commands which are executed in sequence when the server is first started.
148.Nm
149loads configuration files once when the server process has started.
150The
151.Ic source-file
152command may be used to load a file later.
153.Pp
154.Nm
155shows any error messages from commands in configuration files in the first
156session created, and continues to process the rest of the configuration file.
157.It Fl L Ar socket-name
158.Nm
159stores the server socket in a directory under
160.Ev TMUX_TMPDIR
161or
162.Pa /tmp
163if it is unset.
164The default socket is named
165.Em default .
166This option allows a different socket name to be specified, allowing several
167independent
168.Nm
169servers to be run.
170Unlike
171.Fl S
172a full path is not necessary: the sockets are all created in a directory
173.Pa tmux-UID
174under the directory given by
175.Ev TMUX_TMPDIR
176or in
177.Pa /tmp .
178The
179.Pa tmux-UID
180directory is created by
181.Nm
182and must not be world readable, writable or executable.
183.Pp
184If the socket is accidentally removed, the
185.Dv SIGUSR1
186signal may be sent to the
187.Nm
188server process to recreate it (note that this will fail if any parent
189directories are missing).
190.It Fl l
191Behave as a login shell.
192This flag currently has no effect and is for compatibility with other shells
193when using tmux as a login shell.
194.It Fl N
195Do not start the server even if the command would normally do so (for example
196.Ic new-session
197or
198.Ic start-server ) .
199.It Fl S Ar socket-path
200Specify a full alternative path to the server socket.
201If
202.Fl S
203is specified, the default socket directory is not used and any
204.Fl L
205flag is ignored.
206.It Fl T Ar features
207Set terminal features for the client.
208This is a comma-separated list of features.
209See the
210.Ic terminal-features
211option.
212.It Fl u
213Write UTF-8 output to the terminal even if the first environment
214variable of
215.Ev LC_ALL ,
216.Ev LC_CTYPE ,
217or
218.Ev LANG
219that is set does not contain
220.Qq UTF-8
221or
222.Qq UTF8 .
223.It Fl V
224Report the
225.Nm
226version.
227.It Fl v
228Request verbose logging.
229Log messages will be saved into
230.Pa tmux-client-PID.log
231and
232.Pa tmux-server-PID.log
233files in the current directory, where
234.Em PID
235is the PID of the server or client process.
236If
237.Fl v
238is specified twice, an additional
239.Pa tmux-out-PID.log
240file is generated with a copy of everything
241.Nm
242writes to the terminal.
243.Pp
244The
245.Dv SIGUSR2
246signal may be sent to the
247.Nm
248server process to toggle logging between on (as if
249.Fl v
250was given) and off.
251.It Ar command Op Ar flags
252This specifies one of a set of commands used to control
253.Nm ,
254as described in the following sections.
255If no commands are specified, the
256.Ic new-session
257command is assumed.
258.El
259.Sh DEFAULT KEY BINDINGS
260.Nm
261may be controlled from an attached client by using a key combination of a
262prefix key,
263.Ql C-b
264(Ctrl-b) by default, followed by a command key.
265.Pp
266The default command key bindings are:
267.Pp
268.Bl -tag -width "XXXXXXXXXX" -offset indent -compact
269.It C-b
270Send the prefix key (C-b) through to the application.
271.It C-o
272Rotate the panes in the current window forwards.
273.It C-z
274Suspend the
275.Nm
276client.
277.It !
278Break the current pane out of the window.
279.It \&"
280.\" "
281Split the current pane into two, top and bottom.
282.It #
283List all paste buffers.
284.It $
285Rename the current session.
286.It %
287Split the current pane into two, left and right.
288.It &
289Kill the current window.
290.It '
291Prompt for a window index to select.
292.It \&(
293Switch the attached client to the previous session.
294.It \&)
295Switch the attached client to the next session.
296.It ,
297Rename the current window.
298.It -
299Delete the most recently copied buffer of text.
300.It .
301Prompt for an index to move the current window.
302.It 0 to 9
303Select windows 0 to 9.
304.It :
305Enter the
306.Nm
307command prompt.
308.It ;
309Move to the previously active pane.
310.It =
311Choose which buffer to paste interactively from a list.
312.It \&?
313List all key bindings.
314.It D
315Choose a client to detach.
316.It L
317Switch the attached client back to the last session.
318.It \&[
319Enter copy mode to copy text or view the history.
320.It \&]
321Paste the most recently copied buffer of text.
322.It c
323Create a new window.
324.It d
325Detach the current client.
326.It f
327Prompt to search for text in open windows.
328.It i
329Display some information about the current window.
330.It l
331Move to the previously selected window.
332.It m
333Mark the current pane (see
334.Ic select-pane
335.Fl m ) .
336.It M
337Clear the marked pane.
338.It n
339Change to the next window.
340.It o
341Select the next pane in the current window.
342.It p
343Change to the previous window.
344.It q
345Briefly display pane indexes.
346.It r
347Force redraw of the attached client.
348.It s
349Select a new session for the attached client interactively.
350.It t
351Show the time.
352.It w
353Choose the current window interactively.
354.It x
355Kill the current pane.
356.It z
357Toggle zoom state of the current pane.
358.It {
359Swap the current pane with the previous pane.
360.It }
361Swap the current pane with the next pane.
362.It ~
363Show previous messages from
364.Nm ,
365if any.
366.It Page Up
367Enter copy mode and scroll one page up.
368.It Up, Down
369.It Left, Right
370Change to the pane above, below, to the left, or to the right of the current
371pane.
372.It M-1 to M-5
373Arrange panes in one of the five preset layouts: even-horizontal,
374even-vertical, main-horizontal, main-vertical, or tiled.
375.It Space
376Arrange the current window in the next preset layout.
377.It M-n
378Move to the next window with a bell or activity marker.
379.It M-o
380Rotate the panes in the current window backwards.
381.It M-p
382Move to the previous window with a bell or activity marker.
383.It C-Up, C-Down
384.It C-Left, C-Right
385Resize the current pane in steps of one cell.
386.It M-Up, M-Down
387.It M-Left, M-Right
388Resize the current pane in steps of five cells.
389.El
390.Pp
391Key bindings may be changed with the
392.Ic bind-key
393and
394.Ic unbind-key
395commands.
396.Sh COMMAND PARSING AND EXECUTION
397.Nm
398supports a large number of commands which can be used to control its
399behaviour.
400Each command is named and can accept zero or more flags and arguments.
401They may be bound to a key with the
402.Ic bind-key
403command or run from the shell prompt, a shell script, a configuration file or
404the command prompt.
405For example, the same
406.Ic set-option
407command run from the shell prompt, from
408.Pa ~/.tmux.conf
409and bound to a key may look like:
410.Bd -literal -offset indent
411$ tmux set-option -g status-style bg=cyan
412
413set-option -g status-style bg=cyan
414
415bind-key C set-option -g status-style bg=cyan
416.Ed
417.Pp
418Here, the command name is
419.Ql set-option ,
420.Ql Fl g
421is a flag and
422.Ql status-style
423and
424.Ql bg=cyan
425are arguments.
426.Pp
427.Nm
428distinguishes between command parsing and execution.
429In order to execute a command,
430.Nm
431needs it to be split up into its name and arguments.
432This is command parsing.
433If a command is run from the shell, the shell parses it; from inside
434.Nm
435or from a configuration file,
436.Nm
437does.
438Examples of when
439.Nm
440parses commands are:
441.Bl -dash -offset indent
442.It
443in a configuration file;
444.It
445typed at the command prompt (see
446.Ic command-prompt ) ;
447.It
448given to
449.Ic bind-key ;
450.It
451passed as arguments to
452.Ic if-shell
453or
454.Ic confirm-before .
455.El
456.Pp
457To execute commands, each client has a
458.Ql command queue .
459A global command queue not attached to any client is used on startup
460for configuration files like
461.Pa ~/.tmux.conf .
462Parsed commands added to the queue are executed in order.
463Some commands, like
464.Ic if-shell
465and
466.Ic confirm-before ,
467parse their argument to create a new command which is inserted immediately
468after themselves.
469This means that arguments can be parsed twice or more - once when the parent command (such as
470.Ic if-shell )
471is parsed and again when it parses and executes its command.
472Commands like
473.Ic if-shell ,
474.Ic run-shell
475and
476.Ic display-panes
477stop execution of subsequent commands on the queue until something happens -
478.Ic if-shell
479and
480.Ic run-shell
481until a shell command finishes and
482.Ic display-panes
483until a key is pressed.
484For example, the following commands:
485.Bd -literal -offset indent
486new-session; new-window
487if-shell "true" "split-window"
488kill-session
489.Ed
490.Pp
491Will execute
492.Ic new-session ,
493.Ic new-window ,
494.Ic if-shell ,
495the shell command
496.Xr true 1 ,
497.Ic split-window
498and
499.Ic kill-session
500in that order.
501.Pp
502The
503.Sx COMMANDS
504section lists the
505.Nm
506commands and their arguments.
507.Sh PARSING SYNTAX
508This section describes the syntax of commands parsed by
509.Nm ,
510for example in a configuration file or at the command prompt.
511Note that when commands are entered into the shell, they are parsed by the shell
512- see for example
513.Xr ksh 1
514or
515.Xr csh 1 .
516.Pp
517Each command is terminated by a newline or a semicolon (;).
518Commands separated by semicolons together form a
519.Ql command sequence
520- if a command in the sequence encounters an error, no subsequent commands are
521executed.
522.Pp
523It is recommended that a semicolon used as a command separator should be
524written as an individual token, for example from
525.Xr sh 1 :
526.Bd -literal -offset indent
527$ tmux neww \\; splitw
528.Ed
529.Pp
530Or:
531.Bd -literal -offset indent
532$ tmux neww ';' splitw
533.Ed
534.Pp
535Or from the tmux command prompt:
536.Bd -literal -offset indent
537neww ; splitw
538.Ed
539.Pp
540However, a trailing semicolon is also interpreted as a command separator,
541for example in these
542.Xr sh 1
543commands:
544.Bd -literal -offset indent
545$ tmux neww\e\e; splitw
546.Ed
547.Pp
548Or:
549.Bd -literal -offset indent
550$ tmux 'neww;' splitw
551.Ed
552.Pp
553As in these examples, when running tmux from the shell extra care must be taken
554to properly quote semicolons:
555.Bl -enum -offset Ds
556.It
557Semicolons that should be interpreted as a command separator
558should be escaped according to the shell conventions.
559For
560.Xr sh 1
561this typically means quoted (such as
562.Ql neww ';' splitw )
563or escaped (such as
564.Ql neww \e\e\e\e; splitw ) .
565.It
566Individual semicolons or trailing semicolons that should be interpreted as
567arguments should be escaped twice: once according to the shell conventions and
568a second time for
569.Nm ;
570for example:
571.Bd -literal -offset indent
572$ tmux neww 'foo\e\e;' bar
573$ tmux neww foo\e\e\e\e; bar
574.Ed
575.It
576Semicolons that are not individual tokens or trailing another token should only
577be escaped once according to shell conventions; for example:
578.Bd -literal -offset indent
579$ tmux neww 'foo-;-bar'
580$ tmux neww foo-\e\e;-bar
581.Ed
582.El
583.Pp
584Comments are marked by the unquoted # character - any remaining text after a
585comment is ignored until the end of the line.
586.Pp
587If the last character of a line is \e, the line is joined with the following
588line (the \e and the newline are completely removed).
589This is called line continuation and applies both inside and outside quoted
590strings and in comments, but not inside braces.
591.Pp
592Command arguments may be specified as strings surrounded by single (') quotes,
593double quotes (") or braces ({}).
594.\" "
595This is required when the argument contains any special character.
596Single and double quoted strings cannot span multiple lines except with line
597continuation.
598Braces can span multiple lines.
599.Pp
600Outside of quotes and inside double quotes, these replacements are performed:
601.Bl -dash -offset indent
602.It
603Environment variables preceded by $ are replaced with their value from the
604global environment (see the
605.Sx GLOBAL AND SESSION ENVIRONMENT
606section).
607.It
608A leading ~ or ~user is expanded to the home directory of the current or
609specified user.
610.It
611\euXXXX or \euXXXXXXXX is replaced by the Unicode codepoint corresponding to
612the given four or eight digit hexadecimal number.
613.It
614When preceded (escaped) by a \e, the following characters are replaced: \ee by
615the escape character; \er by a carriage return; \en by a newline; and \et by a
616tab.
617.It
618\eooo is replaced by a character of the octal value ooo.
619Three octal digits are required, for example \e001.
620The largest valid character is \e377.
621.It
622Any other characters preceded by \e are replaced by themselves (that is, the \e
623is removed) and are not treated as having any special meaning - so for example
624\e; will not mark a command sequence and \e$ will not expand an environment
625variable.
626.El
627.Pp
628Braces are parsed as a configuration file (so conditions such as
629.Ql %if
630are processed) and then converted into a string.
631They are designed to avoid the need for additional escaping when passing a
632group of
633.Nm
634commands as an argument (for example to
635.Ic if-shell ) .
636These two examples produce an identical command - note that no escaping is
637needed when using {}:
638.Bd -literal -offset indent
639if-shell true {
640    display -p 'brace-dollar-foo: }$foo'
641}
642
643if-shell true "display -p 'brace-dollar-foo: }\e$foo'"
644.Ed
645.Pp
646Braces may be enclosed inside braces, for example:
647.Bd -literal -offset indent
648bind x if-shell "true" {
649    if-shell "true" {
650        display "true!"
651    }
652}
653.Ed
654.Pp
655Environment variables may be set by using the syntax
656.Ql name=value ,
657for example
658.Ql HOME=/home/user .
659Variables set during parsing are added to the global environment.
660A hidden variable may be set with
661.Ql %hidden ,
662for example:
663.Bd -literal -offset indent
664%hidden MYVAR=42
665.Ed
666.Pp
667Hidden variables are not passed to the environment of processes created
668by tmux.
669See the
670.Sx GLOBAL AND SESSION ENVIRONMENT
671section.
672.Pp
673Commands may be parsed conditionally by surrounding them with
674.Ql %if ,
675.Ql %elif ,
676.Ql %else
677and
678.Ql %endif .
679The argument to
680.Ql %if
681and
682.Ql %elif
683is expanded as a format (see
684.Sx FORMATS )
685and if it evaluates to false (zero or empty), subsequent text is ignored until
686the closing
687.Ql %elif ,
688.Ql %else
689or
690.Ql %endif .
691For example:
692.Bd -literal -offset indent
693%if "#{==:#{host},myhost}"
694set -g status-style bg=red
695%elif "#{==:#{host},myotherhost}"
696set -g status-style bg=green
697%else
698set -g status-style bg=blue
699%endif
700.Ed
701.Pp
702Will change the status line to red if running on
703.Ql myhost ,
704green if running on
705.Ql myotherhost ,
706or blue if running on another host.
707Conditionals may be given on one line, for example:
708.Bd -literal -offset indent
709%if #{==:#{host},myhost} set -g status-style bg=red %endif
710.Ed
711.Sh COMMANDS
712This section describes the commands supported by
713.Nm .
714Most commands accept the optional
715.Fl t
716(and sometimes
717.Fl s )
718argument with one of
719.Ar target-client ,
720.Ar target-session ,
721.Ar target-window ,
722or
723.Ar target-pane .
724These specify the client, session, window or pane which a command should affect.
725.Pp
726.Ar target-client
727should be the name of the client,
728typically the
729.Xr pty 4
730file to which the client is connected, for example either of
731.Pa /dev/ttyp1
732or
733.Pa ttyp1
734for the client attached to
735.Pa /dev/ttyp1 .
736If no client is specified,
737.Nm
738attempts to work out the client currently in use; if that fails, an error is
739reported.
740Clients may be listed with the
741.Ic list-clients
742command.
743.Pp
744.Ar target-session
745is tried as, in order:
746.Bl -enum -offset Ds
747.It
748A session ID prefixed with a $.
749.It
750An exact name of a session (as listed by the
751.Ic list-sessions
752command).
753.It
754The start of a session name, for example
755.Ql mysess
756would match a session named
757.Ql mysession .
758.It
759An
760.Xr fnmatch 3
761pattern which is matched against the session name.
762.El
763.Pp
764If the session name is prefixed with an
765.Ql = ,
766only an exact match is accepted (so
767.Ql =mysess
768will only match exactly
769.Ql mysess ,
770not
771.Ql mysession ) .
772.Pp
773If a single session is found, it is used as the target session; multiple matches
774produce an error.
775If a session is omitted, the current session is used if available; if no
776current session is available, the most recently used is chosen.
777.Pp
778.Ar target-window
779(or
780.Ar src-window
781or
782.Ar dst-window )
783specifies a window in the form
784.Em session Ns \&: Ns Em window .
785.Em session
786follows the same rules as for
787.Ar target-session ,
788and
789.Em window
790is looked for in order as:
791.Bl -enum -offset Ds
792.It
793A special token, listed below.
794.It
795A window index, for example
796.Ql mysession:1
797is window 1 in session
798.Ql mysession .
799.It
800A window ID, such as @1.
801.It
802An exact window name, such as
803.Ql mysession:mywindow .
804.It
805The start of a window name, such as
806.Ql mysession:mywin .
807.It
808As an
809.Xr fnmatch 3
810pattern matched against the window name.
811.El
812.Pp
813Like sessions, a
814.Ql =
815prefix will do an exact match only.
816An empty window name specifies the next unused index if appropriate (for
817example the
818.Ic new-window
819and
820.Ic link-window
821commands)
822otherwise the current window in
823.Em session
824is chosen.
825.Pp
826The following special tokens are available to indicate particular windows.
827Each has a single-character alternative form.
828.Bl -column "XXXXXXXXXX" "X"
829.It Sy "Token" Ta Sy "" Ta Sy "Meaning"
830.It Li "{start}" Ta "^" Ta "The lowest-numbered window"
831.It Li "{end}" Ta "$" Ta "The highest-numbered window"
832.It Li "{last}" Ta "!" Ta "The last (previously current) window"
833.It Li "{next}" Ta "+" Ta "The next window by number"
834.It Li "{previous}" Ta "-" Ta "The previous window by number"
835.El
836.Pp
837.Ar target-pane
838(or
839.Ar src-pane
840or
841.Ar dst-pane )
842may be a pane ID or takes a similar form to
843.Ar target-window
844but with the optional addition of a period followed by a pane index or pane ID,
845for example:
846.Ql mysession:mywindow.1 .
847If the pane index is omitted, the currently active pane in the specified
848window is used.
849The following special tokens are available for the pane index:
850.Bl -column "XXXXXXXXXXXXXX" "X"
851.It Sy "Token" Ta Sy "" Ta Sy "Meaning"
852.It Li "{last}" Ta "!" Ta "The last (previously active) pane"
853.It Li "{next}" Ta "+" Ta "The next pane by number"
854.It Li "{previous}" Ta "-" Ta "The previous pane by number"
855.It Li "{top}" Ta "" Ta "The top pane"
856.It Li "{bottom}" Ta "" Ta "The bottom pane"
857.It Li "{left}" Ta "" Ta "The leftmost pane"
858.It Li "{right}" Ta "" Ta "The rightmost pane"
859.It Li "{top-left}" Ta "" Ta "The top-left pane"
860.It Li "{top-right}" Ta "" Ta "The top-right pane"
861.It Li "{bottom-left}" Ta "" Ta "The bottom-left pane"
862.It Li "{bottom-right}" Ta "" Ta "The bottom-right pane"
863.It Li "{up-of}" Ta "" Ta "The pane above the active pane"
864.It Li "{down-of}" Ta "" Ta "The pane below the active pane"
865.It Li "{left-of}" Ta "" Ta "The pane to the left of the active pane"
866.It Li "{right-of}" Ta "" Ta "The pane to the right of the active pane"
867.El
868.Pp
869The tokens
870.Ql +
871and
872.Ql -
873may be followed by an offset, for example:
874.Bd -literal -offset indent
875select-window -t:+2
876.Ed
877.Pp
878In addition,
879.Em target-session ,
880.Em target-window
881or
882.Em target-pane
883may consist entirely of the token
884.Ql {mouse}
885(alternative form
886.Ql = )
887to specify the session, window or pane where the most recent mouse event occurred
888(see the
889.Sx MOUSE SUPPORT
890section)
891or
892.Ql {marked}
893(alternative form
894.Ql ~ )
895to specify the marked pane (see
896.Ic select-pane
897.Fl m ) .
898.Pp
899Sessions, window and panes are each numbered with a unique ID; session IDs are
900prefixed with a
901.Ql $ ,
902windows with a
903.Ql @ ,
904and panes with a
905.Ql % .
906These are unique and are unchanged for the life of the session, window or pane
907in the
908.Nm
909server.
910The pane ID is passed to the child process of the pane in the
911.Ev TMUX_PANE
912environment variable.
913IDs may be displayed using the
914.Ql session_id ,
915.Ql window_id ,
916or
917.Ql pane_id
918formats (see the
919.Sx FORMATS
920section) and the
921.Ic display-message ,
922.Ic list-sessions ,
923.Ic list-windows
924or
925.Ic list-panes
926commands.
927.Pp
928.Ar shell-command
929arguments are
930.Xr sh 1
931commands.
932This may be a single argument passed to the shell, for example:
933.Bd -literal -offset indent
934new-window 'vi ~/.tmux.conf'
935.Ed
936.Pp
937Will run:
938.Bd -literal -offset indent
939/bin/sh -c 'vi ~/.tmux.conf'
940.Ed
941.Pp
942Additionally, the
943.Ic new-window ,
944.Ic new-session ,
945.Ic split-window ,
946.Ic respawn-window
947and
948.Ic respawn-pane
949commands allow
950.Ar shell-command
951to be given as multiple arguments and executed directly (without
952.Ql sh -c ) .
953This can avoid issues with shell quoting.
954For example:
955.Bd -literal -offset indent
956$ tmux new-window vi ~/.tmux.conf
957.Ed
958.Pp
959Will run
960.Xr vi 1
961directly without invoking the shell.
962.Pp
963.Ar command
964.Op Ar argument ...
965refers to a
966.Nm
967command, either passed with the command and arguments separately, for example:
968.Bd -literal -offset indent
969bind-key F1 set-option status off
970.Ed
971.Pp
972Or passed as a single string argument in
973.Pa .tmux.conf ,
974for example:
975.Bd -literal -offset indent
976bind-key F1 { set-option status off }
977.Ed
978.Pp
979Example
980.Nm
981commands include:
982.Bd -literal -offset indent
983refresh-client -t/dev/ttyp2
984
985rename-session -tfirst newname
986
987set-option -wt:0 monitor-activity on
988
989new-window ; split-window -d
990
991bind-key R source-file ~/.tmux.conf \e; \e
992	display-message "source-file done"
993.Ed
994.Pp
995Or from
996.Xr sh 1 :
997.Bd -literal -offset indent
998$ tmux kill-window -t :1
999
1000$ tmux new-window \e; split-window -d
1001
1002$ tmux new-session -d 'vi ~/.tmux.conf' \e; split-window -d \e; attach
1003.Ed
1004.Sh CLIENTS AND SESSIONS
1005The
1006.Nm
1007server manages clients, sessions, windows and panes.
1008Clients are attached to sessions to interact with them, either
1009when they are created with the
1010.Ic new-session
1011command, or later with the
1012.Ic attach-session
1013command.
1014Each session has one or more windows
1015.Em linked
1016into it.
1017Windows may be linked to multiple sessions and are made up of one or
1018more panes,
1019each of which contains a pseudo terminal.
1020Commands for creating, linking and otherwise manipulating windows
1021are covered
1022in the
1023.Sx WINDOWS AND PANES
1024section.
1025.Pp
1026The following commands are available to manage clients and sessions:
1027.Bl -tag -width Ds
1028.Tg attach
1029.It Xo Ic attach-session
1030.Op Fl dErx
1031.Op Fl c Ar working-directory
1032.Op Fl f Ar flags
1033.Op Fl t Ar target-session
1034.Xc
1035.D1 Pq alias: Ic attach
1036If run from outside
1037.Nm ,
1038create a new client in the current terminal and attach it to
1039.Ar target-session .
1040If used from inside, switch the current client.
1041If
1042.Fl d
1043is specified, any other clients attached to the session are detached.
1044If
1045.Fl x
1046is given, send
1047.Dv SIGHUP
1048to the parent process of the client as well as
1049detaching the client, typically causing it to exit.
1050.Fl f
1051sets a comma-separated list of client flags.
1052The flags are:
1053.Bl -tag -width Ds
1054.It active-pane
1055the client has an independent active pane
1056.It ignore-size
1057the client does not affect the size of other clients
1058.It no-output
1059the client does not receive pane output in control mode
1060.It pause-after=seconds
1061output is paused once the pane is
1062.Ar seconds
1063behind in control mode
1064.It read-only
1065the client is read-only
1066.It wait-exit
1067wait for an empty line input before exiting in control mode
1068.El
1069.Pp
1070A leading
1071.Ql \&!
1072turns a flag off if the client is already attached.
1073.Fl r
1074is an alias for
1075.Fl f
1076.Ar read-only,ignore-size .
1077When a client is read-only, only keys bound to the
1078.Ic detach-client
1079or
1080.Ic switch-client
1081commands have any effect.
1082A client with the
1083.Ar active-pane
1084flag allows the active pane to be selected independently of the window's active
1085pane used by clients without the flag.
1086This only affects the cursor position and commands issued from the client;
1087other features such as hooks and styles continue to use the window's active
1088pane.
1089.Pp
1090If no server is started,
1091.Ic attach-session
1092will attempt to start it; this will fail unless sessions are created in the
1093configuration file.
1094.Pp
1095The
1096.Ar target-session
1097rules for
1098.Ic attach-session
1099are slightly adjusted: if
1100.Nm
1101needs to select the most recently used session, it will prefer the most
1102recently used
1103.Em unattached
1104session.
1105.Pp
1106.Fl c
1107will set the session working directory (used for new windows) to
1108.Ar working-directory .
1109.Pp
1110If
1111.Fl E
1112is used, the
1113.Ic update-environment
1114option will not be applied.
1115.Tg detach
1116.It Xo Ic detach-client
1117.Op Fl aP
1118.Op Fl E Ar shell-command
1119.Op Fl s Ar target-session
1120.Op Fl t Ar target-client
1121.Xc
1122.D1 Pq alias: Ic detach
1123Detach the current client if bound to a key, the client specified with
1124.Fl t ,
1125or all clients currently attached to the session specified by
1126.Fl s .
1127The
1128.Fl a
1129option kills all but the client given with
1130.Fl t .
1131If
1132.Fl P
1133is given, send
1134.Dv SIGHUP
1135to the parent process of the client, typically causing it
1136to exit.
1137With
1138.Fl E ,
1139run
1140.Ar shell-command
1141to replace the client.
1142.Tg has
1143.It Ic has-session Op Fl t Ar target-session
1144.D1 Pq alias: Ic has
1145Report an error and exit with 1 if the specified session does not exist.
1146If it does exist, exit with 0.
1147.It Ic kill-server
1148Kill the
1149.Nm
1150server and clients and destroy all sessions.
1151.It Xo Ic kill-session
1152.Op Fl aC
1153.Op Fl t Ar target-session
1154.Xc
1155Destroy the given session, closing any windows linked to it and no other
1156sessions, and detaching all clients attached to it.
1157If
1158.Fl a
1159is given, all sessions but the specified one is killed.
1160The
1161.Fl C
1162flag clears alerts (bell, activity, or silence) in all windows linked to the
1163session.
1164.Tg lsc
1165.It Xo Ic list-clients
1166.Op Fl F Ar format
1167.Op Fl t Ar target-session
1168.Xc
1169.D1 Pq alias: Ic lsc
1170List all clients attached to the server.
1171For the meaning of the
1172.Fl F
1173flag, see the
1174.Sx FORMATS
1175section.
1176If
1177.Ar target-session
1178is specified, list only clients connected to that session.
1179.Tg lscm
1180.It Xo Ic list-commands
1181.Op Fl F Ar format
1182.Op Ar command
1183.Xc
1184.D1 Pq alias: Ic lscm
1185List the syntax of
1186.Ar command
1187or - if omitted - of all commands supported by
1188.Nm .
1189.Tg ls
1190.It Xo Ic list-sessions
1191.Op Fl F Ar format
1192.Op Fl f Ar filter
1193.Xc
1194.D1 Pq alias: Ic ls
1195List all sessions managed by the server.
1196.Fl F
1197specifies the format of each line and
1198.Fl f
1199a filter.
1200Only sessions for which the filter is true are shown.
1201See the
1202.Sx FORMATS
1203section.
1204.Tg lockc
1205.It Ic lock-client Op Fl t Ar target-client
1206.D1 Pq alias: Ic lockc
1207Lock
1208.Ar target-client ,
1209see the
1210.Ic lock-server
1211command.
1212.Tg locks
1213.It Ic lock-session Op Fl t Ar target-session
1214.D1 Pq alias: Ic locks
1215Lock all clients attached to
1216.Ar target-session .
1217.Tg new
1218.It Xo Ic new-session
1219.Op Fl AdDEPX
1220.Op Fl c Ar start-directory
1221.Op Fl e Ar environment
1222.Op Fl f Ar flags
1223.Op Fl F Ar format
1224.Op Fl n Ar window-name
1225.Op Fl s Ar session-name
1226.Op Fl t Ar group-name
1227.Op Fl x Ar width
1228.Op Fl y Ar height
1229.Op Ar shell-command
1230.Xc
1231.D1 Pq alias: Ic new
1232Create a new session with name
1233.Ar session-name .
1234.Pp
1235The new session is attached to the current terminal unless
1236.Fl d
1237is given.
1238.Ar window-name
1239and
1240.Ar shell-command
1241are the name of and shell command to execute in the initial window.
1242With
1243.Fl d ,
1244the initial size comes from the global
1245.Ic default-size
1246option;
1247.Fl x
1248and
1249.Fl y
1250can be used to specify a different size.
1251.Ql -
1252uses the size of the current client if any.
1253If
1254.Fl x
1255or
1256.Fl y
1257is given, the
1258.Ic default-size
1259option is set for the session.
1260.Fl f
1261sets a comma-separated list of client flags (see
1262.Ic attach-session ) .
1263.Pp
1264If run from a terminal, any
1265.Xr termios 4
1266special characters are saved and used for new windows in the new session.
1267.Pp
1268The
1269.Fl A
1270flag makes
1271.Ic new-session
1272behave like
1273.Ic attach-session
1274if
1275.Ar session-name
1276already exists; in this case,
1277.Fl D
1278behaves like
1279.Fl d
1280to
1281.Ic attach-session ,
1282and
1283.Fl X
1284behaves like
1285.Fl x
1286to
1287.Ic attach-session .
1288.Pp
1289If
1290.Fl t
1291is given, it specifies a
1292.Ic session group .
1293Sessions in the same group share the same set of windows - new windows are
1294linked to all sessions in the group and any windows closed removed from all
1295sessions.
1296The current and previous window and any session options remain independent and
1297any session in a group may be killed without affecting the others.
1298The
1299.Ar group-name
1300argument may be:
1301.Bl -enum -width Ds
1302.It
1303the name of an existing group, in which case the new session is added to that
1304group;
1305.It
1306the name of an existing session - the new session is added to the same group
1307as that session, creating a new group if necessary;
1308.It
1309the name for a new group containing only the new session.
1310.El
1311.Pp
1312.Fl n
1313and
1314.Ar shell-command
1315are invalid if
1316.Fl t
1317is used.
1318.Pp
1319The
1320.Fl P
1321option prints information about the new session after it has been created.
1322By default, it uses the format
1323.Ql #{session_name}:\&
1324but a different format may be specified with
1325.Fl F .
1326.Pp
1327If
1328.Fl E
1329is used, the
1330.Ic update-environment
1331option will not be applied.
1332.Fl e
1333takes the form
1334.Ql VARIABLE=value
1335and sets an environment variable for the newly created session; it may be
1336specified multiple times.
1337.Tg refresh
1338.It Xo Ic refresh-client
1339.Op Fl cDLRSU
1340.Op Fl A Ar pane:state
1341.Op Fl B Ar name:what:format
1342.Op Fl C Ar size
1343.Op Fl f Ar flags
1344.Op Fl l Op Ar target-pane
1345.Op Fl t Ar target-client
1346.Op Ar adjustment
1347.Xc
1348.D1 Pq alias: Ic refresh
1349Refresh the current client if bound to a key, or a single client if one is given
1350with
1351.Fl t .
1352If
1353.Fl S
1354is specified, only update the client's status line.
1355.Pp
1356The
1357.Fl U ,
1358.Fl D ,
1359.Fl L
1360.Fl R ,
1361and
1362.Fl c
1363flags allow the visible portion of a window which is larger than the client
1364to be changed.
1365.Fl U
1366moves the visible part up by
1367.Ar adjustment
1368rows and
1369.Fl D
1370down,
1371.Fl L
1372left by
1373.Ar adjustment
1374columns and
1375.Fl R
1376right.
1377.Fl c
1378returns to tracking the cursor automatically.
1379If
1380.Ar adjustment
1381is omitted, 1 is used.
1382Note that the visible position is a property of the client not of the
1383window, changing the current window in the attached session will reset
1384it.
1385.Pp
1386.Fl C
1387sets the width and height of a control mode client or of a window for a
1388control mode client,
1389.Ar size
1390must be one of
1391.Ql widthxheight
1392or
1393.Ql window ID:widthxheight ,
1394for example
1395.Ql 80x24
1396or
1397.Ql @0:80x24 .
1398.Fl A
1399allows a control mode client to trigger actions on a pane.
1400The argument is a pane ID (with leading
1401.Ql % ) ,
1402a colon, then one of
1403.Ql on ,
1404.Ql off ,
1405.Ql continue
1406or
1407.Ql pause .
1408If
1409.Ql off ,
1410.Nm
1411will not send output from the pane to the client and if all clients have turned
1412the pane off, will stop reading from the pane.
1413If
1414.Ql continue ,
1415.Nm
1416will return to sending output to the pane if it was paused (manually or with the
1417.Ar pause-after
1418flag).
1419If
1420.Ql pause ,
1421.Nm
1422will pause the pane.
1423.Fl A
1424may be given multiple times for different panes.
1425.Pp
1426.Fl B
1427sets a subscription to a format for a control mode client.
1428The argument is split into three items by colons:
1429.Ar name
1430is a name for the subscription;
1431.Ar what
1432is a type of item to subscribe to;
1433.Ar format
1434is the format.
1435After a subscription is added, changes to the format are reported with the
1436.Ic %subscription-changed
1437notification, at most once a second.
1438If only the name is given, the subscription is removed.
1439.Ar what
1440may be empty to check the format only for the attached session, or one of:
1441a pane ID such as
1442.Ql %0 ;
1443.Ql %*
1444for all panes in the attached session;
1445a window ID such as
1446.Ql @0 ;
1447or
1448.Ql @*
1449for all windows in the attached session.
1450.Pp
1451.Fl f
1452sets a comma-separated list of client flags, see
1453.Ic attach-session .
1454.Pp
1455.Fl l
1456requests the clipboard from the client using the
1457.Xr xterm 1
1458escape sequence.
1459If
1460Ar target-pane
1461is given, the clipboard is sent (in encoded form), otherwise it is stored in a
1462new paste buffer.
1463.Pp
1464.Fl L ,
1465.Fl R ,
1466.Fl U
1467and
1468.Fl D
1469move the visible portion of the window left, right, up or down
1470by
1471.Ar adjustment ,
1472if the window is larger than the client.
1473.Fl c
1474resets so that the position follows the cursor.
1475See the
1476.Ic window-size
1477option.
1478.Tg rename
1479.It Xo Ic rename-session
1480.Op Fl t Ar target-session
1481.Ar new-name
1482.Xc
1483.D1 Pq alias: Ic rename
1484Rename the session to
1485.Ar new-name .
1486.It Xo Ic server-access
1487.Op Fl adlrw
1488.Op Ar user
1489.Xc
1490Change the access or read/write permission of
1491.Ar user .
1492The user running the
1493.Nm
1494server (its owner) and the root user cannot be changed and are always
1495permitted access.
1496.Pp
1497.Fl a
1498and
1499.Fl d
1500are used to give or revoke access for the specified user.
1501If the user is already attached, the
1502.Fl d
1503flag causes their clients to be detached.
1504.Pp
1505.Fl r
1506and
1507.Fl w
1508change the permissions for
1509.Ar user :
1510.Fl r
1511makes their clients read-only and
1512.Fl w
1513writable.
1514.Fl l
1515lists current access permissions.
1516.Pp
1517By default, the access list is empty and
1518.Nm
1519creates sockets with file system permissions preventing access by any user
1520other than the owner (and root).
1521These permissions must be changed manually.
1522Great care should be taken not to allow access to untrusted users even
1523read-only.
1524.Tg showmsgs
1525.It Xo Ic show-messages
1526.Op Fl JT
1527.Op Fl t Ar target-client
1528.Xc
1529.D1 Pq alias: Ic showmsgs
1530Show server messages or information.
1531Messages are stored, up to a maximum of the limit set by the
1532.Ar message-limit
1533server option.
1534.Fl J
1535and
1536.Fl T
1537show debugging information about jobs and terminals.
1538.Tg source
1539.It Xo Ic source-file
1540.Op Fl Fnqv
1541.Ar path ...
1542.Xc
1543.D1 Pq alias: Ic source
1544Execute commands from one or more files specified by
1545.Ar path
1546(which may be
1547.Xr glob 7
1548patterns).
1549If
1550.Fl F
1551is present, then
1552.Ar path
1553is expanded as a format.
1554If
1555.Fl q
1556is given, no error will be returned if
1557.Ar path
1558does not exist.
1559With
1560.Fl n ,
1561the file is parsed but no commands are executed.
1562.Fl v
1563shows the parsed commands and line numbers if possible.
1564.Tg start
1565.It Ic start-server
1566.D1 Pq alias: Ic start
1567Start the
1568.Nm
1569server, if not already running, without creating any sessions.
1570.Pp
1571Note that as by default the
1572.Nm
1573server will exit with no sessions, this is only useful if a session is created in
1574.Pa ~/.tmux.conf ,
1575.Ic exit-empty
1576is turned off, or another command is run as part of the same command sequence.
1577For example:
1578.Bd -literal -offset indent
1579$ tmux start \\; show -g
1580.Ed
1581.Tg suspendc
1582.It Xo Ic suspend-client
1583.Op Fl t Ar target-client
1584.Xc
1585.D1 Pq alias: Ic suspendc
1586Suspend a client by sending
1587.Dv SIGTSTP
1588(tty stop).
1589.Tg switchc
1590.It Xo Ic switch-client
1591.Op Fl ElnprZ
1592.Op Fl c Ar target-client
1593.Op Fl t Ar target-session
1594.Op Fl T Ar key-table
1595.Xc
1596.D1 Pq alias: Ic switchc
1597Switch the current session for client
1598.Ar target-client
1599to
1600.Ar target-session .
1601As a special case,
1602.Fl t
1603may refer to a pane (a target that contains
1604.Ql \&: ,
1605.Ql \&.
1606or
1607.Ql % ) ,
1608to change session, window and pane.
1609In that case,
1610.Fl Z
1611keeps the window zoomed if it was zoomed.
1612If
1613.Fl l ,
1614.Fl n
1615or
1616.Fl p
1617is used, the client is moved to the last, next or previous session
1618respectively.
1619.Fl r
1620toggles the client
1621.Ic read-only
1622and
1623.Ic ignore-size
1624flags (see the
1625.Ic attach-session
1626command).
1627.Pp
1628If
1629.Fl E
1630is used,
1631.Ic update-environment
1632option will not be applied.
1633.Pp
1634.Fl T
1635sets the client's key table; the next key from the client will be interpreted
1636from
1637.Ar key-table .
1638This may be used to configure multiple prefix keys, or to bind commands to
1639sequences of keys.
1640For example, to make typing
1641.Ql abc
1642run the
1643.Ic list-keys
1644command:
1645.Bd -literal -offset indent
1646bind-key -Ttable2 c list-keys
1647bind-key -Ttable1 b switch-client -Ttable2
1648bind-key -Troot   a switch-client -Ttable1
1649.Ed
1650.El
1651.Sh WINDOWS AND PANES
1652Each window displayed by
1653.Nm
1654may be split into one or more
1655.Em panes ;
1656each pane takes up a certain area of the display and is a separate terminal.
1657A window may be split into panes using the
1658.Ic split-window
1659command.
1660Windows may be split horizontally (with the
1661.Fl h
1662flag) or vertically.
1663Panes may be resized with the
1664.Ic resize-pane
1665command (bound to
1666.Ql C-Up ,
1667.Ql C-Down
1668.Ql C-Left
1669and
1670.Ql C-Right
1671by default), the current pane may be changed with the
1672.Ic select-pane
1673command and the
1674.Ic rotate-window
1675and
1676.Ic swap-pane
1677commands may be used to swap panes without changing their position.
1678Panes are numbered beginning from zero in the order they are created.
1679.Pp
1680By default, a
1681.Nm
1682pane permits direct access to the terminal contained in the pane.
1683A pane may also be put into one of several modes:
1684.Bl -dash -offset indent
1685.It
1686Copy mode, which permits a section of a window or its
1687history to be copied to a
1688.Em paste buffer
1689for later insertion into another window.
1690This mode is entered with the
1691.Ic copy-mode
1692command, bound to
1693.Ql \&[
1694by default.
1695Copied text can be pasted with the
1696.Ic paste-buffer
1697command, bound to
1698.Ql \&] .
1699.It
1700View mode, which is like copy mode but is entered when a command that produces
1701output, such as
1702.Ic list-keys ,
1703is executed from a key binding.
1704.It
1705Choose mode, which allows an item to be chosen from a list.
1706This may be a client, a session or window or pane, or a buffer.
1707This mode is entered with the
1708.Ic choose-buffer ,
1709.Ic choose-client
1710and
1711.Ic choose-tree
1712commands.
1713.El
1714.Pp
1715In copy mode an indicator is displayed in the top-right corner of the pane with
1716the current position and the number of lines in the history.
1717.Pp
1718Commands are sent to copy mode using the
1719.Fl X
1720flag to the
1721.Ic send-keys
1722command.
1723When a key is pressed, copy mode automatically uses one of two key tables,
1724depending on the
1725.Ic mode-keys
1726option:
1727.Ic copy-mode
1728for emacs, or
1729.Ic copy-mode-vi
1730for vi.
1731Key tables may be viewed with the
1732.Ic list-keys
1733command.
1734.Pp
1735The following commands are supported in copy mode:
1736.Bl -column "CommandXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
1737.It Sy "Command" Ta Sy "vi" Ta Sy "emacs"
1738.It Li "append-selection" Ta "" Ta ""
1739.It Li "append-selection-and-cancel" Ta "A" Ta ""
1740.It Li "back-to-indentation" Ta "^" Ta "M-m"
1741.It Li "begin-selection" Ta "Space" Ta "C-Space"
1742.It Li "bottom-line" Ta "L" Ta ""
1743.It Li "cancel" Ta "q" Ta "Escape"
1744.It Li "clear-selection" Ta "Escape" Ta "C-g"
1745.It Li "copy-end-of-line [<prefix>]" Ta "" Ta ""
1746.It Li "copy-end-of-line-and-cancel [<prefix>]" Ta "" Ta ""
1747.It Li "copy-pipe-end-of-line [<command>] [<prefix>]" Ta "" Ta ""
1748.It Li "copy-pipe-end-of-line-and-cancel [<command>] [<prefix>]" Ta "D" Ta "C-k"
1749.It Li "copy-line [<prefix>]" Ta "" Ta ""
1750.It Li "copy-line-and-cancel [<prefix>]" Ta "" Ta ""
1751.It Li "copy-pipe-line [<command>] [<prefix>]" Ta "" Ta ""
1752.It Li "copy-pipe-line-and-cancel [<command>] [<prefix>]" Ta "" Ta ""
1753.It Li "copy-pipe [<command>] [<prefix>]" Ta "" Ta ""
1754.It Li "copy-pipe-no-clear [<command>] [<prefix>]" Ta "" Ta ""
1755.It Li "copy-pipe-and-cancel [<command>] [<prefix>]" Ta "" Ta ""
1756.It Li "copy-selection [<prefix>]" Ta "" Ta ""
1757.It Li "copy-selection-no-clear [<prefix>]" Ta "" Ta ""
1758.It Li "copy-selection-and-cancel [<prefix>]" Ta "Enter" Ta "M-w"
1759.It Li "cursor-down" Ta "j" Ta "Down"
1760.It Li "cursor-down-and-cancel" Ta "" Ta ""
1761.It Li "cursor-left" Ta "h" Ta "Left"
1762.It Li "cursor-right" Ta "l" Ta "Right"
1763.It Li "cursor-up" Ta "k" Ta "Up"
1764.It Li "end-of-line" Ta "$" Ta "C-e"
1765.It Li "goto-line <line>" Ta ":" Ta "g"
1766.It Li "halfpage-down" Ta "C-d" Ta "M-Down"
1767.It Li "halfpage-down-and-cancel" Ta "" Ta ""
1768.It Li "halfpage-up" Ta "C-u" Ta "M-Up"
1769.It Li "history-bottom" Ta "G" Ta "M->"
1770.It Li "history-top" Ta "g" Ta "M-<"
1771.It Li "jump-again" Ta ";" Ta ";"
1772.It Li "jump-backward <to>" Ta "F" Ta "F"
1773.It Li "jump-forward <to>" Ta "f" Ta "f"
1774.It Li "jump-reverse" Ta "," Ta ","
1775.It Li "jump-to-backward <to>" Ta "T" Ta ""
1776.It Li "jump-to-forward <to>" Ta "t" Ta ""
1777.It Li "jump-to-mark" Ta "M-x" Ta "M-x"
1778.It Li "middle-line" Ta "M" Ta "M-r"
1779.It Li "next-matching-bracket" Ta "%" Ta "M-C-f"
1780.It Li "next-paragraph" Ta "}" Ta "M-}"
1781.It Li "next-space" Ta "W" Ta ""
1782.It Li "next-space-end" Ta "E" Ta ""
1783.It Li "next-word" Ta "w" Ta ""
1784.It Li "next-word-end" Ta "e" Ta "M-f"
1785.It Li "other-end" Ta "o" Ta ""
1786.It Li "page-down" Ta "C-f" Ta "PageDown"
1787.It Li "page-down-and-cancel" Ta "" Ta ""
1788.It Li "page-up" Ta "C-b" Ta "PageUp"
1789.It Li "pipe [<command>] [<prefix>]" Ta "" Ta ""
1790.It Li "pipe-no-clear [<command>] [<prefix>]" Ta "" Ta ""
1791.It Li "pipe-and-cancel [<command>] [<prefix>]" Ta "" Ta ""
1792.It Li "previous-matching-bracket" Ta "" Ta "M-C-b"
1793.It Li "previous-paragraph" Ta "{" Ta "M-{"
1794.It Li "previous-space" Ta "B" Ta ""
1795.It Li "previous-word" Ta "b" Ta "M-b"
1796.It Li "rectangle-on" Ta "" Ta ""
1797.It Li "rectangle-off" Ta "" Ta ""
1798.It Li "rectangle-toggle" Ta "v" Ta "R"
1799.It Li "refresh-from-pane" Ta "r" Ta "r"
1800.It Li "scroll-down" Ta "C-e" Ta "C-Down"
1801.It Li "scroll-down-and-cancel" Ta "" Ta ""
1802.It Li "scroll-up" Ta "C-y" Ta "C-Up"
1803.It Li "search-again" Ta "n" Ta "n"
1804.It Li "search-backward <for>" Ta "?" Ta ""
1805.It Li "search-backward-incremental <for>" Ta "" Ta "C-r"
1806.It Li "search-backward-text <for>" Ta "" Ta ""
1807.It Li "search-forward <for>" Ta "/" Ta ""
1808.It Li "search-forward-incremental <for>" Ta "" Ta "C-s"
1809.It Li "search-forward-text <for>" Ta "" Ta ""
1810.It Li "scroll-bottom" Ta "" Ta ""
1811.It Li "scroll-middle" Ta "z" Ta ""
1812.It Li "scroll-top" Ta "" Ta ""
1813.It Li "search-reverse" Ta "N" Ta "N"
1814.It Li "select-line" Ta "V" Ta ""
1815.It Li "select-word" Ta "" Ta ""
1816.It Li "set-mark" Ta "X" Ta "X"
1817.It Li "start-of-line" Ta "0" Ta "C-a"
1818.It Li "stop-selection" Ta "" Ta ""
1819.It Li "toggle-position" Ta "P" Ta "P"
1820.It Li "top-line" Ta "H" Ta "M-R"
1821.El
1822.Pp
1823The search commands come in several varieties:
1824.Ql search-forward
1825and
1826.Ql search-backward
1827search for a regular expression;
1828the
1829.Ql -text
1830variants search for a plain text string rather than a regular expression;
1831.Ql -incremental
1832perform an incremental search and expect to be used with the
1833.Fl i
1834flag to the
1835.Ic command-prompt
1836command.
1837.Ql search-again
1838repeats the last search and
1839.Ql search-reverse
1840does the same but reverses the direction (forward becomes backward and backward
1841becomes forward).
1842.Pp
1843Copy commands may take an optional buffer prefix argument which is used
1844to generate the buffer name (the default is
1845.Ql buffer
1846so buffers are named
1847.Ql buffer0 ,
1848.Ql buffer1
1849and so on).
1850Pipe commands take a command argument which is the command to which the
1851selected text is piped.
1852.Ql copy-pipe
1853variants also copy the selection.
1854The
1855.Ql -and-cancel
1856variants of some commands exit copy mode after they have completed (for copy
1857commands) or when the cursor reaches the bottom (for scrolling commands).
1858.Ql -no-clear
1859variants do not clear the selection.
1860.Pp
1861The next and previous word keys skip over whitespace and treat consecutive
1862runs of either word separators or other letters as words.
1863Word separators can be customized with the
1864.Em word-separators
1865session option.
1866Next word moves to the start of the next word, next word end to the end of the
1867next word and previous word to the start of the previous word.
1868The three next and previous space keys work similarly but use a space alone as
1869the word separator.
1870Setting
1871.Em word-separators
1872to the empty string makes next/previous word equivalent to next/previous space.
1873.Pp
1874The jump commands enable quick movement within a line.
1875For instance, typing
1876.Ql f
1877followed by
1878.Ql /
1879will move the cursor to the next
1880.Ql /
1881character on the current line.
1882A
1883.Ql \&;
1884will then jump to the next occurrence.
1885.Pp
1886Commands in copy mode may be prefaced by an optional repeat count.
1887With vi key bindings, a prefix is entered using the number keys; with
1888emacs, the Alt (meta) key and a number begins prefix entry.
1889.Pp
1890The synopsis for the
1891.Ic copy-mode
1892command is:
1893.Bl -tag -width Ds
1894.It Xo Ic copy-mode
1895.Op Fl eHMqu
1896.Op Fl s Ar src-pane
1897.Op Fl t Ar target-pane
1898.Xc
1899Enter copy mode.
1900The
1901.Fl u
1902option scrolls one page up.
1903.Fl M
1904begins a mouse drag (only valid if bound to a mouse key binding, see
1905.Sx MOUSE SUPPORT ) .
1906.Fl H
1907hides the position indicator in the top right.
1908.Fl q
1909cancels copy mode and any other modes.
1910.Fl s
1911copies from
1912.Ar src-pane
1913instead of
1914.Ar target-pane .
1915.Pp
1916.Fl e
1917specifies that scrolling to the bottom of the history (to the visible screen)
1918should exit copy mode.
1919While in copy mode, pressing a key other than those used for scrolling will
1920disable this behaviour.
1921This is intended to allow fast scrolling through a pane's history, for
1922example with:
1923.Bd -literal -offset indent
1924bind PageUp copy-mode -eu
1925.Ed
1926.El
1927.Pp
1928A number of preset arrangements of panes are available, these are called layouts.
1929These may be selected with the
1930.Ic select-layout
1931command or cycled with
1932.Ic next-layout
1933(bound to
1934.Ql Space
1935by default); once a layout is chosen, panes within it may be moved and resized
1936as normal.
1937.Pp
1938The following layouts are supported:
1939.Bl -tag -width Ds
1940.It Ic even-horizontal
1941Panes are spread out evenly from left to right across the window.
1942.It Ic even-vertical
1943Panes are spread evenly from top to bottom.
1944.It Ic main-horizontal
1945A large (main) pane is shown at the top of the window and the remaining panes
1946are spread from left to right in the leftover space at the bottom.
1947Use the
1948.Em main-pane-height
1949window option to specify the height of the top pane.
1950.It Ic main-vertical
1951Similar to
1952.Ic main-horizontal
1953but the large pane is placed on the left and the others spread from top to
1954bottom along the right.
1955See the
1956.Em main-pane-width
1957window option.
1958.It Ic tiled
1959Panes are spread out as evenly as possible over the window in both rows and
1960columns.
1961.El
1962.Pp
1963In addition,
1964.Ic select-layout
1965may be used to apply a previously used layout - the
1966.Ic list-windows
1967command displays the layout of each window in a form suitable for use with
1968.Ic select-layout .
1969For example:
1970.Bd -literal -offset indent
1971$ tmux list-windows
19720: ksh [159x48]
1973    layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
1974$ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
1975.Ed
1976.Pp
1977.Nm
1978automatically adjusts the size of the layout for the current window size.
1979Note that a layout cannot be applied to a window with more panes than that
1980from which the layout was originally defined.
1981.Pp
1982Commands related to windows and panes are as follows:
1983.Bl -tag -width Ds
1984.Tg breakp
1985.It Xo Ic break-pane
1986.Op Fl abdP
1987.Op Fl F Ar format
1988.Op Fl n Ar window-name
1989.Op Fl s Ar src-pane
1990.Op Fl t Ar dst-window
1991.Xc
1992.D1 Pq alias: Ic breakp
1993Break
1994.Ar src-pane
1995off from its containing window to make it the only pane in
1996.Ar dst-window .
1997With
1998.Fl a
1999or
2000.Fl b ,
2001the window is moved to the next index after or before (existing windows are
2002moved if necessary).
2003If
2004.Fl d
2005is given, the new window does not become the current window.
2006The
2007.Fl P
2008option prints information about the new window after it has been created.
2009By default, it uses the format
2010.Ql #{session_name}:#{window_index}.#{pane_index}
2011but a different format may be specified with
2012.Fl F .
2013.Tg capturep
2014.It Xo Ic capture-pane
2015.Op Fl aAepPqCJN
2016.Op Fl b Ar buffer-name
2017.Op Fl E Ar end-line
2018.Op Fl S Ar start-line
2019.Op Fl t Ar target-pane
2020.Xc
2021.D1 Pq alias: Ic capturep
2022Capture the contents of a pane.
2023If
2024.Fl p
2025is given, the output goes to stdout, otherwise to the buffer specified with
2026.Fl b
2027or a new buffer if omitted.
2028If
2029.Fl a
2030is given, the alternate screen is used, and the history is not accessible.
2031If no alternate screen exists, an error will be returned unless
2032.Fl q
2033is given.
2034If
2035.Fl e
2036is given, the output includes escape sequences for text and background
2037attributes.
2038.Fl C
2039also escapes non-printable characters as octal \exxx.
2040.Fl T
2041ignores trailing positions that do not contain a character.
2042.Fl N
2043preserves trailing spaces at each line's end and
2044.Fl J
2045preserves trailing spaces and joins any wrapped lines;
2046.Fl J
2047implies
2048.Fl T .
2049.Fl P
2050captures only any output that the pane has received that is the beginning of an
2051as-yet incomplete escape sequence.
2052.Pp
2053.Fl S
2054and
2055.Fl E
2056specify the starting and ending line numbers, zero is the first line of the
2057visible pane and negative numbers are lines in the history.
2058.Ql -
2059to
2060.Fl S
2061is the start of the history and to
2062.Fl E
2063the end of the visible pane.
2064The default is to capture only the visible contents of the pane.
2065.It Xo
2066.Ic choose-client
2067.Op Fl NrZ
2068.Op Fl F Ar format
2069.Op Fl f Ar filter
2070.Op Fl K Ar key-format
2071.Op Fl O Ar sort-order
2072.Op Fl t Ar target-pane
2073.Op Ar template
2074.Xc
2075Put a pane into client mode, allowing a client to be selected interactively from
2076a list.
2077Each client is shown on one line.
2078A shortcut key is shown on the left in brackets allowing for immediate choice,
2079or the list may be navigated and an item chosen or otherwise manipulated using
2080the keys below.
2081.Fl Z
2082zooms the pane.
2083The following keys may be used in client mode:
2084.Bl -column "Key" "Function" -offset indent
2085.It Sy "Key" Ta Sy "Function"
2086.It Li "Enter" Ta "Choose selected client"
2087.It Li "Up" Ta "Select previous client"
2088.It Li "Down" Ta "Select next client"
2089.It Li "C-s" Ta "Search by name"
2090.It Li "n" Ta "Repeat last search"
2091.It Li "t" Ta "Toggle if client is tagged"
2092.It Li "T" Ta "Tag no clients"
2093.It Li "C-t" Ta "Tag all clients"
2094.It Li "d" Ta "Detach selected client"
2095.It Li "D" Ta "Detach tagged clients"
2096.It Li "x" Ta "Detach and HUP selected client"
2097.It Li "X" Ta "Detach and HUP tagged clients"
2098.It Li "z" Ta "Suspend selected client"
2099.It Li "Z" Ta "Suspend tagged clients"
2100.It Li "f" Ta "Enter a format to filter items"
2101.It Li "O" Ta "Change sort field"
2102.It Li "r" Ta "Reverse sort order"
2103.It Li "v" Ta "Toggle preview"
2104.It Li "q" Ta "Exit mode"
2105.El
2106.Pp
2107After a client is chosen,
2108.Ql %%
2109is replaced by the client name in
2110.Ar template
2111and the result executed as a command.
2112If
2113.Ar template
2114is not given, "detach-client -t '%%'" is used.
2115.Pp
2116.Fl O
2117specifies the initial sort field: one of
2118.Ql name ,
2119.Ql size ,
2120.Ql creation
2121(time),
2122or
2123.Ql activity
2124(time).
2125.Fl r
2126reverses the sort order.
2127.Fl f
2128specifies an initial filter: the filter is a format - if it evaluates to zero,
2129the item in the list is not shown, otherwise it is shown.
2130If a filter would lead to an empty list, it is ignored.
2131.Fl F
2132specifies the format for each item in the list and
2133.Fl K
2134a format for each shortcut key; both are evaluated once for each line.
2135.Fl N
2136starts without the preview.
2137This command works only if at least one client is attached.
2138.It Xo
2139.Ic choose-tree
2140.Op Fl GNrswZ
2141.Op Fl F Ar format
2142.Op Fl f Ar filter
2143.Op Fl K Ar key-format
2144.Op Fl O Ar sort-order
2145.Op Fl t Ar target-pane
2146.Op Ar template
2147.Xc
2148Put a pane into tree mode, where a session, window or pane may be chosen
2149interactively from a tree.
2150Each session, window or pane is shown on one line.
2151A shortcut key is shown on the left in brackets allowing for immediate choice,
2152or the tree may be navigated and an item chosen or otherwise manipulated using
2153the keys below.
2154.Fl s
2155starts with sessions collapsed and
2156.Fl w
2157with windows collapsed.
2158.Fl Z
2159zooms the pane.
2160The following keys may be used in tree mode:
2161.Bl -column "Key" "Function" -offset indent
2162.It Sy "Key" Ta Sy "Function"
2163.It Li "Enter" Ta "Choose selected item"
2164.It Li "Up" Ta "Select previous item"
2165.It Li "Down" Ta "Select next item"
2166.It Li "+" Ta "Expand selected item"
2167.It Li "-" Ta "Collapse selected item"
2168.It Li "M-+" Ta "Expand all items"
2169.It Li "M--" Ta "Collapse all items"
2170.It Li "x" Ta "Kill selected item"
2171.It Li "X" Ta "Kill tagged items"
2172.It Li "<" Ta "Scroll list of previews left"
2173.It Li ">" Ta "Scroll list of previews right"
2174.It Li "C-s" Ta "Search by name"
2175.It Li "m" Ta "Set the marked pane"
2176.It Li "M" Ta "Clear the marked pane"
2177.It Li "n" Ta "Repeat last search"
2178.It Li "t" Ta "Toggle if item is tagged"
2179.It Li "T" Ta "Tag no items"
2180.It Li "C-t" Ta "Tag all items"
2181.It Li "\&:" Ta "Run a command for each tagged item"
2182.It Li "f" Ta "Enter a format to filter items"
2183.It Li "H" Ta "Jump to the starting pane"
2184.It Li "O" Ta "Change sort field"
2185.It Li "r" Ta "Reverse sort order"
2186.It Li "v" Ta "Toggle preview"
2187.It Li "q" Ta "Exit mode"
2188.El
2189.Pp
2190After a session, window or pane is chosen, the first instance of
2191.Ql %%
2192and all instances of
2193.Ql %1
2194are replaced by the target in
2195.Ar template
2196and the result executed as a command.
2197If
2198.Ar template
2199is not given, "switch-client -t '%%'" is used.
2200.Pp
2201.Fl O
2202specifies the initial sort field: one of
2203.Ql index ,
2204.Ql name ,
2205or
2206.Ql time
2207(activity).
2208.Fl r
2209reverses the sort order.
2210.Fl f
2211specifies an initial filter: the filter is a format - if it evaluates to zero,
2212the item in the list is not shown, otherwise it is shown.
2213If a filter would lead to an empty list, it is ignored.
2214.Fl F
2215specifies the format for each item in the tree and
2216.Fl K
2217a format for each shortcut key; both are evaluated once for each line.
2218.Fl N
2219starts without the preview.
2220.Fl G
2221includes all sessions in any session groups in the tree rather than only the
2222first.
2223This command works only if at least one client is attached.
2224.It Xo
2225.Ic customize-mode
2226.Op Fl NZ
2227.Op Fl F Ar format
2228.Op Fl f Ar filter
2229.Op Fl t Ar target-pane
2230.Op Ar template
2231.Xc
2232Put a pane into customize mode, where options and key bindings may be browsed
2233and modified from a list.
2234Option values in the list are shown for the active pane in the current window.
2235.Fl Z
2236zooms the pane.
2237The following keys may be used in customize mode:
2238.Bl -column "Key" "Function" -offset indent
2239.It Sy "Key" Ta Sy "Function"
2240.It Li "Enter" Ta "Set pane, window, session or global option value"
2241.It Li "Up" Ta "Select previous item"
2242.It Li "Down" Ta "Select next item"
2243.It Li "+" Ta "Expand selected item"
2244.It Li "-" Ta "Collapse selected item"
2245.It Li "M-+" Ta "Expand all items"
2246.It Li "M--" Ta "Collapse all items"
2247.It Li "s" Ta "Set option value or key attribute"
2248.It Li "S" Ta "Set global option value"
2249.It Li "w" Ta "Set window option value, if option is for pane and window"
2250.It Li "d" Ta "Set an option or key to the default"
2251.It Li "D" Ta "Set tagged options and tagged keys to the default"
2252.It Li "u" Ta "Unset an option (set to default value if global) or unbind a key"
2253.It Li "U" Ta "Unset tagged options and unbind tagged keys"
2254.It Li "C-s" Ta "Search by name"
2255.It Li "n" Ta "Repeat last search"
2256.It Li "t" Ta "Toggle if item is tagged"
2257.It Li "T" Ta "Tag no items"
2258.It Li "C-t" Ta "Tag all items"
2259.It Li "f" Ta "Enter a format to filter items"
2260.It Li "v" Ta "Toggle option information"
2261.It Li "q" Ta "Exit mode"
2262.El
2263.Pp
2264.Fl f
2265specifies an initial filter: the filter is a format - if it evaluates to zero,
2266the item in the list is not shown, otherwise it is shown.
2267If a filter would lead to an empty list, it is ignored.
2268.Fl F
2269specifies the format for each item in the tree.
2270.Fl N
2271starts without the option information.
2272This command works only if at least one client is attached.
2273.It Xo
2274.Tg displayp
2275.Ic display-panes
2276.Op Fl bN
2277.Op Fl d Ar duration
2278.Op Fl t Ar target-client
2279.Op Ar template
2280.Xc
2281.D1 Pq alias: Ic displayp
2282Display a visible indicator of each pane shown by
2283.Ar target-client .
2284See the
2285.Ic display-panes-colour
2286and
2287.Ic display-panes-active-colour
2288session options.
2289The indicator is closed when a key is pressed (unless
2290.Fl N
2291is given) or
2292.Ar duration
2293milliseconds have passed.
2294If
2295.Fl d
2296is not given,
2297.Ic display-panes-time
2298is used.
2299A duration of zero means the indicator stays until a key is pressed.
2300While the indicator is on screen, a pane may be chosen with the
2301.Ql 0
2302to
2303.Ql 9
2304keys, which will cause
2305.Ar template
2306to be executed as a command with
2307.Ql %%
2308substituted by the pane ID.
2309The default
2310.Ar template
2311is "select-pane -t '%%'".
2312With
2313.Fl b ,
2314other commands are not blocked from running until the indicator is closed.
2315.Tg findw
2316.It Xo Ic find-window
2317.Op Fl iCNrTZ
2318.Op Fl t Ar target-pane
2319.Ar match-string
2320.Xc
2321.D1 Pq alias: Ic findw
2322Search for a
2323.Xr fnmatch 3
2324pattern or, with
2325.Fl r ,
2326regular expression
2327.Ar match-string
2328in window names, titles, and visible content (but not history).
2329The flags control matching behavior:
2330.Fl C
2331matches only visible window contents,
2332.Fl N
2333matches only the window name and
2334.Fl T
2335matches only the window title.
2336.Fl i
2337makes the search ignore case.
2338The default is
2339.Fl CNT .
2340.Fl Z
2341zooms the pane.
2342.Pp
2343This command works only if at least one client is attached.
2344.Tg joinp
2345.It Xo Ic join-pane
2346.Op Fl bdfhv
2347.Op Fl l Ar size
2348.Op Fl s Ar src-pane
2349.Op Fl t Ar dst-pane
2350.Xc
2351.D1 Pq alias: Ic joinp
2352Like
2353.Ic split-window ,
2354but instead of splitting
2355.Ar dst-pane
2356and creating a new pane, split it and move
2357.Ar src-pane
2358into the space.
2359This can be used to reverse
2360.Ic break-pane .
2361The
2362.Fl b
2363option causes
2364.Ar src-pane
2365to be joined to left of or above
2366.Ar dst-pane .
2367.Pp
2368If
2369.Fl s
2370is omitted and a marked pane is present (see
2371.Ic select-pane
2372.Fl m ) ,
2373the marked pane is used rather than the current pane.
2374.Tg killp
2375.It Xo Ic kill-pane
2376.Op Fl a
2377.Op Fl t Ar target-pane
2378.Xc
2379.D1 Pq alias: Ic killp
2380Destroy the given pane.
2381If no panes remain in the containing window, it is also destroyed.
2382The
2383.Fl a
2384option kills all but the pane given with
2385.Fl t .
2386.Tg killw
2387.It Xo Ic kill-window
2388.Op Fl a
2389.Op Fl t Ar target-window
2390.Xc
2391.D1 Pq alias: Ic killw
2392Kill the current window or the window at
2393.Ar target-window ,
2394removing it from any sessions to which it is linked.
2395The
2396.Fl a
2397option kills all but the window given with
2398.Fl t .
2399.Tg lastp
2400.It Xo Ic last-pane
2401.Op Fl deZ
2402.Op Fl t Ar target-window
2403.Xc
2404.D1 Pq alias: Ic lastp
2405Select the last (previously selected) pane.
2406.Fl Z
2407keeps the window zoomed if it was zoomed.
2408.Fl e
2409enables or
2410.Fl d
2411disables input to the pane.
2412.Tg last
2413.It Ic last-window Op Fl t Ar target-session
2414.D1 Pq alias: Ic last
2415Select the last (previously selected) window.
2416If no
2417.Ar target-session
2418is specified, select the last window of the current session.
2419.Tg link
2420.It Xo Ic link-window
2421.Op Fl abdk
2422.Op Fl s Ar src-window
2423.Op Fl t Ar dst-window
2424.Xc
2425.D1 Pq alias: Ic linkw
2426Link the window at
2427.Ar src-window
2428to the specified
2429.Ar dst-window .
2430If
2431.Ar dst-window
2432is specified and no such window exists, the
2433.Ar src-window
2434is linked there.
2435With
2436.Fl a
2437or
2438.Fl b
2439the window is moved to the next index after or before
2440.Ar dst-window
2441(existing windows are moved if necessary).
2442If
2443.Fl k
2444is given and
2445.Ar dst-window
2446exists, it is killed, otherwise an error is generated.
2447If
2448.Fl d
2449is given, the newly linked window is not selected.
2450.Tg lsp
2451.It Xo Ic list-panes
2452.Op Fl as
2453.Op Fl F Ar format
2454.Op Fl f Ar filter
2455.Op Fl t Ar target
2456.Xc
2457.D1 Pq alias: Ic lsp
2458If
2459.Fl a
2460is given,
2461.Ar target
2462is ignored and all panes on the server are listed.
2463If
2464.Fl s
2465is given,
2466.Ar target
2467is a session (or the current session).
2468If neither is given,
2469.Ar target
2470is a window (or the current window).
2471.Fl F
2472specifies the format of each line and
2473.Fl f
2474a filter.
2475Only panes for which the filter is true are shown.
2476See the
2477.Sx FORMATS
2478section.
2479.Tg lsw
2480.It Xo Ic list-windows
2481.Op Fl a
2482.Op Fl F Ar format
2483.Op Fl f Ar filter
2484.Op Fl t Ar target-session
2485.Xc
2486.D1 Pq alias: Ic lsw
2487If
2488.Fl a
2489is given, list all windows on the server.
2490Otherwise, list windows in the current session or in
2491.Ar target-session .
2492.Fl F
2493specifies the format of each line and
2494.Fl f
2495a filter.
2496Only windows for which the filter is true are shown.
2497See the
2498.Sx FORMATS
2499section.
2500.Tg movep
2501.It Xo Ic move-pane
2502.Op Fl bdfhv
2503.Op Fl l Ar size
2504.Op Fl s Ar src-pane
2505.Op Fl t Ar dst-pane
2506.Xc
2507.D1 Pq alias: Ic movep
2508Does the same as
2509.Ic join-pane .
2510.Tg movew
2511.It Xo Ic move-window
2512.Op Fl abrdk
2513.Op Fl s Ar src-window
2514.Op Fl t Ar dst-window
2515.Xc
2516.D1 Pq alias: Ic movew
2517This is similar to
2518.Ic link-window ,
2519except the window at
2520.Ar src-window
2521is moved to
2522.Ar dst-window .
2523With
2524.Fl r ,
2525all windows in the session are renumbered in sequential order, respecting
2526the
2527.Ic base-index
2528option.
2529.Tg neww
2530.It Xo Ic new-window
2531.Op Fl abdkPS
2532.Op Fl c Ar start-directory
2533.Op Fl e Ar environment
2534.Op Fl F Ar format
2535.Op Fl n Ar window-name
2536.Op Fl t Ar target-window
2537.Op Ar shell-command
2538.Xc
2539.D1 Pq alias: Ic neww
2540Create a new window.
2541With
2542.Fl a
2543or
2544.Fl b ,
2545the new window is inserted at the next index after or before the specified
2546.Ar target-window ,
2547moving windows up if necessary;
2548otherwise
2549.Ar target-window
2550is the new window location.
2551.Pp
2552If
2553.Fl d
2554is given, the session does not make the new window the current window.
2555.Ar target-window
2556represents the window to be created; if the target already exists an error is
2557shown, unless the
2558.Fl k
2559flag is used, in which case it is destroyed.
2560If
2561.Fl S
2562is given and a window named
2563.Ar window-name
2564already exists, it is selected (unless
2565.Fl d
2566is also given in which case the command does nothing).
2567.Pp
2568.Ar shell-command
2569is the command to execute.
2570If
2571.Ar shell-command
2572is not specified, the value of the
2573.Ic default-command
2574option is used.
2575.Fl c
2576specifies the working directory in which the new window is created.
2577.Pp
2578When the shell command completes, the window closes.
2579See the
2580.Ic remain-on-exit
2581option to change this behaviour.
2582.Pp
2583.Fl e
2584takes the form
2585.Ql VARIABLE=value
2586and sets an environment variable for the newly created window; it may be
2587specified multiple times.
2588.Pp
2589The
2590.Ev TERM
2591environment variable must be set to
2592.Ql screen
2593or
2594.Ql tmux
2595for all programs running
2596.Em inside
2597.Nm .
2598New windows will automatically have
2599.Ql TERM=screen
2600added to their environment, but care must be taken not to reset this in shell
2601start-up files or by the
2602.Fl e
2603option.
2604.Pp
2605The
2606.Fl P
2607option prints information about the new window after it has been created.
2608By default, it uses the format
2609.Ql #{session_name}:#{window_index}
2610but a different format may be specified with
2611.Fl F .
2612.Tg nextl
2613.It Ic next-layout Op Fl t Ar target-window
2614.D1 Pq alias: Ic nextl
2615Move a window to the next layout and rearrange the panes to fit.
2616.Tg next
2617.It Xo Ic next-window
2618.Op Fl a
2619.Op Fl t Ar target-session
2620.Xc
2621.D1 Pq alias: Ic next
2622Move to the next window in the session.
2623If
2624.Fl a
2625is used, move to the next window with an alert.
2626.Tg pipep
2627.It Xo Ic pipe-pane
2628.Op Fl IOo
2629.Op Fl t Ar target-pane
2630.Op Ar shell-command
2631.Xc
2632.D1 Pq alias: Ic pipep
2633Pipe output sent by the program in
2634.Ar target-pane
2635to a shell command or vice versa.
2636A pane may only be connected to one command at a time, any existing pipe is
2637closed before
2638.Ar shell-command
2639is executed.
2640The
2641.Ar shell-command
2642string may contain the special character sequences supported by the
2643.Ic status-left
2644option.
2645If no
2646.Ar shell-command
2647is given, the current pipe (if any) is closed.
2648.Pp
2649.Fl I
2650and
2651.Fl O
2652specify which of the
2653.Ar shell-command
2654output streams are connected to the pane:
2655with
2656.Fl I
2657stdout is connected (so anything
2658.Ar shell-command
2659prints is written to the pane as if it were typed);
2660with
2661.Fl O
2662stdin is connected (so any output in the pane is piped to
2663.Ar shell-command ) .
2664Both may be used together and if neither are specified,
2665.Fl O
2666is used.
2667.Pp
2668The
2669.Fl o
2670option only opens a new pipe if no previous pipe exists, allowing a pipe to
2671be toggled with a single key, for example:
2672.Bd -literal -offset indent
2673bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
2674.Ed
2675.Tg prevl
2676.It Xo Ic previous-layout
2677.Op Fl t Ar target-window
2678.Xc
2679.D1 Pq alias: Ic prevl
2680Move to the previous layout in the session.
2681.Tg prev
2682.It Xo Ic previous-window
2683.Op Fl a
2684.Op Fl t Ar target-session
2685.Xc
2686.D1 Pq alias: Ic prev
2687Move to the previous window in the session.
2688With
2689.Fl a ,
2690move to the previous window with an alert.
2691.Tg renamew
2692.It Xo Ic rename-window
2693.Op Fl t Ar target-window
2694.Ar new-name
2695.Xc
2696.D1 Pq alias: Ic renamew
2697Rename the current window, or the window at
2698.Ar target-window
2699if specified, to
2700.Ar new-name .
2701.Tg resizep
2702.It Xo Ic resize-pane
2703.Op Fl DLMRTUZ
2704.Op Fl t Ar target-pane
2705.Op Fl x Ar width
2706.Op Fl y Ar height
2707.Op Ar adjustment
2708.Xc
2709.D1 Pq alias: Ic resizep
2710Resize a pane, up, down, left or right by
2711.Ar adjustment
2712with
2713.Fl U ,
2714.Fl D ,
2715.Fl L
2716or
2717.Fl R ,
2718or
2719to an absolute size
2720with
2721.Fl x
2722or
2723.Fl y .
2724The
2725.Ar adjustment
2726is given in lines or columns (the default is 1);
2727.Fl x
2728and
2729.Fl y
2730may be a given as a number of lines or columns or followed by
2731.Ql %
2732for a percentage of the window size (for example
2733.Ql -x 10% ) .
2734With
2735.Fl Z ,
2736the active pane is toggled between zoomed (occupying the whole of the window)
2737and unzoomed (its normal position in the layout).
2738.Pp
2739.Fl M
2740begins mouse resizing (only valid if bound to a mouse key binding, see
2741.Sx MOUSE SUPPORT ) .
2742.Pp
2743.Fl T
2744trims all lines below the current cursor position and moves lines out of the
2745history to replace them.
2746.Tg resizew
2747.It Xo Ic resize-window
2748.Op Fl aADLRU
2749.Op Fl t Ar target-window
2750.Op Fl x Ar width
2751.Op Fl y Ar height
2752.Op Ar adjustment
2753.Xc
2754.D1 Pq alias: Ic resizew
2755Resize a window, up, down, left or right by
2756.Ar adjustment
2757with
2758.Fl U ,
2759.Fl D ,
2760.Fl L
2761or
2762.Fl R ,
2763or
2764to an absolute size
2765with
2766.Fl x
2767or
2768.Fl y .
2769The
2770.Ar adjustment
2771is given in lines or cells (the default is 1).
2772.Fl A
2773sets the size of the largest session containing the window;
2774.Fl a
2775the size of the smallest.
2776This command will automatically set
2777.Ic window-size
2778to manual in the window options.
2779.Tg respawnp
2780.It Xo Ic respawn-pane
2781.Op Fl k
2782.Op Fl c Ar start-directory
2783.Op Fl e Ar environment
2784.Op Fl t Ar target-pane
2785.Op Ar shell-command
2786.Xc
2787.D1 Pq alias: Ic respawnp
2788Reactivate a pane in which the command has exited (see the
2789.Ic remain-on-exit
2790window option).
2791If
2792.Ar shell-command
2793is not given, the command used when the pane was created or last respawned is
2794executed.
2795The pane must be already inactive, unless
2796.Fl k
2797is given, in which case any existing command is killed.
2798.Fl c
2799specifies a new working directory for the pane.
2800The
2801.Fl e
2802option has the same meaning as for the
2803.Ic new-window
2804command.
2805.Tg respawnw
2806.It Xo Ic respawn-window
2807.Op Fl k
2808.Op Fl c Ar start-directory
2809.Op Fl e Ar environment
2810.Op Fl t Ar target-window
2811.Op Ar shell-command
2812.Xc
2813.D1 Pq alias: Ic respawnw
2814Reactivate a window in which the command has exited (see the
2815.Ic remain-on-exit
2816window option).
2817If
2818.Ar shell-command
2819is not given, the command used when the window was created or last respawned is
2820executed.
2821The window must be already inactive, unless
2822.Fl k
2823is given, in which case any existing command is killed.
2824.Fl c
2825specifies a new working directory for the window.
2826The
2827.Fl e
2828option has the same meaning as for the
2829.Ic new-window
2830command.
2831.Tg rotatew
2832.It Xo Ic rotate-window
2833.Op Fl DUZ
2834.Op Fl t Ar target-window
2835.Xc
2836.D1 Pq alias: Ic rotatew
2837Rotate the positions of the panes within a window, either upward (numerically
2838lower) with
2839.Fl U
2840or downward (numerically higher).
2841.Fl Z
2842keeps the window zoomed if it was zoomed.
2843.Tg selectl
2844.It Xo Ic select-layout
2845.Op Fl Enop
2846.Op Fl t Ar target-pane
2847.Op Ar layout-name
2848.Xc
2849.D1 Pq alias: Ic selectl
2850Choose a specific layout for a window.
2851If
2852.Ar layout-name
2853is not given, the last preset layout used (if any) is reapplied.
2854.Fl n
2855and
2856.Fl p
2857are equivalent to the
2858.Ic next-layout
2859and
2860.Ic previous-layout
2861commands.
2862.Fl o
2863applies the last set layout if possible (undoes the most recent layout change).
2864.Fl E
2865spreads the current pane and any panes next to it out evenly.
2866.Tg selectp
2867.It Xo Ic select-pane
2868.Op Fl DdeLlMmRUZ
2869.Op Fl T Ar title
2870.Op Fl t Ar target-pane
2871.Xc
2872.D1 Pq alias: Ic selectp
2873Make pane
2874.Ar target-pane
2875the active pane in its window.
2876If one of
2877.Fl D ,
2878.Fl L ,
2879.Fl R ,
2880or
2881.Fl U
2882is used, respectively the pane below, to the left, to the right, or above the
2883target pane is used.
2884.Fl Z
2885keeps the window zoomed if it was zoomed.
2886.Fl l
2887is the same as using the
2888.Ic last-pane
2889command.
2890.Fl e
2891enables or
2892.Fl d
2893disables input to the pane.
2894.Fl T
2895sets the pane title.
2896.Pp
2897.Fl m
2898and
2899.Fl M
2900are used to set and clear the
2901.Em marked pane .
2902There is one marked pane at a time, setting a new marked pane clears the last.
2903The marked pane is the default target for
2904.Fl s
2905to
2906.Ic join-pane ,
2907.Ic move-pane ,
2908.Ic swap-pane
2909and
2910.Ic swap-window .
2911.Tg selectw
2912.It Xo Ic select-window
2913.Op Fl lnpT
2914.Op Fl t Ar target-window
2915.Xc
2916.D1 Pq alias: Ic selectw
2917Select the window at
2918.Ar target-window .
2919.Fl l ,
2920.Fl n
2921and
2922.Fl p
2923are equivalent to the
2924.Ic last-window ,
2925.Ic next-window
2926and
2927.Ic previous-window
2928commands.
2929If
2930.Fl T
2931is given and the selected window is already the current window,
2932the command behaves like
2933.Ic last-window .
2934.Tg splitw
2935.It Xo Ic split-window
2936.Op Fl bdfhIvPZ
2937.Op Fl c Ar start-directory
2938.Op Fl e Ar environment
2939.Op Fl l Ar size
2940.Op Fl t Ar target-pane
2941.Op Ar shell-command
2942.Op Fl F Ar format
2943.Xc
2944.D1 Pq alias: Ic splitw
2945Create a new pane by splitting
2946.Ar target-pane :
2947.Fl h
2948does a horizontal split and
2949.Fl v
2950a vertical split; if neither is specified,
2951.Fl v
2952is assumed.
2953The
2954.Fl l
2955option specifies the size of the new pane in lines (for vertical split) or in
2956columns (for horizontal split);
2957.Ar size
2958may be followed by
2959.Ql %
2960to specify a percentage of the available space.
2961The
2962.Fl b
2963option causes the new pane to be created to the left of or above
2964.Ar target-pane .
2965The
2966.Fl f
2967option creates a new pane spanning the full window height (with
2968.Fl h )
2969or full window width (with
2970.Fl v ) ,
2971instead of splitting the active pane.
2972.Fl Z
2973zooms if the window is not zoomed, or keeps it zoomed if already zoomed.
2974.Pp
2975An empty
2976.Ar shell-command
2977('') will create a pane with no command running in it.
2978Output can be sent to such a pane with the
2979.Ic display-message
2980command.
2981The
2982.Fl I
2983flag (if
2984.Ar shell-command
2985is not specified or empty)
2986will create an empty pane and forward any output from stdin to it.
2987For example:
2988.Bd -literal -offset indent
2989$ make 2>&1|tmux splitw -dI &
2990.Ed
2991.Pp
2992All other options have the same meaning as for the
2993.Ic new-window
2994command.
2995.Tg swapp
2996.It Xo Ic swap-pane
2997.Op Fl dDUZ
2998.Op Fl s Ar src-pane
2999.Op Fl t Ar dst-pane
3000.Xc
3001.D1 Pq alias: Ic swapp
3002Swap two panes.
3003If
3004.Fl U
3005is used and no source pane is specified with
3006.Fl s ,
3007.Ar dst-pane
3008is swapped with the previous pane (before it numerically);
3009.Fl D
3010swaps with the next pane (after it numerically).
3011.Fl d
3012instructs
3013.Nm
3014not to change the active pane and
3015.Fl Z
3016keeps the window zoomed if it was zoomed.
3017.Pp
3018If
3019.Fl s
3020is omitted and a marked pane is present (see
3021.Ic select-pane
3022.Fl m ) ,
3023the marked pane is used rather than the current pane.
3024.Tg swapw
3025.It Xo Ic swap-window
3026.Op Fl d
3027.Op Fl s Ar src-window
3028.Op Fl t Ar dst-window
3029.Xc
3030.D1 Pq alias: Ic swapw
3031This is similar to
3032.Ic link-window ,
3033except the source and destination windows are swapped.
3034It is an error if no window exists at
3035.Ar src-window .
3036If
3037.Fl d
3038is given, the new window does not become the current window.
3039.Pp
3040If
3041.Fl s
3042is omitted and a marked pane is present (see
3043.Ic select-pane
3044.Fl m ) ,
3045the window containing the marked pane is used rather than the current window.
3046.Tg unlinkw
3047.It Xo Ic unlink-window
3048.Op Fl k
3049.Op Fl t Ar target-window
3050.Xc
3051.D1 Pq alias: Ic unlinkw
3052Unlink
3053.Ar target-window .
3054Unless
3055.Fl k
3056is given, a window may be unlinked only if it is linked to multiple sessions -
3057windows may not be linked to no sessions;
3058if
3059.Fl k
3060is specified and the window is linked to only one session, it is unlinked and
3061destroyed.
3062.El
3063.Sh KEY BINDINGS
3064.Nm
3065allows a command to be bound to most keys, with or without a prefix key.
3066When specifying keys, most represent themselves (for example
3067.Ql A
3068to
3069.Ql Z ) .
3070Ctrl keys may be prefixed with
3071.Ql C-
3072or
3073.Ql ^ ,
3074Shift keys with
3075.Ql S-
3076and Alt (meta) with
3077.Ql M- .
3078In addition, the following special key names are accepted:
3079.Em Up ,
3080.Em Down ,
3081.Em Left ,
3082.Em Right ,
3083.Em BSpace ,
3084.Em BTab ,
3085.Em DC
3086(Delete),
3087.Em End ,
3088.Em Enter ,
3089.Em Escape ,
3090.Em F1
3091to
3092.Em F12 ,
3093.Em Home ,
3094.Em IC
3095(Insert),
3096.Em NPage/PageDown/PgDn ,
3097.Em PPage/PageUp/PgUp ,
3098.Em Space ,
3099and
3100.Em Tab .
3101Note that to bind the
3102.Ql \&"
3103or
3104.Ql '
3105keys, quotation marks are necessary, for example:
3106.Bd -literal -offset indent
3107bind-key '"' split-window
3108bind-key "'" new-window
3109.Ed
3110.Pp
3111A command bound to the
3112.Em Any
3113key will execute for all keys which do not have a more specific binding.
3114.Pp
3115Commands related to key bindings are as follows:
3116.Bl -tag -width Ds
3117.Tg bind
3118.It Xo Ic bind-key
3119.Op Fl nr
3120.Op Fl N Ar note
3121.Op Fl T Ar key-table
3122.Ar key command Op Ar argument ...
3123.Xc
3124.D1 Pq alias: Ic bind
3125Bind key
3126.Ar key
3127to
3128.Ar command .
3129Keys are bound in a key table.
3130By default (without -T), the key is bound in
3131the
3132.Em prefix
3133key table.
3134This table is used for keys pressed after the prefix key (for example,
3135by default
3136.Ql c
3137is bound to
3138.Ic new-window
3139in the
3140.Em prefix
3141table, so
3142.Ql C-b c
3143creates a new window).
3144The
3145.Em root
3146table is used for keys pressed without the prefix key: binding
3147.Ql c
3148to
3149.Ic new-window
3150in the
3151.Em root
3152table (not recommended) means a plain
3153.Ql c
3154will create a new window.
3155.Fl n
3156is an alias
3157for
3158.Fl T Ar root .
3159Keys may also be bound in custom key tables and the
3160.Ic switch-client
3161.Fl T
3162command used to switch to them from a key binding.
3163The
3164.Fl r
3165flag indicates this key may repeat, see the
3166.Ic repeat-time
3167option.
3168.Fl N
3169attaches a note to the key (shown with
3170.Ic list-keys
3171.Fl N ) .
3172.Pp
3173To view the default bindings and possible commands, see the
3174.Ic list-keys
3175command.
3176.Tg lsk
3177.It Xo Ic list-keys
3178.Op Fl 1aN
3179.Op Fl P Ar prefix-string Fl T Ar key-table
3180.Op Ar key
3181.Xc
3182.D1 Pq alias: Ic lsk
3183List key bindings.
3184There are two forms: the default lists keys as
3185.Ic bind-key
3186commands;
3187.Fl N
3188lists only keys with attached notes and shows only the key and note for each
3189key.
3190.Pp
3191With the default form, all key tables are listed by default.
3192.Fl T
3193lists only keys in
3194.Ar key-table .
3195.Pp
3196With the
3197.Fl N
3198form, only keys in the
3199.Em root
3200and
3201.Em prefix
3202key tables are listed by default;
3203.Fl T
3204also lists only keys in
3205.Ar key-table .
3206.Fl P
3207specifies a prefix to print before each key and
3208.Fl 1
3209lists only the first matching key.
3210.Fl a
3211lists the command for keys that do not have a note rather than skipping them.
3212.Tg send
3213.It Xo Ic send-keys
3214.Op Fl FHKlMRX
3215.Op Fl c Ar target-client
3216.Op Fl N Ar repeat-count
3217.Op Fl t Ar target-pane
3218.Ar key ...
3219.Xc
3220.D1 Pq alias: Ic send
3221Send a key or keys to a window or client.
3222Each argument
3223.Ar key
3224is the name of the key (such as
3225.Ql C-a
3226or
3227.Ql NPage )
3228to send; if the string is not recognised as a key, it is sent as a series of
3229characters.
3230If
3231.Fl K
3232is given, keys are sent to
3233.Ar target-client ,
3234so they are looked up in the client's key table, rather than to
3235.Ar target-pane .
3236All arguments are sent sequentially from first to last.
3237If no keys are given and the command is bound to a key, then that key is used.
3238.Pp
3239The
3240.Fl l
3241flag disables key name lookup and processes the keys as literal UTF-8
3242characters.
3243The
3244.Fl H
3245flag expects each key to be a hexadecimal number for an ASCII character.
3246.Pp
3247The
3248.Fl R
3249flag causes the terminal state to be reset.
3250.Pp
3251.Fl M
3252passes through a mouse event (only valid if bound to a mouse key binding, see
3253.Sx MOUSE SUPPORT ) .
3254.Pp
3255.Fl X
3256is used to send a command into copy mode - see
3257the
3258.Sx WINDOWS AND PANES
3259section.
3260.Fl N
3261specifies a repeat count and
3262.Fl F
3263expands formats in arguments where appropriate.
3264.It Xo Ic send-prefix
3265.Op Fl 2
3266.Op Fl t Ar target-pane
3267.Xc
3268Send the prefix key, or with
3269.Fl 2
3270the secondary prefix key, to a window as if it was pressed.
3271.Tg unbind
3272.It Xo Ic unbind-key
3273.Op Fl anq
3274.Op Fl T Ar key-table
3275.Ar key
3276.Xc
3277.D1 Pq alias: Ic unbind
3278Unbind the command bound to
3279.Ar key .
3280.Fl n
3281and
3282.Fl T
3283are the same as for
3284.Ic bind-key .
3285If
3286.Fl a
3287is present, all key bindings are removed.
3288The
3289.Fl q
3290option prevents errors being returned.
3291.El
3292.Sh OPTIONS
3293The appearance and behaviour of
3294.Nm
3295may be modified by changing the value of various options.
3296There are four types of option:
3297.Em server options ,
3298.Em session options ,
3299.Em window options ,
3300and
3301.Em pane options .
3302.Pp
3303The
3304.Nm
3305server has a set of global server options which do not apply to any particular
3306window or session or pane.
3307These are altered with the
3308.Ic set-option
3309.Fl s
3310command, or displayed with the
3311.Ic show-options
3312.Fl s
3313command.
3314.Pp
3315In addition, each individual session may have a set of session options, and
3316there is a separate set of global session options.
3317Sessions which do not have a particular option configured inherit the value
3318from the global session options.
3319Session options are set or unset with the
3320.Ic set-option
3321command and may be listed with the
3322.Ic show-options
3323command.
3324The available server and session options are listed under the
3325.Ic set-option
3326command.
3327.Pp
3328Similarly, a set of window options is attached to each window and a set of pane
3329options to each pane.
3330Pane options inherit from window options.
3331This means any pane option may be set as a window option to apply the option to
3332all panes in the window without the option set, for example these commands will
3333set the background colour to red for all panes except pane 0:
3334.Bd -literal -offset indent
3335set -w window-style bg=red
3336set -pt:.0 window-style bg=blue
3337.Ed
3338.Pp
3339There is also a set of global window options from which any unset window or
3340pane options are inherited.
3341Window and pane options are altered with
3342.Ic set-option
3343.Fl w
3344and
3345.Fl p
3346commands and displayed with
3347.Ic show-option
3348.Fl w
3349and
3350.Fl p .
3351.Pp
3352.Nm
3353also supports user options which are prefixed with a
3354.Ql \&@ .
3355User options may have any name, so long as they are prefixed with
3356.Ql \&@ ,
3357and be set to any string.
3358For example:
3359.Bd -literal -offset indent
3360$ tmux set -wq @foo "abc123"
3361$ tmux show -wv @foo
3362abc123
3363.Ed
3364.Pp
3365Commands which set options are as follows:
3366.Bl -tag -width Ds
3367.Tg set
3368.It Xo Ic set-option
3369.Op Fl aFgopqsuUw
3370.Op Fl t Ar target-pane
3371.Ar option Ar value
3372.Xc
3373.D1 Pq alias: Ic set
3374Set a pane option with
3375.Fl p ,
3376a window option with
3377.Fl w ,
3378a server option with
3379.Fl s ,
3380otherwise a session option.
3381If the option is not a user option,
3382.Fl w
3383or
3384.Fl s
3385may be unnecessary -
3386.Nm
3387will infer the type from the option name, assuming
3388.Fl w
3389for pane options.
3390If
3391.Fl g
3392is given, the global session or window option is set.
3393.Pp
3394.Fl F
3395expands formats in the option value.
3396The
3397.Fl u
3398flag unsets an option, so a session inherits the option from the global
3399options (or with
3400.Fl g ,
3401restores a global option to the default).
3402.Fl U
3403unsets an option (like
3404.Fl u )
3405but if the option is a pane option also unsets the option on any panes in the
3406window.
3407.Ar value
3408depends on the option and may be a number, a string, or a flag (on, off, or
3409omitted to toggle).
3410.Pp
3411The
3412.Fl o
3413flag prevents setting an option that is already set and the
3414.Fl q
3415flag suppresses errors about unknown or ambiguous options.
3416.Pp
3417With
3418.Fl a ,
3419and if the option expects a string or a style,
3420.Ar value
3421is appended to the existing setting.
3422For example:
3423.Bd -literal -offset indent
3424set -g status-left "foo"
3425set -ag status-left "bar"
3426.Ed
3427.Pp
3428Will result in
3429.Ql foobar .
3430And:
3431.Bd -literal -offset indent
3432set -g status-style "bg=red"
3433set -ag status-style "fg=blue"
3434.Ed
3435.Pp
3436Will result in a red background
3437.Em and
3438blue foreground.
3439Without
3440.Fl a ,
3441the result would be the default background and a blue foreground.
3442.Tg show
3443.It Xo Ic show-options
3444.Op Fl AgHpqsvw
3445.Op Fl t Ar target-pane
3446.Op Ar option
3447.Xc
3448.D1 Pq alias: Ic show
3449Show the pane options (or a single option if
3450.Ar option
3451is provided) with
3452.Fl p ,
3453the window options with
3454.Fl w ,
3455the server options with
3456.Fl s ,
3457otherwise the session options.
3458If the option is not a user option,
3459.Fl w
3460or
3461.Fl s
3462may be unnecessary -
3463.Nm
3464will infer the type from the option name, assuming
3465.Fl w
3466for pane options.
3467Global session or window options are listed if
3468.Fl g
3469is used.
3470.Fl v
3471shows only the option value, not the name.
3472If
3473.Fl q
3474is set, no error will be returned if
3475.Ar option
3476is unset.
3477.Fl H
3478includes hooks (omitted by default).
3479.Fl A
3480includes options inherited from a parent set of options, such options are
3481marked with an asterisk.
3482.El
3483.Pp
3484Available server options are:
3485.Bl -tag -width Ds
3486.It Ic backspace Ar key
3487Set the key sent by
3488.Nm
3489for backspace.
3490.It Ic buffer-limit Ar number
3491Set the number of buffers; as new buffers are added to the top of the stack,
3492old ones are removed from the bottom if necessary to maintain this maximum
3493length.
3494.It Xo Ic command-alias[]
3495.Ar name=value
3496.Xc
3497This is an array of custom aliases for commands.
3498If an unknown command matches
3499.Ar name ,
3500it is replaced with
3501.Ar value .
3502For example, after:
3503.Pp
3504.Dl set -s command-alias[100] zoom='resize-pane -Z'
3505.Pp
3506Using:
3507.Pp
3508.Dl zoom -t:.1
3509.Pp
3510Is equivalent to:
3511.Pp
3512.Dl resize-pane -Z -t:.1
3513.Pp
3514Note that aliases are expanded when a command is parsed rather than when it is
3515executed, so binding an alias with
3516.Ic bind-key
3517will bind the expanded form.
3518.It Ic default-terminal Ar terminal
3519Set the default terminal for new windows created in this session - the
3520default value of the
3521.Ev TERM
3522environment variable.
3523For
3524.Nm
3525to work correctly, this
3526.Em must
3527be set to
3528.Ql screen ,
3529.Ql tmux
3530or a derivative of them.
3531.It Ic copy-command Ar shell-command
3532Give the command to pipe to if the
3533.Ic copy-pipe
3534copy mode command is used without arguments.
3535.It Ic escape-time Ar time
3536Set the time in milliseconds for which
3537.Nm
3538waits after an escape is input to determine if it is part of a function or meta
3539key sequences.
3540The default is 500 milliseconds.
3541.It Ic editor Ar shell-command
3542Set the command used when
3543.Nm
3544runs an editor.
3545.It Xo Ic exit-empty
3546.Op Ic on | off
3547.Xc
3548If enabled (the default), the server will exit when there are no active
3549sessions.
3550.It Xo Ic exit-unattached
3551.Op Ic on | off
3552.Xc
3553If enabled, the server will exit when there are no attached clients.
3554.It Xo Ic extended-keys
3555.Op Ic on | off | always
3556.Xc
3557When
3558.Ic on
3559or
3560.Ic always ,
3561the escape sequence to enable extended keys is sent to the terminal, if
3562.Nm
3563knows that it is supported.
3564.Nm
3565always recognises extended keys itself.
3566If this option is
3567.Ic on ,
3568.Nm
3569will only forward extended keys to applications when they request them; if
3570.Ic always ,
3571.Nm
3572will always forward the keys.
3573.It Xo Ic focus-events
3574.Op Ic on | off
3575.Xc
3576When enabled, focus events are requested from the terminal if supported and
3577passed through to applications running in
3578.Nm .
3579Attached clients should be detached and attached again after changing this
3580option.
3581.It Ic history-file Ar path
3582If not empty, a file to which
3583.Nm
3584will write command prompt history on exit and load it from on start.
3585.It Ic message-limit Ar number
3586Set the number of error or information messages to save in the message log for
3587each client.
3588.It Ic prompt-history-limit Ar number
3589Set the number of history items to save in the history file for each type of
3590command prompt.
3591.It Xo Ic set-clipboard
3592.Op Ic on | external | off
3593.Xc
3594Attempt to set the terminal clipboard content using the
3595.Xr xterm 1
3596escape sequence, if there is an
3597.Em \&Ms
3598entry in the
3599.Xr terminfo 5
3600description (see the
3601.Sx TERMINFO EXTENSIONS
3602section).
3603.Pp
3604If set to
3605.Ic on ,
3606.Nm
3607will both accept the escape sequence to create a buffer and attempt to set
3608the terminal clipboard.
3609If set to
3610.Ic external ,
3611.Nm
3612will attempt to set the terminal clipboard but ignore attempts
3613by applications to set
3614.Nm
3615buffers.
3616If
3617.Ic off ,
3618.Nm
3619will neither accept the clipboard escape sequence nor attempt to set the
3620clipboard.
3621.Pp
3622Note that this feature needs to be enabled in
3623.Xr xterm 1
3624by setting the resource:
3625.Bd -literal -offset indent
3626disallowedWindowOps: 20,21,SetXprop
3627.Ed
3628.Pp
3629Or changing this property from the
3630.Xr xterm 1
3631interactive menu when required.
3632.It Ic terminal-features[] Ar string
3633Set terminal features for terminal types read from
3634.Xr terminfo 5 .
3635.Nm
3636has a set of named terminal features.
3637Each will apply appropriate changes to the
3638.Xr terminfo 5
3639entry in use.
3640.Pp
3641.Nm
3642can detect features for a few common terminals; this option can be used to
3643easily tell tmux about features supported by terminals it cannot detect.
3644The
3645.Ic terminal-overrides
3646option allows individual
3647.Xr terminfo 5
3648capabilities to be set instead,
3649.Ic terminal-features
3650is intended for classes of functionality supported in a standard way but not
3651reported by
3652.Xr terminfo 5 .
3653Care must be taken to configure this only with features the terminal actually
3654supports.
3655.Pp
3656This is an array option where each entry is a colon-separated string made up
3657of a terminal type pattern (matched using
3658.Xr fnmatch 3 )
3659followed by a list of terminal features.
3660The available features are:
3661.Bl -tag -width Ds
3662.It 256
3663Supports 256 colours with the SGR escape sequences.
3664.It clipboard
3665Allows setting the system clipboard.
3666.It ccolour
3667Allows setting the cursor colour.
3668.It cstyle
3669Allows setting the cursor style.
3670.It extkeys
3671Supports extended keys.
3672.It focus
3673Supports focus reporting.
3674.It hyperlinks
3675Supports OSC 8 hyperlinks.
3676.It ignorefkeys
3677Ignore function keys from
3678.Xr terminfo 5
3679and use the
3680.Nm
3681internal set only.
3682.It margins
3683Supports DECSLRM margins.
3684.It mouse
3685Supports
3686.Xr xterm 1
3687mouse sequences.
3688.It osc7
3689Supports the OSC 7 working directory extension.
3690.It overline
3691Supports the overline SGR attribute.
3692.It rectfill
3693Supports the DECFRA rectangle fill escape sequence.
3694.It RGB
3695Supports RGB colour with the SGR escape sequences.
3696.It sixel
3697Supports SIXEL graphics.
3698.It strikethrough
3699Supports the strikethrough SGR escape sequence.
3700.It sync
3701Supports synchronized updates.
3702.It title
3703Supports
3704.Xr xterm 1
3705title setting.
3706.It usstyle
3707Allows underscore style and colour to be set.
3708.El
3709.It Ic terminal-overrides[] Ar string
3710Allow terminal descriptions read using
3711.Xr terminfo 5
3712to be overridden.
3713Each entry is a colon-separated string made up of a terminal type pattern
3714(matched using
3715.Xr fnmatch 3 )
3716and a set of
3717.Em name=value
3718entries.
3719.Pp
3720For example, to set the
3721.Ql clear
3722.Xr terminfo 5
3723entry to
3724.Ql \ee[H\ee[2J
3725for all terminal types matching
3726.Ql rxvt* :
3727.Pp
3728.Dl "rxvt*:clear=\ee[H\ee[2J"
3729.Pp
3730The terminal entry value is passed through
3731.Xr strunvis 3
3732before interpretation.
3733.It Ic user-keys[] Ar key
3734Set list of user-defined key escape sequences.
3735Each item is associated with a key named
3736.Ql User0 ,
3737.Ql User1 ,
3738and so on.
3739.Pp
3740For example:
3741.Bd -literal -offset indent
3742set -s user-keys[0] "\ee[5;30012~"
3743bind User0 resize-pane -L 3
3744.Ed
3745.El
3746.Pp
3747Available session options are:
3748.Bl -tag -width Ds
3749.It Xo Ic activity-action
3750.Op Ic any | none | current | other
3751.Xc
3752Set action on window activity when
3753.Ic monitor-activity
3754is on.
3755.Ic any
3756means activity in any window linked to a session causes a bell or message
3757(depending on
3758.Ic visual-activity )
3759in the current window of that session,
3760.Ic none
3761means all activity is ignored (equivalent to
3762.Ic monitor-activity
3763being off),
3764.Ic current
3765means only activity in windows other than the current window are ignored and
3766.Ic other
3767means activity in the current window is ignored but not those in other windows.
3768.It Ic assume-paste-time Ar milliseconds
3769If keys are entered faster than one in
3770.Ar milliseconds ,
3771they are assumed to have been pasted rather than typed and
3772.Nm
3773key bindings are not processed.
3774The default is one millisecond and zero disables.
3775.It Ic base-index Ar index
3776Set the base index from which an unused index should be searched when a new
3777window is created.
3778The default is zero.
3779.It Xo Ic bell-action
3780.Op Ic any | none | current | other
3781.Xc
3782Set action on a bell in a window when
3783.Ic monitor-bell
3784is on.
3785The values are the same as those for
3786.Ic activity-action .
3787.It Ic default-command Ar shell-command
3788Set the command used for new windows (if not specified when the window is
3789created) to
3790.Ar shell-command ,
3791which may be any
3792.Xr sh 1
3793command.
3794The default is an empty string, which instructs
3795.Nm
3796to create a login shell using the value of the
3797.Ic default-shell
3798option.
3799.It Ic default-shell Ar path
3800Specify the default shell.
3801This is used as the login shell for new windows when the
3802.Ic default-command
3803option is set to empty, and must be the full path of the executable.
3804When started
3805.Nm
3806tries to set a default value from the first suitable of the
3807.Ev SHELL
3808environment variable, the shell returned by
3809.Xr getpwuid 3 ,
3810or
3811.Pa /bin/sh .
3812This option should be configured when
3813.Nm
3814is used as a login shell.
3815.It Ic default-size Ar XxY
3816Set the default size of new windows when the
3817.Ic window-size
3818option is set to manual or when a session is created with
3819.Ic new-session
3820.Fl d .
3821The value is the width and height separated by an
3822.Ql x
3823character.
3824The default is 80x24.
3825.It Xo Ic destroy-unattached
3826.Op Ic on | off
3827.Xc
3828If enabled and the session is no longer attached to any clients, it is
3829destroyed.
3830.It Xo Ic detach-on-destroy
3831.Op Ic off | on | no-detached
3832.Xc
3833If on (the default), the client is detached when the session it is attached to
3834is destroyed.
3835If off, the client is switched to the most recently active of the remaining
3836sessions.
3837If
3838.Ic no-detached ,
3839the client is detached only if there are no detached sessions; if detached
3840sessions exist, the client is switched to the most recently active.
3841.It Ic display-panes-active-colour Ar colour
3842Set the colour used by the
3843.Ic display-panes
3844command to show the indicator for the active pane.
3845.It Ic display-panes-colour Ar colour
3846Set the colour used by the
3847.Ic display-panes
3848command to show the indicators for inactive panes.
3849.It Ic display-panes-time Ar time
3850Set the time in milliseconds for which the indicators shown by the
3851.Ic display-panes
3852command appear.
3853.It Ic display-time Ar time
3854Set the amount of time for which status line messages and other on-screen
3855indicators are displayed.
3856If set to 0, messages and indicators are displayed until a key is pressed.
3857.Ar time
3858is in milliseconds.
3859.It Ic history-limit Ar lines
3860Set the maximum number of lines held in window history.
3861This setting applies only to new windows - existing window histories are not
3862resized and retain the limit at the point they were created.
3863.It Ic key-table Ar key-table
3864Set the default key table to
3865.Ar key-table
3866instead of
3867.Em root .
3868.It Ic lock-after-time Ar number
3869Lock the session (like the
3870.Ic lock-session
3871command) after
3872.Ar number
3873seconds of inactivity.
3874The default is not to lock (set to 0).
3875.It Ic lock-command Ar shell-command
3876Command to run when locking each client.
3877The default is to run
3878.Xr lock 1
3879with
3880.Fl np .
3881.It Ic message-command-style Ar style
3882Set status line message command style.
3883This is used for the command prompt with
3884.Xr vi 1
3885keys when in command mode.
3886For how to specify
3887.Ar style ,
3888see the
3889.Sx STYLES
3890section.
3891.It Xo Ic message-line
3892.Op Ic 0 | 1 | 2 | 3 | 4
3893.Xc
3894Set line on which status line messages and the command prompt are shown.
3895.It Ic message-style Ar style
3896Set status line message style.
3897This is used for messages and for the command prompt.
3898For how to specify
3899.Ar style ,
3900see the
3901.Sx STYLES
3902section.
3903.It Xo Ic mouse
3904.Op Ic on | off
3905.Xc
3906If on,
3907.Nm
3908captures the mouse and allows mouse events to be bound as key bindings.
3909See the
3910.Sx MOUSE SUPPORT
3911section for details.
3912.It Ic prefix Ar key
3913Set the key accepted as a prefix key.
3914In addition to the standard keys described under
3915.Sx KEY BINDINGS ,
3916.Ic prefix
3917can be set to the special key
3918.Ql None
3919to set no prefix.
3920.It Ic prefix2 Ar key
3921Set a secondary key accepted as a prefix key.
3922Like
3923.Ic prefix ,
3924.Ic prefix2
3925can be set to
3926.Ql None .
3927.It Xo Ic renumber-windows
3928.Op Ic on | off
3929.Xc
3930If on, when a window is closed in a session, automatically renumber the other
3931windows in numerical order.
3932This respects the
3933.Ic base-index
3934option if it has been set.
3935If off, do not renumber the windows.
3936.It Ic repeat-time Ar time
3937Allow multiple commands to be entered without pressing the prefix-key again
3938in the specified
3939.Ar time
3940milliseconds (the default is 500).
3941Whether a key repeats may be set when it is bound using the
3942.Fl r
3943flag to
3944.Ic bind-key .
3945Repeat is enabled for the default keys bound to the
3946.Ic resize-pane
3947command.
3948.It Xo Ic set-titles
3949.Op Ic on | off
3950.Xc
3951Attempt to set the client terminal title using the
3952.Em tsl
3953and
3954.Em fsl
3955.Xr terminfo 5
3956entries if they exist.
3957.Nm
3958automatically sets these to the \ee]0;...\e007 sequence if
3959the terminal appears to be
3960.Xr xterm 1 .
3961This option is off by default.
3962.It Ic set-titles-string Ar string
3963String used to set the client terminal title if
3964.Ic set-titles
3965is on.
3966Formats are expanded, see the
3967.Sx FORMATS
3968section.
3969.It Xo Ic silence-action
3970.Op Ic any | none | current | other
3971.Xc
3972Set action on window silence when
3973.Ic monitor-silence
3974is on.
3975The values are the same as those for
3976.Ic activity-action .
3977.It Xo Ic status
3978.Op Ic off | on | 2 | 3 | 4 | 5
3979.Xc
3980Show or hide the status line or specify its size.
3981Using
3982.Ic on
3983gives a status line one row in height;
3984.Ic 2 ,
3985.Ic 3 ,
3986.Ic 4
3987or
3988.Ic 5
3989more rows.
3990.It Ic status-format[] Ar format
3991Specify the format to be used for each line of the status line.
3992The default builds the top status line from the various individual status
3993options below.
3994.It Ic status-interval Ar interval
3995Update the status line every
3996.Ar interval
3997seconds.
3998By default, updates will occur every 15 seconds.
3999A setting of zero disables redrawing at interval.
4000.It Xo Ic status-justify
4001.Op Ic left | centre | right | absolute-centre
4002.Xc
4003Set the position of the window list in the status line: left, centre or right.
4004centre puts the window list in the relative centre of the available free space;
4005absolute-centre uses the centre of the entire horizontal space.
4006.It Xo Ic status-keys
4007.Op Ic vi | emacs
4008.Xc
4009Use vi or emacs-style
4010key bindings in the status line, for example at the command prompt.
4011The default is emacs, unless the
4012.Ev VISUAL
4013or
4014.Ev EDITOR
4015environment variables are set and contain the string
4016.Ql vi .
4017.It Ic status-left Ar string
4018Display
4019.Ar string
4020(by default the session name) to the left of the status line.
4021.Ar string
4022will be passed through
4023.Xr strftime 3 .
4024Also see the
4025.Sx FORMATS
4026and
4027.Sx STYLES
4028sections.
4029.Pp
4030For details on how the names and titles can be set see the
4031.Sx "NAMES AND TITLES"
4032section.
4033.Pp
4034Examples are:
4035.Bd -literal -offset indent
4036#(sysctl vm.loadavg)
4037#[fg=yellow,bold]#(apm -l)%%#[default] [#S]
4038.Ed
4039.Pp
4040The default is
4041.Ql "[#S] " .
4042.It Ic status-left-length Ar length
4043Set the maximum
4044.Ar length
4045of the left component of the status line.
4046The default is 10.
4047.It Ic status-left-style Ar style
4048Set the style of the left part of the status line.
4049For how to specify
4050.Ar style ,
4051see the
4052.Sx STYLES
4053section.
4054.It Xo Ic status-position
4055.Op Ic top | bottom
4056.Xc
4057Set the position of the status line.
4058.It Ic status-right Ar string
4059Display
4060.Ar string
4061to the right of the status line.
4062By default, the current pane title in double quotes, the date and the time
4063are shown.
4064As with
4065.Ic status-left ,
4066.Ar string
4067will be passed to
4068.Xr strftime 3
4069and character pairs are replaced.
4070.It Ic status-right-length Ar length
4071Set the maximum
4072.Ar length
4073of the right component of the status line.
4074The default is 40.
4075.It Ic status-right-style Ar style
4076Set the style of the right part of the status line.
4077For how to specify
4078.Ar style ,
4079see the
4080.Sx STYLES
4081section.
4082.It Ic status-style Ar style
4083Set status line style.
4084For how to specify
4085.Ar style ,
4086see the
4087.Sx STYLES
4088section.
4089.It Ic update-environment[] Ar variable
4090Set list of environment variables to be copied into the session environment
4091when a new session is created or an existing session is attached.
4092Any variables that do not exist in the source environment are set to be
4093removed from the session environment (as if
4094.Fl r
4095was given to the
4096.Ic set-environment
4097command).
4098.It Xo Ic visual-activity
4099.Op Ic on | off | both
4100.Xc
4101If on, display a message instead of sending a bell when activity occurs in a
4102window for which the
4103.Ic monitor-activity
4104window option is enabled.
4105If set to both, a bell and a message are produced.
4106.It Xo Ic visual-bell
4107.Op Ic on | off | both
4108.Xc
4109If on, a message is shown on a bell in a window for which the
4110.Ic monitor-bell
4111window option is enabled instead of it being passed through to the
4112terminal (which normally makes a sound).
4113If set to both, a bell and a message are produced.
4114Also see the
4115.Ic bell-action
4116option.
4117.It Xo Ic visual-silence
4118.Op Ic on | off | both
4119.Xc
4120If
4121.Ic monitor-silence
4122is enabled, prints a message after the interval has expired on a given window
4123instead of sending a bell.
4124If set to both, a bell and a message are produced.
4125.It Ic word-separators Ar string
4126Sets the session's conception of what characters are considered word
4127separators, for the purposes of the next and previous word commands in
4128copy mode.
4129.El
4130.Pp
4131Available window options are:
4132.Pp
4133.Bl -tag -width Ds -compact
4134.It Xo Ic aggressive-resize
4135.Op Ic on | off
4136.Xc
4137Aggressively resize the chosen window.
4138This means that
4139.Nm
4140will resize the window to the size of the smallest or largest session
4141(see the
4142.Ic window-size
4143option) for which it is the current window, rather than the session to
4144which it is attached.
4145The window may resize when the current window is changed on another
4146session; this option is good for full-screen programs which support
4147.Dv SIGWINCH
4148and poor for interactive programs such as shells.
4149.Pp
4150.It Xo Ic automatic-rename
4151.Op Ic on | off
4152.Xc
4153Control automatic window renaming.
4154When this setting is enabled,
4155.Nm
4156will rename the window automatically using the format specified by
4157.Ic automatic-rename-format .
4158This flag is automatically disabled for an individual window when a name
4159is specified at creation with
4160.Ic new-window
4161or
4162.Ic new-session ,
4163or later with
4164.Ic rename-window ,
4165or with a terminal escape sequence.
4166It may be switched off globally with:
4167.Bd -literal -offset indent
4168set-option -wg automatic-rename off
4169.Ed
4170.Pp
4171.It Ic automatic-rename-format Ar format
4172The format (see
4173.Sx FORMATS )
4174used when the
4175.Ic automatic-rename
4176option is enabled.
4177.Pp
4178.It Ic clock-mode-colour Ar colour
4179Set clock colour.
4180.Pp
4181.It Xo Ic clock-mode-style
4182.Op Ic 12 | 24
4183.Xc
4184Set clock hour format.
4185.Pp
4186.It Ic fill-character Ar character
4187Set the character used to fill areas of the terminal unused by a window.
4188.Pp
4189.It Ic main-pane-height Ar height
4190.It Ic main-pane-width Ar width
4191Set the width or height of the main (left or top) pane in the
4192.Ic main-horizontal
4193or
4194.Ic main-vertical
4195layouts.
4196If suffixed by
4197.Ql % ,
4198this is a percentage of the window size.
4199.Pp
4200.It Ic copy-mode-match-style Ar style
4201Set the style of search matches in copy mode.
4202For how to specify
4203.Ar style ,
4204see the
4205.Sx STYLES
4206section.
4207.Pp
4208.It Ic copy-mode-mark-style Ar style
4209Set the style of the line containing the mark in copy mode.
4210For how to specify
4211.Ar style ,
4212see the
4213.Sx STYLES
4214section.
4215.Pp
4216.It Ic copy-mode-current-match-style Ar style
4217Set the style of the current search match in copy mode.
4218For how to specify
4219.Ar style ,
4220see the
4221.Sx STYLES
4222section.
4223.Pp
4224.It Xo Ic mode-keys
4225.Op Ic vi | emacs
4226.Xc
4227Use vi or emacs-style key bindings in copy mode.
4228The default is emacs, unless
4229.Ev VISUAL
4230or
4231.Ev EDITOR
4232contains
4233.Ql vi .
4234.Pp
4235.It Ic mode-style Ar style
4236Set window modes style.
4237For how to specify
4238.Ar style ,
4239see the
4240.Sx STYLES
4241section.
4242.Pp
4243.It Xo Ic monitor-activity
4244.Op Ic on | off
4245.Xc
4246Monitor for activity in the window.
4247Windows with activity are highlighted in the status line.
4248.Pp
4249.It Xo Ic monitor-bell
4250.Op Ic on | off
4251.Xc
4252Monitor for a bell in the window.
4253Windows with a bell are highlighted in the status line.
4254.Pp
4255.It Xo Ic monitor-silence
4256.Op Ic interval
4257.Xc
4258Monitor for silence (no activity) in the window within
4259.Ic interval
4260seconds.
4261Windows that have been silent for the interval are highlighted in the
4262status line.
4263An interval of zero disables the monitoring.
4264.Pp
4265.It Ic other-pane-height Ar height
4266Set the height of the other panes (not the main pane) in the
4267.Ic main-horizontal
4268layout.
4269If this option is set to 0 (the default), it will have no effect.
4270If both the
4271.Ic main-pane-height
4272and
4273.Ic other-pane-height
4274options are set, the main pane will grow taller to make the other panes the
4275specified height, but will never shrink to do so.
4276If suffixed by
4277.Ql % ,
4278this is a percentage of the window size.
4279.Pp
4280.It Ic other-pane-width Ar width
4281Like
4282.Ic other-pane-height ,
4283but set the width of other panes in the
4284.Ic main-vertical
4285layout.
4286.Pp
4287.It Ic pane-active-border-style Ar style
4288Set the pane border style for the currently active pane.
4289For how to specify
4290.Ar style ,
4291see the
4292.Sx STYLES
4293section.
4294Attributes are ignored.
4295.Pp
4296.It Ic pane-base-index Ar index
4297Like
4298.Ic base-index ,
4299but set the starting index for pane numbers.
4300.Pp
4301.It Ic pane-border-format Ar format
4302Set the text shown in pane border status lines.
4303.Pp
4304.It Xo Ic pane-border-indicators
4305.Op Ic off | colour | arrows | both
4306.Xc
4307Indicate active pane by colouring only half of the border in windows with
4308exactly two panes, by displaying arrow markers, by drawing both or neither.
4309.Pp
4310.It Ic pane-border-lines Ar type
4311Set the type of characters used for drawing pane borders.
4312.Ar type
4313may be one of:
4314.Bl -tag -width Ds
4315.It single
4316single lines using ACS or UTF-8 characters
4317.It double
4318double lines using UTF-8 characters
4319.It heavy
4320heavy lines using UTF-8 characters
4321.It simple
4322simple ASCII characters
4323.It number
4324the pane number
4325.El
4326.Pp
4327.Ql double
4328and
4329.Ql heavy
4330will fall back to standard ACS line drawing when UTF-8 is not supported.
4331.Pp
4332.It Xo Ic pane-border-status
4333.Op Ic off | top | bottom
4334.Xc
4335Turn pane border status lines off or set their position.
4336.Pp
4337.It Ic pane-border-style Ar style
4338Set the pane border style for panes aside from the active pane.
4339For how to specify
4340.Ar style ,
4341see the
4342.Sx STYLES
4343section.
4344Attributes are ignored.
4345.Pp
4346.It Ic popup-style Ar style
4347Set the popup style.
4348For how to specify
4349.Ar style ,
4350see the
4351.Sx STYLES
4352section.
4353Attributes are ignored.
4354.Pp
4355.It Ic popup-border-style Ar style
4356Set the popup border style.
4357For how to specify
4358.Ar style ,
4359see the
4360.Sx STYLES
4361section.
4362Attributes are ignored.
4363.Pp
4364.It Ic popup-border-lines Ar type
4365Set the type of characters used for drawing popup borders.
4366.Ar type
4367may be one of:
4368.Bl -tag -width Ds
4369.It single
4370single lines using ACS or UTF-8 characters (default)
4371.It rounded
4372variation of single with rounded corners using UTF-8 characters
4373.It double
4374double lines using UTF-8 characters
4375.It heavy
4376heavy lines using UTF-8 characters
4377.It simple
4378simple ASCII characters
4379.It padded
4380simple ASCII space character
4381.It none
4382no border
4383.El
4384.Pp
4385.Ql double
4386and
4387.Ql heavy
4388will fall back to standard ACS line drawing when UTF-8 is not supported.
4389.Pp
4390.It Ic window-status-activity-style Ar style
4391Set status line style for windows with an activity alert.
4392For how to specify
4393.Ar style ,
4394see the
4395.Sx STYLES
4396section.
4397.Pp
4398.It Ic window-status-bell-style Ar style
4399Set status line style for windows with a bell alert.
4400For how to specify
4401.Ar style ,
4402see the
4403.Sx STYLES
4404section.
4405.Pp
4406.It Ic window-status-current-format Ar string
4407Like
4408.Ar window-status-format ,
4409but is the format used when the window is the current window.
4410.Pp
4411.It Ic window-status-current-style Ar style
4412Set status line style for the currently active window.
4413For how to specify
4414.Ar style ,
4415see the
4416.Sx STYLES
4417section.
4418.Pp
4419.It Ic window-status-format Ar string
4420Set the format in which the window is displayed in the status line window list.
4421See the
4422.Sx FORMATS
4423and
4424.Sx STYLES
4425sections.
4426.Pp
4427.It Ic window-status-last-style Ar style
4428Set status line style for the last active window.
4429For how to specify
4430.Ar style ,
4431see the
4432.Sx STYLES
4433section.
4434.Pp
4435.It Ic window-status-separator Ar string
4436Sets the separator drawn between windows in the status line.
4437The default is a single space character.
4438.Pp
4439.It Ic window-status-style Ar style
4440Set status line style for a single window.
4441For how to specify
4442.Ar style ,
4443see the
4444.Sx STYLES
4445section.
4446.Pp
4447.It Xo Ic window-size
4448.Ar largest | Ar smallest | Ar manual | Ar latest
4449.Xc
4450Configure how
4451.Nm
4452determines the window size.
4453If set to
4454.Ar largest ,
4455the size of the largest attached session is used; if
4456.Ar smallest ,
4457the size of the smallest.
4458If
4459.Ar manual ,
4460the size of a new window is set from the
4461.Ic default-size
4462option and windows are resized automatically.
4463With
4464.Ar latest ,
4465.Nm
4466uses the size of the client that had the most recent activity.
4467See also the
4468.Ic resize-window
4469command and the
4470.Ic aggressive-resize
4471option.
4472.Pp
4473.It Xo Ic wrap-search
4474.Op Ic on | off
4475.Xc
4476If this option is set, searches will wrap around the end of the pane contents.
4477The default is on.
4478.El
4479.Pp
4480Available pane options are:
4481.Pp
4482.Bl -tag -width Ds -compact
4483.It Xo Ic allow-passthrough
4484.Op Ic on | off | all
4485.Xc
4486Allow programs in the pane to bypass
4487.Nm
4488using a terminal escape sequence (\eePtmux;...\ee\e\e).
4489If set to
4490.Ic on ,
4491passthrough sequences will be allowed only if the pane is visible.
4492If set to
4493.Ic all ,
4494they will be allowed even if the pane is invisible.
4495.Pp
4496.It Xo Ic allow-rename
4497.Op Ic on | off
4498.Xc
4499Allow programs in the pane to change the window name using a terminal escape
4500sequence (\eek...\ee\e\e).
4501.Pp
4502.It Xo Ic alternate-screen
4503.Op Ic on | off
4504.Xc
4505This option configures whether programs running inside the pane may use the
4506terminal alternate screen feature, which allows the
4507.Em smcup
4508and
4509.Em rmcup
4510.Xr terminfo 5
4511capabilities.
4512The alternate screen feature preserves the contents of the window when an
4513interactive application starts and restores it on exit, so that any output
4514visible before the application starts reappears unchanged after it exits.
4515.Pp
4516.It Ic cursor-colour Ar colour
4517Set the colour of the cursor.
4518.Pp
4519.It Ic pane-colours[] Ar colour
4520The default colour palette.
4521Each entry in the array defines the colour
4522.Nm
4523uses when the colour with that index is requested.
4524The index may be from zero to 255.
4525.Pp
4526.It Ic cursor-style Ar style
4527Set the style of the cursor.
4528Available styles are:
4529.Ic default ,
4530.Ic blinking-block ,
4531.Ic block ,
4532.Ic blinking-underline ,
4533.Ic underline ,
4534.Ic blinking-bar ,
4535.Ic bar .
4536.Pp
4537.It Xo Ic remain-on-exit
4538.Op Ic on | off | failed
4539.Xc
4540A pane with this flag set is not destroyed when the program running in it
4541exits.
4542If set to
4543.Ic failed ,
4544then only when the program exit status is not zero.
4545The pane may be reactivated with the
4546.Ic respawn-pane
4547command.
4548.Pp
4549.It Ic remain-on-exit-format Ar string
4550Set the text shown at the bottom of exited panes when
4551.Ic remain-on-exit
4552is enabled.
4553.Pp
4554.It Xo Ic scroll-on-clear
4555.Op Ic on | off
4556.Xc
4557When the entire screen is cleared and this option is on, scroll the contents of
4558the screen into history before clearing it.
4559.Pp
4560.It Xo Ic synchronize-panes
4561.Op Ic on | off
4562.Xc
4563Duplicate input to all other panes in the same window where this option is also
4564on (only for panes that are not in any mode).
4565.Pp
4566.It Ic window-active-style Ar style
4567Set the pane style when it is the active pane.
4568For how to specify
4569.Ar style ,
4570see the
4571.Sx STYLES
4572section.
4573.Pp
4574.It Ic window-style Ar style
4575Set the pane style.
4576For how to specify
4577.Ar style ,
4578see the
4579.Sx STYLES
4580section.
4581.El
4582.Sh HOOKS
4583.Nm
4584allows commands to run on various triggers, called
4585.Em hooks .
4586Most
4587.Nm
4588commands have an
4589.Em after
4590hook and there are a number of hooks not associated with commands.
4591.Pp
4592Hooks are stored as array options, members of the array are executed in
4593order when the hook is triggered.
4594Like options different hooks may be global or belong to a session, window or pane.
4595Hooks may be configured with the
4596.Ic set-hook
4597or
4598.Ic set-option
4599commands and displayed with
4600.Ic show-hooks
4601or
4602.Ic show-options
4603.Fl H .
4604The following two commands are equivalent:
4605.Bd -literal -offset indent.
4606set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red'
4607set-option -g pane-mode-changed[42] 'set -g status-left-style bg=red'
4608.Ed
4609.Pp
4610Setting a hook without specifying an array index clears the hook and sets the
4611first member of the array.
4612.Pp
4613A command's after
4614hook is run after it completes, except when the command is run as part of a hook
4615itself.
4616They are named with an
4617.Ql after-
4618prefix.
4619For example, the following command adds a hook to select the even-vertical
4620layout after every
4621.Ic split-window :
4622.Bd -literal -offset indent
4623set-hook -g after-split-window "selectl even-vertical"
4624.Ed
4625.Pp
4626All the notifications listed in the
4627.Sx CONTROL MODE
4628section are hooks (without any arguments), except
4629.Ic %exit .
4630The following additional hooks are available:
4631.Bl -tag -width "XXXXXXXXXXXXXXXXXXXXXX"
4632.It alert-activity
4633Run when a window has activity.
4634See
4635.Ic monitor-activity .
4636.It alert-bell
4637Run when a window has received a bell.
4638See
4639.Ic monitor-bell .
4640.It alert-silence
4641Run when a window has been silent.
4642See
4643.Ic monitor-silence .
4644.It client-active
4645Run when a client becomes the latest active client of its session.
4646.It client-attached
4647Run when a client is attached.
4648.It client-detached
4649Run when a client is detached
4650.It client-focus-in
4651Run when focus enters a client
4652.It client-focus-out
4653Run when focus exits a client
4654.It client-resized
4655Run when a client is resized.
4656.It client-session-changed
4657Run when a client's attached session is changed.
4658.It pane-died
4659Run when the program running in a pane exits, but
4660.Ic remain-on-exit
4661is on so the pane has not closed.
4662.It pane-exited
4663Run when the program running in a pane exits.
4664.It pane-focus-in
4665Run when the focus enters a pane, if the
4666.Ic focus-events
4667option is on.
4668.It pane-focus-out
4669Run when the focus exits a pane, if the
4670.Ic focus-events
4671option is on.
4672.It pane-set-clipboard
4673Run when the terminal clipboard is set using the
4674.Xr xterm 1
4675escape sequence.
4676.It session-created
4677Run when a new session created.
4678.It session-closed
4679Run when a session closed.
4680.It session-renamed
4681Run when a session is renamed.
4682.It window-linked
4683Run when a window is linked into a session.
4684.It window-renamed
4685Run when a window is renamed.
4686.It window-resized
4687Run when a window is resized.
4688This may be after the
4689.Ar client-resized
4690hook is run.
4691.It window-unlinked
4692Run when a window is unlinked from a session.
4693.El
4694.Pp
4695Hooks are managed with these commands:
4696.Bl -tag -width Ds
4697.It Xo Ic set-hook
4698.Op Fl agpRuw
4699.Op Fl t Ar target-pane
4700.Ar hook-name
4701.Ar command
4702.Xc
4703Without
4704.Fl R ,
4705sets (or with
4706.Fl u
4707unsets) hook
4708.Ar hook-name
4709to
4710.Ar command .
4711The flags are the same as for
4712.Ic set-option .
4713.Pp
4714With
4715.Fl R ,
4716run
4717.Ar hook-name
4718immediately.
4719.It Xo Ic show-hooks
4720.Op Fl gpw
4721.Op Fl t Ar target-pane
4722.Xc
4723Shows hooks.
4724The flags are the same as for
4725.Ic show-options .
4726.El
4727.Sh MOUSE SUPPORT
4728If the
4729.Ic mouse
4730option is on (the default is off),
4731.Nm
4732allows mouse events to be bound as keys.
4733The name of each key is made up of a mouse event (such as
4734.Ql MouseUp1 )
4735and a location suffix, one of the following:
4736.Bl -column "XXXXXXXXXXXXX" -offset indent
4737.It Li "Pane" Ta "the contents of a pane"
4738.It Li "Border" Ta "a pane border"
4739.It Li "Status" Ta "the status line window list"
4740.It Li "StatusLeft" Ta "the left part of the status line"
4741.It Li "StatusRight" Ta "the right part of the status line"
4742.It Li "StatusDefault" Ta "any other part of the status line"
4743.El
4744.Pp
4745The following mouse events are available:
4746.Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent
4747.It Li "WheelUp" Ta "WheelDown" Ta ""
4748.It Li "MouseDown1" Ta "MouseUp1" Ta "MouseDrag1" Ta "MouseDragEnd1"
4749.It Li "MouseDown2" Ta "MouseUp2" Ta "MouseDrag2" Ta "MouseDragEnd2"
4750.It Li "MouseDown3" Ta "MouseUp3" Ta "MouseDrag3" Ta "MouseDragEnd3"
4751.It Li "SecondClick1" Ta "SecondClick2" Ta "SecondClick3"
4752.It Li "DoubleClick1" Ta "DoubleClick2" Ta "DoubleClick3"
4753.It Li "TripleClick1" Ta "TripleClick2" Ta "TripleClick3"
4754.El
4755.Pp
4756The
4757.Ql SecondClick
4758events are fired for the second click of a double click, even if there may be a
4759third click which will fire
4760.Ql TripleClick
4761instead of
4762.Ql DoubleClick .
4763.Pp
4764Each should be suffixed with a location, for example
4765.Ql MouseDown1Status .
4766.Pp
4767The special token
4768.Ql {mouse}
4769or
4770.Ql =
4771may be used as
4772.Ar target-window
4773or
4774.Ar target-pane
4775in commands bound to mouse key bindings.
4776It resolves to the window or pane over which the mouse event took place
4777(for example, the window in the status line over which button 1 was released for a
4778.Ql MouseUp1Status
4779binding, or the pane over which the wheel was scrolled for a
4780.Ql WheelDownPane
4781binding).
4782.Pp
4783The
4784.Ic send-keys
4785.Fl M
4786flag may be used to forward a mouse event to a pane.
4787.Pp
4788The default key bindings allow the mouse to be used to select and resize panes,
4789to copy text and to change window using the status line.
4790These take effect if the
4791.Ic mouse
4792option is turned on.
4793.Sh FORMATS
4794Certain commands accept the
4795.Fl F
4796flag with a
4797.Ar format
4798argument.
4799This is a string which controls the output format of the command.
4800Format variables are enclosed in
4801.Ql #{
4802and
4803.Ql } ,
4804for example
4805.Ql #{session_name} .
4806The possible variables are listed in the table below, or the name of a
4807.Nm
4808option may be used for an option's value.
4809Some variables have a shorter alias such as
4810.Ql #S ;
4811.Ql ##
4812is replaced by a single
4813.Ql # ,
4814.Ql #,
4815by a
4816.Ql \&,
4817and
4818.Ql #}
4819by a
4820.Ql } .
4821.Pp
4822Conditionals are available by prefixing with
4823.Ql \&?
4824and separating two alternatives with a comma;
4825if the specified variable exists and is not zero, the first alternative
4826is chosen, otherwise the second is used.
4827For example
4828.Ql #{?session_attached,attached,not attached}
4829will include the string
4830.Ql attached
4831if the session is attached and the string
4832.Ql not attached
4833if it is unattached, or
4834.Ql #{?automatic-rename,yes,no}
4835will include
4836.Ql yes
4837if
4838.Ic automatic-rename
4839is enabled, or
4840.Ql no
4841if not.
4842Conditionals can be nested arbitrarily.
4843Inside a conditional,
4844.Ql \&,
4845and
4846.Ql }
4847must be escaped as
4848.Ql #,
4849and
4850.Ql #} ,
4851unless they are part of a
4852.Ql #{...}
4853replacement.
4854For example:
4855.Bd -literal -offset indent
4856#{?pane_in_mode,#[fg=white#,bg=red],#[fg=red#,bg=white]}#W .
4857.Ed
4858.Pp
4859String comparisons may be expressed by prefixing two comma-separated
4860alternatives by
4861.Ql == ,
4862.Ql != ,
4863.Ql < ,
4864.Ql > ,
4865.Ql <=
4866or
4867.Ql >=
4868and a colon.
4869For example
4870.Ql #{==:#{host},myhost}
4871will be replaced by
4872.Ql 1
4873if running on
4874.Ql myhost ,
4875otherwise by
4876.Ql 0 .
4877.Ql ||
4878and
4879.Ql &&
4880evaluate to true if either or both of two comma-separated alternatives are
4881true, for example
4882.Ql #{||:#{pane_in_mode},#{alternate_on}} .
4883.Pp
4884An
4885.Ql m
4886specifies an
4887.Xr fnmatch 3
4888or regular expression comparison.
4889The first argument is the pattern and the second the string to compare.
4890An optional argument specifies flags:
4891.Ql r
4892means the pattern is a regular expression instead of the default
4893.Xr fnmatch 3
4894pattern, and
4895.Ql i
4896means to ignore case.
4897For example:
4898.Ql #{m:*foo*,#{host}}
4899or
4900.Ql #{m/ri:^A,MYVAR} .
4901A
4902.Ql C
4903performs a search for an
4904.Xr fnmatch 3
4905pattern or regular expression in the pane content and evaluates to zero if not
4906found, or a line number if found.
4907Like
4908.Ql m ,
4909an
4910.Ql r
4911flag means search for a regular expression and
4912.Ql i
4913ignores case.
4914For example:
4915.Ql #{C/r:^Start}
4916.Pp
4917Numeric operators may be performed by prefixing two comma-separated alternatives with an
4918.Ql e
4919and an operator.
4920An optional
4921.Ql f
4922flag may be given after the operator to use floating point numbers, otherwise integers are used.
4923This may be followed by a number giving the number of decimal places to use for the result.
4924The available operators are:
4925addition
4926.Ql + ,
4927subtraction
4928.Ql - ,
4929multiplication
4930.Ql * ,
4931division
4932.Ql / ,
4933modulus
4934.Ql m
4935or
4936.Ql %
4937(note that
4938.Ql %
4939must be escaped as
4940.Ql %%
4941in formats which are also expanded by
4942.Xr strftime 3 )
4943and numeric comparison operators
4944.Ql == ,
4945.Ql != ,
4946.Ql < ,
4947.Ql <= ,
4948.Ql >
4949and
4950.Ql >= .
4951For example,
4952.Ql #{e|*|f|4:5.5,3}
4953multiplies 5.5 by 3 for a result with four decimal places and
4954.Ql #{e|%%:7,3}
4955returns the modulus of 7 and 3.
4956.Ql a
4957replaces a numeric argument by its ASCII equivalent, so
4958.Ql #{a:98}
4959results in
4960.Ql b .
4961.Ql c
4962replaces a
4963.Nm
4964colour by its six-digit hexadecimal RGB value.
4965.Pp
4966A limit may be placed on the length of the resultant string by prefixing it
4967by an
4968.Ql = ,
4969a number and a colon.
4970Positive numbers count from the start of the string and negative from the end,
4971so
4972.Ql #{=5:pane_title}
4973will include at most the first five characters of the pane title, or
4974.Ql #{=-5:pane_title}
4975the last five characters.
4976A suffix or prefix may be given as a second argument - if provided then it is
4977appended or prepended to the string if the length has been trimmed, for example
4978.Ql #{=/5/...:pane_title}
4979will append
4980.Ql ...
4981if the pane title is more than five characters.
4982Similarly,
4983.Ql p
4984pads the string to a given width, for example
4985.Ql #{p10:pane_title}
4986will result in a width of at least 10 characters.
4987A positive width pads on the left, a negative on the right.
4988.Ql n
4989expands to the length of the variable and
4990.Ql w
4991to its width when displayed, for example
4992.Ql #{n:window_name} .
4993.Pp
4994Prefixing a time variable with
4995.Ql t:\&
4996will convert it to a string, so if
4997.Ql #{window_activity}
4998gives
4999.Ql 1445765102 ,
5000.Ql #{t:window_activity}
5001gives
5002.Ql Sun Oct 25 09:25:02 2015 .
5003Adding
5004.Ql p (
5005.Ql `t/p` )
5006will use shorter but less accurate time format for times in the past.
5007A custom format may be given using an
5008.Ql f
5009suffix (note that
5010.Ql %
5011must be escaped as
5012.Ql %%
5013if the format is separately being passed through
5014.Xr strftime 3 ,
5015for example in the
5016.Ic status-left
5017option):
5018.Ql #{t/f/%%H#:%%M:window_activity} ,
5019see
5020.Xr strftime 3 .
5021.Pp
5022The
5023.Ql b:\&
5024and
5025.Ql d:\&
5026prefixes are
5027.Xr basename 3
5028and
5029.Xr dirname 3
5030of the variable respectively.
5031.Ql q:\&
5032will escape
5033.Xr sh 1
5034special characters or with a
5035.Ql h
5036suffix, escape hash characters (so
5037.Ql #
5038becomes
5039.Ql ## ) .
5040.Ql E:\&
5041will expand the format twice, for example
5042.Ql #{E:status-left}
5043is the result of expanding the content of the
5044.Ic status-left
5045option rather than the option itself.
5046.Ql T:\&
5047is like
5048.Ql E:\&
5049but also expands
5050.Xr strftime 3
5051specifiers.
5052.Ql S:\& ,
5053.Ql W:\&
5054or
5055.Ql P:\&
5056will loop over each session, window or pane and insert the format once
5057for each.
5058For windows and panes, two comma-separated formats may be given:
5059the second is used for the current window or active pane.
5060For example, to get a list of windows formatted like the status line:
5061.Bd -literal -offset indent
5062#{W:#{E:window-status-format} ,#{E:window-status-current-format} }
5063.Ed
5064.Pp
5065.Ql N:\&
5066checks if a window (without any suffix or with the
5067.Ql w
5068suffix) or a session (with the
5069.Ql s
5070suffix) name exists, for example
5071.Ql `N/w:foo`
5072is replaced with 1 if a window named
5073.Ql foo
5074exists.
5075.Pp
5076A prefix of the form
5077.Ql s/foo/bar/:\&
5078will substitute
5079.Ql foo
5080with
5081.Ql bar
5082throughout.
5083The first argument may be an extended regular expression and a final argument may be
5084.Ql i
5085to ignore case, for example
5086.Ql s/a(.)/\e1x/i:\&
5087would change
5088.Ql abABab
5089into
5090.Ql bxBxbx .
5091A different delimiter character may also be used, to avoid collisions with
5092literal slashes in the pattern.
5093For example,
5094.Ql s|foo/|bar/|:
5095will substitute
5096.Ql foo/
5097with
5098.Ql bar/
5099throughout.
5100.Pp
5101In addition, the last line of a shell command's output may be inserted using
5102.Ql #() .
5103For example,
5104.Ql #(uptime)
5105will insert the system's uptime.
5106When constructing formats,
5107.Nm
5108does not wait for
5109.Ql #()
5110commands to finish; instead, the previous result from running the same command is used,
5111or a placeholder if the command has not been run before.
5112If the command hasn't exited, the most recent line of output will be used, but the status
5113line will not be updated more than once a second.
5114Commands are executed using
5115.Pa /bin/sh
5116and with the
5117.Nm
5118global environment set (see the
5119.Sx GLOBAL AND SESSION ENVIRONMENT
5120section).
5121.Pp
5122An
5123.Ql l
5124specifies that a string should be interpreted literally and not expanded.
5125For example
5126.Ql #{l:#{?pane_in_mode,yes,no}}
5127will be replaced by
5128.Ql #{?pane_in_mode,yes,no} .
5129.Pp
5130The following variables are available, where appropriate:
5131.Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX"
5132.It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with"
5133.It Li "active_window_index" Ta "" Ta "Index of active window in session"
5134.It Li "alternate_on" Ta "" Ta "1 if pane is in alternate screen"
5135.It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen"
5136.It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen"
5137.It Li "buffer_created" Ta "" Ta "Time buffer created"
5138.It Li "buffer_name" Ta "" Ta "Name of buffer"
5139.It Li "buffer_sample" Ta "" Ta "Sample of start of buffer"
5140.It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes"
5141.It Li "client_activity" Ta "" Ta "Time client last had activity"
5142.It Li "client_cell_height" Ta "" Ta "Height of each client cell in pixels"
5143.It Li "client_cell_width" Ta "" Ta "Width of each client cell in pixels"
5144.It Li "client_control_mode" Ta "" Ta "1 if client is in control mode"
5145.It Li "client_created" Ta "" Ta "Time client created"
5146.It Li "client_discarded" Ta "" Ta "Bytes discarded when client behind"
5147.It Li "client_flags" Ta "" Ta "List of client flags"
5148.It Li "client_height" Ta "" Ta "Height of client"
5149.It Li "client_key_table" Ta "" Ta "Current key table"
5150.It Li "client_last_session" Ta "" Ta "Name of the client's last session"
5151.It Li "client_name" Ta "" Ta "Name of client"
5152.It Li "client_pid" Ta "" Ta "PID of client process"
5153.It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed"
5154.It Li "client_readonly" Ta "" Ta "1 if client is read-only"
5155.It Li "client_session" Ta "" Ta "Name of the client's session"
5156.It Li "client_termfeatures" Ta "" Ta "Terminal features of client, if any"
5157.It Li "client_termname" Ta "" Ta "Terminal name of client"
5158.It Li "client_termtype" Ta "" Ta "Terminal type of client, if available"
5159.It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
5160.It Li "client_uid" Ta "" Ta "UID of client process"
5161.It Li "client_user" Ta "" Ta "User of client process"
5162.It Li "client_utf8" Ta "" Ta "1 if client supports UTF-8"
5163.It Li "client_width" Ta "" Ta "Width of client"
5164.It Li "client_written" Ta "" Ta "Bytes written to client"
5165.It Li "command" Ta "" Ta "Name of command in use, if any"
5166.It Li "command_list_alias" Ta "" Ta "Command alias if listing commands"
5167.It Li "command_list_name" Ta "" Ta "Command name if listing commands"
5168.It Li "command_list_usage" Ta "" Ta "Command usage if listing commands"
5169.It Li "config_files" Ta "" Ta "List of configuration files loaded"
5170.It Li "copy_cursor_line" Ta "" Ta "Line the cursor is on in copy mode"
5171.It Li "copy_cursor_word" Ta "" Ta "Word under cursor in copy mode"
5172.It Li "copy_cursor_x" Ta "" Ta "Cursor X position in copy mode"
5173.It Li "copy_cursor_y" Ta "" Ta "Cursor Y position in copy mode"
5174.It Li "current_file" Ta "" Ta "Current configuration file"
5175.It Li "cursor_character" Ta "" Ta "Character at cursor in pane"
5176.It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
5177.It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
5178.It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"
5179.It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
5180.It Li "history_limit" Ta "" Ta "Maximum window history lines"
5181.It Li "history_size" Ta "" Ta "Size of history in lines"
5182.It Li "hook" Ta "" Ta "Name of running hook, if any"
5183.It Li "hook_client" Ta "" Ta "Name of client where hook was run, if any"
5184.It Li "hook_pane" Ta "" Ta "ID of pane where hook was run, if any"
5185.It Li "hook_session" Ta "" Ta "ID of session where hook was run, if any"
5186.It Li "hook_session_name" Ta "" Ta "Name of session where hook was run, if any"
5187.It Li "hook_window" Ta "" Ta "ID of window where hook was run, if any"
5188.It Li "hook_window_name" Ta "" Ta "Name of window where hook was run, if any"
5189.It Li "host" Ta "#H" Ta "Hostname of local host"
5190.It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)"
5191.It Li "insert_flag" Ta "" Ta "Pane insert flag"
5192.It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag"
5193.It Li "keypad_flag" Ta "" Ta "Pane keypad flag"
5194.It Li "last_window_index" Ta "" Ta "Index of last window in session"
5195.It Li "line" Ta "" Ta "Line number in the list"
5196.It Li "mouse_all_flag" Ta "" Ta "Pane mouse all flag"
5197.It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag"
5198.It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag"
5199.It Li "mouse_hyperlink" Ta "" Ta "Hyperlink under mouse, if any"
5200.It Li "mouse_line" Ta "" Ta "Line under mouse, if any"
5201.It Li "mouse_sgr_flag" Ta "" Ta "Pane mouse SGR flag"
5202.It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
5203.It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
5204.It Li "mouse_word" Ta "" Ta "Word under mouse, if any"
5205.It Li "mouse_x" Ta "" Ta "Mouse X position, if any"
5206.It Li "mouse_y" Ta "" Ta "Mouse Y position, if any"
5207.It Li "next_session_id" Ta "" Ta "Unique session ID for next new session"
5208.It Li "origin_flag" Ta "" Ta "Pane origin flag"
5209.It Li "pane_active" Ta "" Ta "1 if active pane"
5210.It Li "pane_at_bottom" Ta "" Ta "1 if pane is at the bottom of window"
5211.It Li "pane_at_left" Ta "" Ta "1 if pane is at the left of window"
5212.It Li "pane_at_right" Ta "" Ta "1 if pane is at the right of window"
5213.It Li "pane_at_top" Ta "" Ta "1 if pane is at the top of window"
5214.It Li "pane_bg" Ta "" Ta "Pane background colour"
5215.It Li "pane_bottom" Ta "" Ta "Bottom of pane"
5216.It Li "pane_current_command" Ta "" Ta "Current command if available"
5217.It Li "pane_current_path" Ta "" Ta "Current path if available"
5218.It Li "pane_dead" Ta "" Ta "1 if pane is dead"
5219.It Li "pane_dead_signal" Ta "" Ta "Exit signal of process in dead pane"
5220.It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane"
5221.It Li "pane_dead_time" Ta "" Ta "Exit time of process in dead pane"
5222.It Li "pane_fg" Ta "" Ta "Pane foreground colour"
5223.It Li "pane_format" Ta "" Ta "1 if format is for a pane"
5224.It Li "pane_height" Ta "" Ta "Height of pane"
5225.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
5226.It Li "pane_in_mode" Ta "" Ta "1 if pane is in a mode"
5227.It Li "pane_index" Ta "#P" Ta "Index of pane"
5228.It Li "pane_input_off" Ta "" Ta "1 if input to pane is disabled"
5229.It Li "pane_last" Ta "" Ta "1 if last pane"
5230.It Li "pane_left" Ta "" Ta "Left of pane"
5231.It Li "pane_marked" Ta "" Ta "1 if this is the marked pane"
5232.It Li "pane_marked_set" Ta "" Ta "1 if a marked pane is set"
5233.It Li "pane_mode" Ta "" Ta "Name of pane mode, if any"
5234.It Li "pane_path" Ta "" Ta "Path of pane (can be set by application)"
5235.It Li "pane_pid" Ta "" Ta "PID of first process in pane"
5236.It Li "pane_pipe" Ta "" Ta "1 if pane is being piped"
5237.It Li "pane_right" Ta "" Ta "Right of pane"
5238.It Li "pane_search_string" Ta "" Ta "Last search string in copy mode"
5239.It Li "pane_start_command" Ta "" Ta "Command pane started with"
5240.It Li "pane_start_path" Ta "" Ta "Path pane started with"
5241.It Li "pane_synchronized" Ta "" Ta "1 if pane is synchronized"
5242.It Li "pane_tabs" Ta "" Ta "Pane tab positions"
5243.It Li "pane_title" Ta "#T" Ta "Title of pane (can be set by application)"
5244.It Li "pane_top" Ta "" Ta "Top of pane"
5245.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
5246.It Li "pane_width" Ta "" Ta "Width of pane"
5247.It Li "pid" Ta "" Ta "Server PID"
5248.It Li "rectangle_toggle" Ta "" Ta "1 if rectangle selection is activated"
5249.It Li "scroll_position" Ta "" Ta "Scroll position in copy mode"
5250.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
5251.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
5252.It Li "search_match" Ta "" Ta "Search match if any"
5253.It Li "search_present" Ta "" Ta "1 if search started in copy mode"
5254.It Li "selection_active" Ta "" Ta "1 if selection started and changes with the cursor in copy mode"
5255.It Li "selection_end_x" Ta "" Ta "X position of the end of the selection"
5256.It Li "selection_end_y" Ta "" Ta "Y position of the end of the selection"
5257.It Li "selection_present" Ta "" Ta "1 if selection started in copy mode"
5258.It Li "selection_start_x" Ta "" Ta "X position of the start of the selection"
5259.It Li "selection_start_y" Ta "" Ta "Y position of the start of the selection"
5260.It Li "session_activity" Ta "" Ta "Time of session last activity"
5261.It Li "session_alerts" Ta "" Ta "List of window indexes with alerts"
5262.It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
5263.It Li "session_attached_list" Ta "" Ta "List of clients session is attached to"
5264.It Li "session_created" Ta "" Ta "Time session created"
5265.It Li "session_format" Ta "" Ta "1 if format is for a session"
5266.It Li "session_group" Ta "" Ta "Name of session group"
5267.It Li "session_group_attached" Ta "" Ta "Number of clients sessions in group are attached to"
5268.It Li "session_group_attached_list" Ta "" Ta "List of clients sessions in group are attached to"
5269.It Li "session_group_list" Ta "" Ta "List of sessions in group"
5270.It Li "session_group_many_attached" Ta "" Ta "1 if multiple clients attached to sessions in group"
5271.It Li "session_group_size" Ta "" Ta "Size of session group"
5272.It Li "session_grouped" Ta "" Ta "1 if session in a group"
5273.It Li "session_id" Ta "" Ta "Unique session ID"
5274.It Li "session_last_attached" Ta "" Ta "Time session last attached"
5275.It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached"
5276.It Li "session_marked" Ta "" Ta "1 if this session contains the marked pane"
5277.It Li "session_name" Ta "#S" Ta "Name of session"
5278.It Li "session_path" Ta "" Ta "Working directory of session"
5279.It Li "session_stack" Ta "" Ta "Window indexes in most recent order"
5280.It Li "session_windows" Ta "" Ta "Number of windows in session"
5281.It Li "socket_path" Ta "" Ta "Server socket path"
5282.It Li "start_time" Ta "" Ta "Server start time"
5283.It Li "uid" Ta "" Ta "Server UID"
5284.It Li "user" Ta "" Ta "Server user"
5285.It Li "version" Ta "" Ta "Server version"
5286.It Li "window_active" Ta "" Ta "1 if window active"
5287.It Li "window_active_clients" Ta "" Ta "Number of clients viewing this window"
5288.It Li "window_active_clients_list" Ta "" Ta "List of clients viewing this window"
5289.It Li "window_active_sessions" Ta "" Ta "Number of sessions on which this window is active"
5290.It Li "window_active_sessions_list" Ta "" Ta "List of sessions on which this window is active"
5291.It Li "window_activity" Ta "" Ta "Time of window last activity"
5292.It Li "window_activity_flag" Ta "" Ta "1 if window has activity"
5293.It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
5294.It Li "window_bigger" Ta "" Ta "1 if window is larger than client"
5295.It Li "window_cell_height" Ta "" Ta "Height of each cell in pixels"
5296.It Li "window_cell_width" Ta "" Ta "Width of each cell in pixels"
5297.It Li "window_end_flag" Ta "" Ta "1 if window has the highest index"
5298.It Li "window_flags" Ta "#F" Ta "Window flags with # escaped as ##"
5299.It Li "window_format" Ta "" Ta "1 if format is for a window"
5300.It Li "window_height" Ta "" Ta "Height of window"
5301.It Li "window_id" Ta "" Ta "Unique window ID"
5302.It Li "window_index" Ta "#I" Ta "Index of window"
5303.It Li "window_last_flag" Ta "" Ta "1 if window is the last used"
5304.It Li "window_layout" Ta "" Ta "Window layout description, ignoring zoomed window panes"
5305.It Li "window_linked" Ta "" Ta "1 if window is linked across sessions"
5306.It Li "window_linked_sessions" Ta "" Ta "Number of sessions this window is linked to"
5307.It Li "window_linked_sessions_list" Ta "" Ta "List of sessions this window is linked to"
5308.It Li "window_marked_flag" Ta "" Ta "1 if window contains the marked pane"
5309.It Li "window_name" Ta "#W" Ta "Name of window"
5310.It Li "window_offset_x" Ta "" Ta "X offset into window if larger than client"
5311.It Li "window_offset_y" Ta "" Ta "Y offset into window if larger than client"
5312.It Li "window_panes" Ta "" Ta "Number of panes in window"
5313.It Li "window_raw_flags" Ta "" Ta "Window flags with nothing escaped"
5314.It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
5315.It Li "window_stack_index" Ta "" Ta "Index in session most recent stack"
5316.It Li "window_start_flag" Ta "" Ta "1 if window has the lowest index"
5317.It Li "window_visible_layout" Ta "" Ta "Window layout description, respecting zoomed window panes"
5318.It Li "window_width" Ta "" Ta "Width of window"
5319.It Li "window_zoomed_flag" Ta "" Ta "1 if window is zoomed"
5320.It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
5321.El
5322.Sh STYLES
5323.Nm
5324offers various options to specify the colour and attributes of aspects of the
5325interface, for example
5326.Ic status-style
5327for the status line.
5328In addition, embedded styles may be specified in format options, such as
5329.Ic status-left ,
5330by enclosing them in
5331.Ql #[
5332and
5333.Ql \&] .
5334.Pp
5335A style may be the single term
5336.Ql default
5337to specify the default style (which may come from an option, for example
5338.Ic status-style
5339in the status line) or a space
5340or comma separated list of the following:
5341.Bl -tag -width Ds
5342.It Ic fg=colour
5343Set the foreground colour.
5344The colour is one of:
5345.Ic black ,
5346.Ic red ,
5347.Ic green ,
5348.Ic yellow ,
5349.Ic blue ,
5350.Ic magenta ,
5351.Ic cyan ,
5352.Ic white ;
5353if supported the bright variants
5354.Ic brightred ,
5355.Ic brightgreen ,
5356.Ic brightyellow ;
5357.Ic colour0
5358to
5359.Ic colour255
5360from the 256-colour set;
5361.Ic default
5362for the default colour;
5363.Ic terminal
5364for the terminal default colour; or a hexadecimal RGB string such as
5365.Ql #ffffff .
5366.It Ic bg=colour
5367Set the background colour.
5368.It Ic none
5369Set no attributes (turn off any active attributes).
5370.It Xo Ic acs ,
5371.Ic bright
5372(or
5373.Ic bold ) ,
5374.Ic dim ,
5375.Ic underscore ,
5376.Ic blink ,
5377.Ic reverse ,
5378.Ic hidden ,
5379.Ic italics ,
5380.Ic overline ,
5381.Ic strikethrough ,
5382.Ic double-underscore ,
5383.Ic curly-underscore ,
5384.Ic dotted-underscore ,
5385.Ic dashed-underscore
5386.Xc
5387Set an attribute.
5388Any of the attributes may be prefixed with
5389.Ql no
5390to unset.
5391.Ic acs
5392is the terminal alternate character set.
5393.It Xo Ic align=left
5394(or
5395.Ic noalign ) ,
5396.Ic align=centre ,
5397.Ic align=right
5398.Xc
5399Align text to the left, centre or right of the available space if appropriate.
5400.It Ic fill=colour
5401Fill the available space with a background colour if appropriate.
5402.It Xo Ic list=on ,
5403.Ic list=focus ,
5404.Ic list=left-marker ,
5405.Ic list=right-marker ,
5406.Ic nolist
5407.Xc
5408Mark the position of the various window list components in the
5409.Ic status-format
5410option:
5411.Ic list=on
5412marks the start of the list;
5413.Ic list=focus
5414is the part of the list that should be kept in focus if the entire list won't fit
5415in the available space (typically the current window);
5416.Ic list=left-marker
5417and
5418.Ic list=right-marker
5419mark the text to be used to mark that text has been trimmed from the left or
5420right of the list if there is not enough space.
5421.It Xo Ic push-default ,
5422.Ic pop-default
5423.Xc
5424Store the current colours and attributes as the default or reset to the previous
5425default.
5426A
5427.Ic push-default
5428affects any subsequent use of the
5429.Ic default
5430term until a
5431.Ic pop-default .
5432Only one default may be pushed (each
5433.Ic push-default
5434replaces the previous saved default).
5435.It Xo Ic range=left ,
5436.Ic range=right ,
5437.Ic range=window|X ,
5438.Ic norange
5439.Xc
5440Mark a range in the
5441.Ic status-format
5442option.
5443.Ic range=left
5444and
5445.Ic range=right
5446are the text used for the
5447.Ql StatusLeft
5448and
5449.Ql StatusRight
5450mouse keys.
5451.Ic range=window|X
5452is the range for a window passed to the
5453.Ql Status
5454mouse key, where
5455.Ql X
5456is a window index.
5457.El
5458.Pp
5459Examples are:
5460.Bd -literal -offset indent
5461fg=yellow bold underscore blink
5462bg=black,fg=default,noreverse
5463.Ed
5464.Sh NAMES AND TITLES
5465.Nm
5466distinguishes between names and titles.
5467Windows and sessions have names, which may be used to specify them in targets
5468and are displayed in the status line and various lists: the name is the
5469.Nm
5470identifier for a window or session.
5471Only panes have titles.
5472A pane's title is typically set by the program running inside the pane using
5473an escape sequence (like it would set the
5474.Xr xterm 1
5475window title in
5476.Xr X 7 ) .
5477Windows themselves do not have titles - a window's title is the title of its
5478active pane.
5479.Nm
5480itself may set the title of the terminal in which the client is running, see
5481the
5482.Ic set-titles
5483option.
5484.Pp
5485A session's name is set with the
5486.Ic new-session
5487and
5488.Ic rename-session
5489commands.
5490A window's name is set with one of:
5491.Bl -enum -width Ds
5492.It
5493A command argument (such as
5494.Fl n
5495for
5496.Ic new-window
5497or
5498.Ic new-session ) .
5499.It
5500An escape sequence (if the
5501.Ic allow-rename
5502option is turned on):
5503.Bd -literal -offset indent
5504$ printf '\e033kWINDOW_NAME\e033\e\e'
5505.Ed
5506.It
5507Automatic renaming, which sets the name to the active command in the window's
5508active pane.
5509See the
5510.Ic automatic-rename
5511option.
5512.El
5513.Pp
5514When a pane is first created, its title is the hostname.
5515A pane's title can be set via the title setting escape sequence, for example:
5516.Bd -literal -offset indent
5517$ printf '\e033]2;My Title\e033\e\e'
5518.Ed
5519.Pp
5520It can also be modified with the
5521.Ic select-pane
5522.Fl T
5523command.
5524.Sh GLOBAL AND SESSION ENVIRONMENT
5525When the server is started,
5526.Nm
5527copies the environment into the
5528.Em global environment ;
5529in addition, each session has a
5530.Em session environment .
5531When a window is created, the session and global environments are merged.
5532If a variable exists in both, the value from the session environment is used.
5533The result is the initial environment passed to the new process.
5534.Pp
5535The
5536.Ic update-environment
5537session option may be used to update the session environment from the client
5538when a new session is created or an old reattached.
5539.Nm
5540also initialises the
5541.Ev TMUX
5542variable with some internal information to allow commands to be executed
5543from inside, and the
5544.Ev TERM
5545variable with the correct terminal setting of
5546.Ql screen .
5547.Pp
5548Variables in both session and global environments may be marked as hidden.
5549Hidden variables are not passed into the environment of new processes and
5550instead can only be used by tmux itself (for example in formats, see the
5551.Sx FORMATS
5552section).
5553.Pp
5554Commands to alter and view the environment are:
5555.Bl -tag -width Ds
5556.Tg setenv
5557.It Xo Ic set-environment
5558.Op Fl Fhgru
5559.Op Fl t Ar target-session
5560.Ar name Op Ar value
5561.Xc
5562.D1 Pq alias: Ic setenv
5563Set or unset an environment variable.
5564If
5565.Fl g
5566is used, the change is made in the global environment; otherwise, it is applied
5567to the session environment for
5568.Ar target-session .
5569If
5570.Fl F
5571is present, then
5572.Ar value
5573is expanded as a format.
5574The
5575.Fl u
5576flag unsets a variable.
5577.Fl r
5578indicates the variable is to be removed from the environment before starting a
5579new process.
5580.Fl h
5581marks the variable as hidden.
5582.Tg showenv
5583.It Xo Ic show-environment
5584.Op Fl hgs
5585.Op Fl t Ar target-session
5586.Op Ar variable
5587.Xc
5588.D1 Pq alias: Ic showenv
5589Display the environment for
5590.Ar target-session
5591or the global environment with
5592.Fl g .
5593If
5594.Ar variable
5595is omitted, all variables are shown.
5596Variables removed from the environment are prefixed with
5597.Ql - .
5598If
5599.Fl s
5600is used, the output is formatted as a set of Bourne shell commands.
5601.Fl h
5602shows hidden variables (omitted by default).
5603.El
5604.Sh STATUS LINE
5605.Nm
5606includes an optional status line which is displayed in the bottom line of each
5607terminal.
5608.Pp
5609By default, the status line is enabled and one line in height (it may be
5610disabled or made multiple lines with the
5611.Ic status
5612session option) and contains, from left-to-right: the name of the current
5613session in square brackets; the window list; the title of the active pane
5614in double quotes; and the time and date.
5615.Pp
5616Each line of the status line is configured with the
5617.Ic status-format
5618option.
5619The default is made of three parts: configurable left and right sections (which
5620may contain dynamic content such as the time or output from a shell command,
5621see the
5622.Ic status-left ,
5623.Ic status-left-length ,
5624.Ic status-right ,
5625and
5626.Ic status-right-length
5627options below), and a central window list.
5628By default, the window list shows the index, name and (if any) flag of the
5629windows present in the current session in ascending numerical order.
5630It may be customised with the
5631.Ar window-status-format
5632and
5633.Ar window-status-current-format
5634options.
5635The flag is one of the following symbols appended to the window name:
5636.Bl -column "Symbol" "Meaning" -offset indent
5637.It Sy "Symbol" Ta Sy "Meaning"
5638.It Li "*" Ta "Denotes the current window."
5639.It Li "-" Ta "Marks the last window (previously selected)."
5640.It Li "#" Ta "Window activity is monitored and activity has been detected."
5641.It Li "\&!" Ta "Window bells are monitored and a bell has occurred in the window."
5642.It Li "~" Ta "The window has been silent for the monitor-silence interval."
5643.It Li "M" Ta "The window contains the marked pane."
5644.It Li "Z" Ta "The window's active pane is zoomed."
5645.El
5646.Pp
5647The # symbol relates to the
5648.Ic monitor-activity
5649window option.
5650The window name is printed in inverted colours if an alert (bell, activity or
5651silence) is present.
5652.Pp
5653The colour and attributes of the status line may be configured, the entire
5654status line using the
5655.Ic status-style
5656session option and individual windows using the
5657.Ic window-status-style
5658window option.
5659.Pp
5660The status line is automatically refreshed at interval if it has changed, the
5661interval may be controlled with the
5662.Ic status-interval
5663session option.
5664.Pp
5665Commands related to the status line are as follows:
5666.Bl -tag -width Ds
5667.Tg clearphist
5668.It Xo Ic clear-prompt-history
5669.Op Fl T Ar prompt-type
5670.Xc
5671.D1 Pq alias: Ic clearphist
5672Clear status prompt history for prompt type
5673.Ar prompt-type .
5674If
5675.Fl T
5676is omitted, then clear history for all types.
5677See
5678.Ic command-prompt
5679for possible values for
5680.Ar prompt-type .
5681.It Xo Ic command-prompt
5682.Op Fl 1bFikN
5683.Op Fl I Ar inputs
5684.Op Fl p Ar prompts
5685.Op Fl t Ar target-client
5686.Op Fl T Ar prompt-type
5687.Op Ar template
5688.Xc
5689Open the command prompt in a client.
5690This may be used from inside
5691.Nm
5692to execute commands interactively.
5693.Pp
5694If
5695.Ar template
5696is specified, it is used as the command.
5697With
5698.Fl F ,
5699.Ar template
5700is expanded as a format.
5701.Pp
5702If present,
5703.Fl I
5704is a comma-separated list of the initial text for each prompt.
5705If
5706.Fl p
5707is given,
5708.Ar prompts
5709is a comma-separated list of prompts which are displayed in order; otherwise
5710a single prompt is displayed, constructed from
5711.Ar template
5712if it is present, or
5713.Ql \&:
5714if not.
5715.Pp
5716Before the command is executed, the first occurrence of the string
5717.Ql %%
5718and all occurrences of
5719.Ql %1
5720are replaced by the response to the first prompt, all
5721.Ql %2
5722are replaced with the response to the second prompt, and so on for further
5723prompts.
5724Up to nine prompt responses may be replaced
5725.Po
5726.Ql %1
5727to
5728.Ql %9
5729.Pc .
5730.Ql %%%
5731is like
5732.Ql %%
5733but any quotation marks are escaped.
5734.Pp
5735.Fl 1
5736makes the prompt only accept one key press, in this case the resulting input
5737is a single character.
5738.Fl k
5739is like
5740.Fl 1
5741but the key press is translated to a key name.
5742.Fl N
5743makes the prompt only accept numeric key presses.
5744.Fl i
5745executes the command every time the prompt input changes instead of when the
5746user exits the command prompt.
5747.Pp
5748.Fl T
5749tells
5750.Nm
5751the prompt type.
5752This affects what completions are offered when
5753.Em Tab
5754is pressed.
5755Available types are:
5756.Ql command ,
5757.Ql search ,
5758.Ql target
5759and
5760.Ql window-target .
5761.Pp
5762The following keys have a special meaning in the command prompt, depending
5763on the value of the
5764.Ic status-keys
5765option:
5766.Bl -column "FunctionXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXX" "emacsX" -offset indent
5767.It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
5768.It Li "Cancel command prompt" Ta "q" Ta "Escape"
5769.It Li "Delete from cursor to start of word" Ta "" Ta "C-w"
5770.It Li "Delete entire command" Ta "d" Ta "C-u"
5771.It Li "Delete from cursor to end" Ta "D" Ta "C-k"
5772.It Li "Execute command" Ta "Enter" Ta "Enter"
5773.It Li "Get next command from history" Ta "" Ta "Down"
5774.It Li "Get previous command from history" Ta "" Ta "Up"
5775.It Li "Insert top paste buffer" Ta "p" Ta "C-y"
5776.It Li "Look for completions" Ta "Tab" Ta "Tab"
5777.It Li "Move cursor left" Ta "h" Ta "Left"
5778.It Li "Move cursor right" Ta "l" Ta "Right"
5779.It Li "Move cursor to end" Ta "$" Ta "C-e"
5780.It Li "Move cursor to next word" Ta "w" Ta "M-f"
5781.It Li "Move cursor to previous word" Ta "b" Ta "M-b"
5782.It Li "Move cursor to start" Ta "0" Ta "C-a"
5783.It Li "Transpose characters" Ta "" Ta "C-t"
5784.El
5785.Pp
5786With
5787.Fl b ,
5788the prompt is shown in the background and the invoking client does not exit
5789until it is dismissed.
5790.Tg confirm
5791.It Xo Ic confirm-before
5792.Op Fl b
5793.Op Fl p Ar prompt
5794.Op Fl t Ar target-client
5795.Ar command
5796.Xc
5797.D1 Pq alias: Ic confirm
5798Ask for confirmation before executing
5799.Ar command .
5800If
5801.Fl p
5802is given,
5803.Ar prompt
5804is the prompt to display; otherwise a prompt is constructed from
5805.Ar command .
5806It may contain the special character sequences supported by the
5807.Ic status-left
5808option.
5809With
5810.Fl b ,
5811the prompt is shown in the background and the invoking client does not exit
5812until it is dismissed.
5813.Tg menu
5814.It Xo Ic display-menu
5815.Op Fl O
5816.Op Fl c Ar target-client
5817.Op Fl t Ar target-pane
5818.Op Fl T Ar title
5819.Op Fl x Ar position
5820.Op Fl y Ar position
5821.Ar name
5822.Ar key
5823.Ar command Op Ar argument ...
5824.Xc
5825.D1 Pq alias: Ic menu
5826Display a menu on
5827.Ar target-client .
5828.Ar target-pane
5829gives the target for any commands run from the menu.
5830.Pp
5831A menu is passed as a series of arguments: first the menu item name,
5832second the key shortcut (or empty for none) and third the command
5833to run when the menu item is chosen.
5834The name and command are formats, see the
5835.Sx FORMATS
5836and
5837.Sx STYLES
5838sections.
5839If the name begins with a hyphen (-), then the item is disabled (shown dim) and
5840may not be chosen.
5841The name may be empty for a separator line, in which case both the key and
5842command should be omitted.
5843.Pp
5844.Fl T
5845is a format for the menu title (see
5846.Sx FORMATS ) .
5847.Pp
5848.Fl x
5849and
5850.Fl y
5851give the position of the menu.
5852Both may be a row or column number, or one of the following special values:
5853.Bl -column "XXXXX" "XXXX" -offset indent
5854.It Sy "Value" Ta Sy "Flag" Ta Sy "Meaning"
5855.It Li "C" Ta "Both" Ta "The centre of the terminal"
5856.It Li "R" Ta Fl x Ta "The right side of the terminal"
5857.It Li "P" Ta "Both" Ta "The bottom left of the pane"
5858.It Li "M" Ta "Both" Ta "The mouse position"
5859.It Li "W" Ta "Both" Ta "The window position on the status line"
5860.It Li "S" Ta Fl y Ta "The line above or below the status line"
5861.El
5862.Pp
5863Or a format, which is expanded including the following additional variables:
5864.Bl -column "XXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent
5865.It Sy "Variable name" Ta Sy "Replaced with"
5866.It Li "popup_centre_x" Ta "Centered in the client"
5867.It Li "popup_centre_y" Ta "Centered in the client"
5868.It Li "popup_height" Ta "Height of menu or popup"
5869.It Li "popup_mouse_bottom" Ta "Bottom of at the mouse"
5870.It Li "popup_mouse_centre_x" Ta "Horizontal centre at the mouse"
5871.It Li "popup_mouse_centre_y" Ta "Vertical centre at the mouse"
5872.It Li "popup_mouse_top" Ta "Top at the mouse"
5873.It Li "popup_mouse_x" Ta "Mouse X position"
5874.It Li "popup_mouse_y" Ta "Mouse Y position"
5875.It Li "popup_pane_bottom" Ta "Bottom of the pane"
5876.It Li "popup_pane_left" Ta "Left of the pane"
5877.It Li "popup_pane_right" Ta "Right of the pane"
5878.It Li "popup_pane_top" Ta "Top of the pane"
5879.It Li "popup_status_line_y" Ta "Above or below the status line"
5880.It Li "popup_width" Ta "Width of menu or popup"
5881.It Li "popup_window_status_line_x" Ta "At the window position in status line"
5882.It Li "popup_window_status_line_y" Ta "At the status line showing the window"
5883.El
5884.Pp
5885Each menu consists of items followed by a key shortcut shown in brackets.
5886If the menu is too large to fit on the terminal, it is not displayed.
5887Pressing the key shortcut chooses the corresponding item.
5888If the mouse is enabled and the menu is opened from a mouse key binding,
5889releasing the mouse button with an item selected chooses that item and
5890releasing the mouse button without an item selected closes the menu.
5891.Fl O
5892changes this behaviour so that the menu does not close when the mouse button is
5893released without an item selected the menu is not closed and a mouse button
5894must be clicked to choose an item.
5895.Pp
5896The following keys are also available:
5897.Bl -column "Key" "Function" -offset indent
5898.It Sy "Key" Ta Sy "Function"
5899.It Li "Enter" Ta "Choose selected item"
5900.It Li "Up" Ta "Select previous item"
5901.It Li "Down" Ta "Select next item"
5902.It Li "q" Ta "Exit menu"
5903.El
5904.Tg display
5905.It Xo Ic display-message
5906.Op Fl aIlNpv
5907.Op Fl c Ar target-client
5908.Op Fl d Ar delay
5909.Op Fl t Ar target-pane
5910.Op Ar message
5911.Xc
5912.D1 Pq alias: Ic display
5913Display a message.
5914If
5915.Fl p
5916is given, the output is printed to stdout, otherwise it is displayed in the
5917.Ar target-client
5918status line for up to
5919.Ar delay
5920milliseconds.
5921If
5922.Ar delay
5923is not given, the
5924.Ic display-time
5925option is used; a delay of zero waits for a key press.
5926.Ql N
5927ignores key presses and closes only after the delay expires.
5928If
5929.Fl l
5930is given,
5931.Ar message
5932is printed unchanged.
5933Otherwise, the format of
5934.Ar message
5935is described in the
5936.Sx FORMATS
5937section; information is taken from
5938.Ar target-pane
5939if
5940.Fl t
5941is given, otherwise the active pane.
5942.Pp
5943.Fl v
5944prints verbose logging as the format is parsed and
5945.Fl a
5946lists the format variables and their values.
5947.Pp
5948.Fl I
5949forwards any input read from stdin to the empty pane given by
5950.Ar target-pane .
5951.Tg popup
5952.It Xo Ic display-popup
5953.Op Fl BCE
5954.Op Fl b Ar border-lines
5955.Op Fl c Ar target-client
5956.Op Fl d Ar start-directory
5957.Op Fl e Ar environment
5958.Op Fl h Ar height
5959.Op Fl s Ar style
5960.Op Fl S Ar border-style
5961.Op Fl t Ar target-pane
5962.Op Fl T Ar title
5963.Op Fl w Ar width
5964.Op Fl x Ar position
5965.Op Fl y Ar position
5966.Op Ar shell-command
5967.Xc
5968.D1 Pq alias: Ic popup
5969Display a popup running
5970.Ar shell-command
5971on
5972.Ar target-client .
5973A popup is a rectangular box drawn over the top of any panes.
5974Panes are not updated while a popup is present.
5975.Pp
5976.Fl E
5977closes the popup automatically when
5978.Ar shell-command
5979exits.
5980Two
5981.Fl E
5982closes the popup only if
5983.Ar shell-command
5984exited with success.
5985.Pp
5986.Fl x
5987and
5988.Fl y
5989give the position of the popup, they have the same meaning as for the
5990.Ic display-menu
5991command.
5992.Fl w
5993and
5994.Fl h
5995give the width and height - both may be a percentage (followed by
5996.Ql % ) .
5997If omitted, half of the terminal size is used.
5998.Pp
5999.Fl B
6000does not surround the popup by a border.
6001.Pp
6002.Fl b
6003sets the type of border line for the popup.
6004When
6005.Fl B
6006is specified, the
6007.Fl b
6008option is ignored.
6009See
6010.Ic popup-border-lines
6011for possible values for
6012.Ar border-lines .
6013.Pp
6014.Fl s
6015sets the style for the popup and
6016.Fl S
6017sets the style for the popup border.
6018For how to specify
6019.Ar style ,
6020see the
6021.Sx STYLES
6022section.
6023.Pp
6024.Fl e
6025takes the form
6026.Ql VARIABLE=value
6027and sets an environment variable for the popup; it may be specified multiple
6028times.
6029.Pp
6030.Fl T
6031is a format for the popup title (see
6032.Sx FORMATS ) .
6033.Pp
6034The
6035.Fl C
6036flag closes any popup on the client.
6037.Tg showphist
6038.It Xo Ic show-prompt-history
6039.Op Fl T Ar prompt-type
6040.Xc
6041.D1 Pq alias: Ic showphist
6042Display status prompt history for prompt type
6043.Ar prompt-type .
6044If
6045.Fl T
6046is omitted, then show history for all types.
6047See
6048.Ic command-prompt
6049for possible values for
6050.Ar prompt-type .
6051.El
6052.Sh BUFFERS
6053.Nm
6054maintains a set of named
6055.Em paste buffers .
6056Each buffer may be either explicitly or automatically named.
6057Explicitly named buffers are named when created with the
6058.Ic set-buffer
6059or
6060.Ic load-buffer
6061commands, or by renaming an automatically named buffer with
6062.Ic set-buffer
6063.Fl n .
6064Automatically named buffers are given a name such as
6065.Ql buffer0001 ,
6066.Ql buffer0002
6067and so on.
6068When the
6069.Ic buffer-limit
6070option is reached, the oldest automatically named buffer is deleted.
6071Explicitly named buffers are not subject to
6072.Ic buffer-limit
6073and may be deleted with the
6074.Ic delete-buffer
6075command.
6076.Pp
6077Buffers may be added using
6078.Ic copy-mode
6079or the
6080.Ic set-buffer
6081and
6082.Ic load-buffer
6083commands, and pasted into a window using the
6084.Ic paste-buffer
6085command.
6086If a buffer command is used and no buffer is specified, the most
6087recently added automatically named buffer is assumed.
6088.Pp
6089A configurable history buffer is also maintained for each window.
6090By default, up to 2000 lines are kept; this can be altered with the
6091.Ic history-limit
6092option (see the
6093.Ic set-option
6094command above).
6095.Pp
6096The buffer commands are as follows:
6097.Bl -tag -width Ds
6098.It Xo
6099.Ic choose-buffer
6100.Op Fl NZr
6101.Op Fl F Ar format
6102.Op Fl f Ar filter
6103.Op Fl K Ar key-format
6104.Op Fl O Ar sort-order
6105.Op Fl t Ar target-pane
6106.Op Ar template
6107.Xc
6108Put a pane into buffer mode, where a buffer may be chosen interactively from
6109a list.
6110Each buffer is shown on one line.
6111A shortcut key is shown on the left in brackets allowing for immediate choice,
6112or the list may be navigated and an item chosen or otherwise manipulated using
6113the keys below.
6114.Fl Z
6115zooms the pane.
6116The following keys may be used in buffer mode:
6117.Bl -column "Key" "Function" -offset indent
6118.It Sy "Key" Ta Sy "Function"
6119.It Li "Enter" Ta "Paste selected buffer"
6120.It Li "Up" Ta "Select previous buffer"
6121.It Li "Down" Ta "Select next buffer"
6122.It Li "C-s" Ta "Search by name or content"
6123.It Li "n" Ta "Repeat last search"
6124.It Li "t" Ta "Toggle if buffer is tagged"
6125.It Li "T" Ta "Tag no buffers"
6126.It Li "C-t" Ta "Tag all buffers"
6127.It Li "p" Ta "Paste selected buffer"
6128.It Li "P" Ta "Paste tagged buffers"
6129.It Li "d" Ta "Delete selected buffer"
6130.It Li "D" Ta "Delete tagged buffers"
6131.It Li "e" Ta "Open the buffer in an editor"
6132.It Li "f" Ta "Enter a format to filter items"
6133.It Li "O" Ta "Change sort field"
6134.It Li "r" Ta "Reverse sort order"
6135.It Li "v" Ta "Toggle preview"
6136.It Li "q" Ta "Exit mode"
6137.El
6138.Pp
6139After a buffer is chosen,
6140.Ql %%
6141is replaced by the buffer name in
6142.Ar template
6143and the result executed as a command.
6144If
6145.Ar template
6146is not given, "paste-buffer -b '%%'" is used.
6147.Pp
6148.Fl O
6149specifies the initial sort field: one of
6150.Ql time
6151(creation),
6152.Ql name
6153or
6154.Ql size .
6155.Fl r
6156reverses the sort order.
6157.Fl f
6158specifies an initial filter: the filter is a format - if it evaluates to zero,
6159the item in the list is not shown, otherwise it is shown.
6160If a filter would lead to an empty list, it is ignored.
6161.Fl F
6162specifies the format for each item in the list and
6163.Fl K
6164a format for each shortcut key; both are evaluated once for each line.
6165.Fl N
6166starts without the preview.
6167This command works only if at least one client is attached.
6168.Tg clearhist
6169.It Xo Ic clear-history
6170.Op Fl H
6171.Op Fl t Ar target-pane
6172.Xc
6173.D1 Pq alias: Ic clearhist
6174Remove and free the history for the specified pane.
6175.Fl H
6176also removes all hyperlinks.
6177.Tg deleteb
6178.It Ic delete-buffer Op Fl b Ar buffer-name
6179.D1 Pq alias: Ic deleteb
6180Delete the buffer named
6181.Ar buffer-name ,
6182or the most recently added automatically named buffer if not specified.
6183.Tg lsb
6184.It Xo Ic list-buffers
6185.Op Fl F Ar format
6186.Op Fl f Ar filter
6187.Xc
6188.D1 Pq alias: Ic lsb
6189List the global buffers.
6190.Fl F
6191specifies the format of each line and
6192.Fl f
6193a filter.
6194Only buffers for which the filter is true are shown.
6195See the
6196.Sx FORMATS
6197section.
6198.It Xo Ic load-buffer
6199.Op Fl w
6200.Op Fl b Ar buffer-name
6201.Op Fl t Ar target-client
6202.Ar path
6203.Xc
6204.Tg loadb
6205.D1 Pq alias: Ic loadb
6206Load the contents of the specified paste buffer from
6207.Ar path .
6208If
6209.Fl w
6210is given, the buffer is also sent to the clipboard for
6211.Ar target-client
6212using the
6213.Xr xterm 1
6214escape sequence, if possible.
6215.Tg pasteb
6216.It Xo Ic paste-buffer
6217.Op Fl dpr
6218.Op Fl b Ar buffer-name
6219.Op Fl s Ar separator
6220.Op Fl t Ar target-pane
6221.Xc
6222.D1 Pq alias: Ic pasteb
6223Insert the contents of a paste buffer into the specified pane.
6224If not specified, paste into the current one.
6225With
6226.Fl d ,
6227also delete the paste buffer.
6228When output, any linefeed (LF) characters in the paste buffer are replaced with
6229a separator, by default carriage return (CR).
6230A custom separator may be specified using the
6231.Fl s
6232flag.
6233The
6234.Fl r
6235flag means to do no replacement (equivalent to a separator of LF).
6236If
6237.Fl p
6238is specified, paste bracket control codes are inserted around the
6239buffer if the application has requested bracketed paste mode.
6240.Tg saveb
6241.It Xo Ic save-buffer
6242.Op Fl a
6243.Op Fl b Ar buffer-name
6244.Ar path
6245.Xc
6246.D1 Pq alias: Ic saveb
6247Save the contents of the specified paste buffer to
6248.Ar path .
6249The
6250.Fl a
6251option appends to rather than overwriting the file.
6252.It Xo Ic set-buffer
6253.Op Fl aw
6254.Op Fl b Ar buffer-name
6255.Op Fl t Ar target-client
6256.Tg setb
6257.Op Fl n Ar new-buffer-name
6258.Ar data
6259.Xc
6260.D1 Pq alias: Ic setb
6261Set the contents of the specified buffer to
6262.Ar data .
6263If
6264.Fl w
6265is given, the buffer is also sent to the clipboard for
6266.Ar target-client
6267using the
6268.Xr xterm 1
6269escape sequence, if possible.
6270The
6271.Fl a
6272option appends to rather than overwriting the buffer.
6273The
6274.Fl n
6275option renames the buffer to
6276.Ar new-buffer-name .
6277.Tg showb
6278.It Xo Ic show-buffer
6279.Op Fl b Ar buffer-name
6280.Xc
6281.D1 Pq alias: Ic showb
6282Display the contents of the specified buffer.
6283.El
6284.Sh MISCELLANEOUS
6285Miscellaneous commands are as follows:
6286.Bl -tag -width Ds
6287.It Ic clock-mode Op Fl t Ar target-pane
6288Display a large clock.
6289.Tg if
6290.It Xo Ic if-shell
6291.Op Fl bF
6292.Op Fl t Ar target-pane
6293.Ar shell-command command
6294.Op Ar command
6295.Xc
6296.D1 Pq alias: Ic if
6297Execute the first
6298.Ar command
6299if
6300.Ar shell-command
6301(run with
6302.Pa /bin/sh )
6303returns success or the second
6304.Ar command
6305otherwise.
6306Before being executed,
6307.Ar shell-command
6308is expanded using the rules specified in the
6309.Sx FORMATS
6310section, including those relevant to
6311.Ar target-pane .
6312With
6313.Fl b ,
6314.Ar shell-command
6315is run in the background.
6316.Pp
6317If
6318.Fl F
6319is given,
6320.Ar shell-command
6321is not executed but considered success if neither empty nor zero (after formats
6322are expanded).
6323.Tg lock
6324.It Ic lock-server
6325.D1 Pq alias: Ic lock
6326Lock each client individually by running the command specified by the
6327.Ic lock-command
6328option.
6329.Tg run
6330.It Xo Ic run-shell
6331.Op Fl bC
6332.Op Fl d Ar delay
6333.Op Fl t Ar target-pane
6334.Op Ar shell-command
6335.Xc
6336.D1 Pq alias: Ic run
6337Execute
6338.Ar shell-command
6339using
6340.Pa /bin/sh
6341or (with
6342.Fl C )
6343a
6344.Nm
6345command in the background without creating a window.
6346Before being executed,
6347.Ar shell-command
6348is expanded using the rules specified in the
6349.Sx FORMATS
6350section.
6351With
6352.Fl b ,
6353the command is run in the background.
6354.Fl d
6355waits for
6356.Ar delay
6357seconds before starting the command.
6358If
6359.Fl C
6360is not given, any output to stdout is displayed in view mode (in the pane
6361specified by
6362.Fl t
6363or the current pane if omitted) after the command finishes.
6364If the command fails, the exit status is also displayed.
6365.Tg wait
6366.It Xo Ic wait-for
6367.Op Fl L | S | U
6368.Ar channel
6369.Xc
6370.D1 Pq alias: Ic wait
6371When used without options, prevents the client from exiting until woken using
6372.Ic wait-for
6373.Fl S
6374with the same channel.
6375When
6376.Fl L
6377is used, the channel is locked and any clients that try to lock the same
6378channel are made to wait until the channel is unlocked with
6379.Ic wait-for
6380.Fl U .
6381.El
6382.Sh EXIT MESSAGES
6383When a
6384.Nm
6385client detaches, it prints a message.
6386This may be one of:
6387.Bl -tag -width Ds
6388.It detached (from session ...)
6389The client was detached normally.
6390.It detached and SIGHUP
6391The client was detached and its parent sent the
6392.Dv SIGHUP
6393signal (for example with
6394.Ic detach-client
6395.Fl P ) .
6396.It lost tty
6397The client's
6398.Xr tty 4
6399or
6400.Xr pty 4
6401was unexpectedly destroyed.
6402.It terminated
6403The client was killed with
6404.Dv SIGTERM .
6405.It too far behind
6406The client is in control mode and became unable to keep up with the data from
6407.Nm .
6408.It exited
6409The server exited when it had no sessions.
6410.It server exited
6411The server exited when it received
6412.Dv SIGTERM .
6413.It server exited unexpectedly
6414The server crashed or otherwise exited without telling the client the reason.
6415.El
6416.Sh TERMINFO EXTENSIONS
6417.Nm
6418understands some unofficial extensions to
6419.Xr terminfo 5 .
6420It is not normally necessary to set these manually, instead the
6421.Ic terminal-features
6422option should be used.
6423.Bl -tag -width Ds
6424.It Em \&AX
6425An existing extension that tells
6426.Nm
6427the terminal supports default colours.
6428.It Em \&Bidi
6429Tell
6430.Nm
6431that the terminal supports the VTE bidirectional text extensions.
6432.It Em \&Cs , Cr
6433Set the cursor colour.
6434The first takes a single string argument and is used to set the colour;
6435the second takes no arguments and restores the default cursor colour.
6436If set, a sequence such as this may be used
6437to change the cursor colour from inside
6438.Nm :
6439.Bd -literal -offset indent
6440$ printf '\e033]12;red\e033\e\e'
6441.Ed
6442.Pp
6443The colour is an
6444.Xr X 7
6445colour, see
6446.Xr XParseColor 3 .
6447.It Em \&Cmg, \&Clmg, \&Dsmg , \&Enmg
6448Set, clear, disable or enable DECSLRM margins.
6449These are set automatically if the terminal reports it is
6450.Em VT420
6451compatible.
6452.It Em \&Dsbp , \&Enbp
6453Disable and enable bracketed paste.
6454These are set automatically if the
6455.Em XT
6456capability is present.
6457.It Em \&Dseks , \&Eneks
6458Disable and enable extended keys.
6459.It Em \&Dsfcs , \&Enfcs
6460Disable and enable focus reporting.
6461These are set automatically if the
6462.Em XT
6463capability is present.
6464.It Em \&Hls
6465Set or clear a hyperlink annotation.
6466.It Em \&Nobr
6467Tell
6468.Nm
6469that the terminal does not use bright colors for bold display.
6470.It Em \&Rect
6471Tell
6472.Nm
6473that the terminal supports rectangle operations.
6474.It Em \&Smol
6475Enable the overline attribute.
6476.It Em \&Smulx
6477Set a styled underscore.
6478The single parameter is one of: 0 for no underscore, 1 for normal
6479underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted
6480underscore and 5 for dashed underscore.
6481.It Em \&Setulc , \&ol
6482Set the underscore colour or reset to the default.
6483The argument is (red * 65536) + (green * 256) + blue where each is between 0
6484and 255.
6485.It Em \&Ss , Se
6486Set or reset the cursor style.
6487If set, a sequence such as this may be used
6488to change the cursor to an underline:
6489.Bd -literal -offset indent
6490$ printf '\e033[4 q'
6491.Ed
6492.Pp
6493If
6494.Em Se
6495is not set, \&Ss with argument 0 will be used to reset the cursor style instead.
6496.It Em \&Swd
6497Set the opening sequence for the working directory notification.
6498The sequence is terminated using the standard
6499.Em fsl
6500capability.
6501.It Em \&Sxl
6502Indicates that the terminal supports SIXEL.
6503.It Em \&Sync
6504Start (parameter is 1) or end (parameter is 2) a synchronized update.
6505.It Em \&Tc
6506Indicate that the terminal supports the
6507.Ql direct colour
6508RGB escape sequence (for example, \ee[38;2;255;255;255m).
6509.Pp
6510If supported, this is used for the initialize colour escape sequence (which
6511may be enabled by adding the
6512.Ql initc
6513and
6514.Ql ccc
6515capabilities to the
6516.Nm
6517.Xr terminfo 5
6518entry).
6519.Pp
6520This is equivalent to the
6521.Em RGB
6522.Xr terminfo 5
6523capability.
6524.It Em \&Ms
6525Store the current buffer in the host terminal's selection (clipboard).
6526See the
6527.Em set-clipboard
6528option above and the
6529.Xr xterm 1
6530man page.
6531.It Em \&XT
6532This is an existing extension capability that tmux uses to mean that the
6533terminal supports the
6534.Xr xterm 1
6535title set sequences and to automatically set some of the capabilities above.
6536.El
6537.Sh CONTROL MODE
6538.Nm
6539offers a textual interface called
6540.Em control mode .
6541This allows applications to communicate with
6542.Nm
6543using a simple text-only protocol.
6544.Pp
6545In control mode, a client sends
6546.Nm
6547commands or command sequences terminated by newlines on standard input.
6548Each command will produce one block of output on standard output.
6549An output block consists of a
6550.Em %begin
6551line followed by the output (which may be empty).
6552The output block ends with a
6553.Em %end
6554or
6555.Em %error .
6556.Em %begin
6557and matching
6558.Em %end
6559or
6560.Em %error
6561have three arguments: an integer time (as seconds from epoch), command number and
6562flags (currently not used).
6563For example:
6564.Bd -literal -offset indent
6565%begin 1363006971 2 1
65660: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
6567%end 1363006971 2 1
6568.Ed
6569.Pp
6570The
6571.Ic refresh-client
6572.Fl C
6573command may be used to set the size of a client in control mode.
6574.Pp
6575In control mode,
6576.Nm
6577outputs notifications.
6578A notification will never occur inside an output block.
6579.Pp
6580The following notifications are defined:
6581.Bl -tag -width Ds
6582.It Ic %client-detached Ar client
6583The client has detached.
6584.It Ic %client-session-changed Ar client session-id name
6585The client is now attached to the session with ID
6586.Ar session-id ,
6587which is named
6588.Ar name .
6589.It Ic %config-error Ar error
6590An error has happened in a configuration file.
6591.It Ic %continue Ar pane-id
6592The pane has been continued after being paused (if the
6593.Ar pause-after
6594flag is set, see
6595.Ic refresh-client
6596.Fl A ) .
6597.It Ic %exit Op Ar reason
6598The
6599.Nm
6600client is exiting immediately, either because it is not attached to any session
6601or an error occurred.
6602If present,
6603.Ar reason
6604describes why the client exited.
6605.It Ic %extended-output Ar pane-id Ar age Ar ... \&  : Ar value
6606New form of
6607.Ic %output
6608sent when the
6609.Ar pause-after
6610flag is set.
6611.Ar age
6612is the time in milliseconds for which tmux had buffered the output before it was sent.
6613Any subsequent arguments up until a single
6614.Ql \&:
6615are for future use and should be ignored.
6616.It Ic %layout-change Ar window-id Ar window-layout Ar window-visible-layout Ar window-flags
6617The layout of a window with ID
6618.Ar window-id
6619changed.
6620The new layout is
6621.Ar window-layout .
6622The window's visible layout is
6623.Ar window-visible-layout
6624and the window flags are
6625.Ar window-flags .
6626.It Ic %output Ar pane-id Ar value
6627A window pane produced output.
6628.Ar value
6629escapes non-printable characters and backslash as octal \\xxx.
6630.It Ic %pane-mode-changed Ar pane-id
6631The pane with ID
6632.Ar pane-id
6633has changed mode.
6634.It Ic %paste-buffer-changed Ar name
6635Paste buffer
6636.Ar name
6637has been changed.
6638.It Ic %paste-buffer-deleted Ar name
6639Paste buffer
6640.Ar name
6641has been deleted.
6642.It Ic %pause Ar pane-id
6643The pane has been paused (if the
6644.Ar pause-after
6645flag is set).
6646.It Ic %session-changed Ar session-id Ar name
6647The client is now attached to the session with ID
6648.Ar session-id ,
6649which is named
6650.Ar name .
6651.It Ic %session-renamed Ar name
6652The current session was renamed to
6653.Ar name .
6654.It Ic %session-window-changed Ar session-id Ar window-id
6655The session with ID
6656.Ar session-id
6657changed its active window to the window with ID
6658.Ar window-id .
6659.It Ic %sessions-changed
6660A session was created or destroyed.
6661.It Xo Ic %subscription-changed
6662.Ar name
6663.Ar session-id
6664.Ar window-id
6665.Ar window-index
6666.Ar pane-id ... \&  :
6667.Ar value
6668.Xc
6669The value of the format associated with subscription
6670.Ar name
6671has changed to
6672.Ar value .
6673See
6674.Ic refresh-client
6675.Fl B .
6676Any arguments after
6677.Ar pane-id
6678up until a single
6679.Ql \&:
6680are for future use and should be ignored.
6681.It Ic %unlinked-window-add Ar window-id
6682The window with ID
6683.Ar window-id
6684was created but is not linked to the current session.
6685.It Ic %unlinked-window-close Ar window-id
6686The window with ID
6687.Ar window-id ,
6688which is not linked to the current session, was closed.
6689.It Ic %unlinked-window-renamed Ar window-id
6690The window with ID
6691.Ar window-id ,
6692which is not linked to the current session, was renamed.
6693.It Ic %window-add Ar window-id
6694The window with ID
6695.Ar window-id
6696was linked to the current session.
6697.It Ic %window-close Ar window-id
6698The window with ID
6699.Ar window-id
6700closed.
6701.It Ic %window-pane-changed Ar window-id Ar pane-id
6702The active pane in the window with ID
6703.Ar window-id
6704changed to the pane with ID
6705.Ar pane-id .
6706.It Ic %window-renamed Ar window-id Ar name
6707The window with ID
6708.Ar window-id
6709was renamed to
6710.Ar name .
6711.El
6712.Sh ENVIRONMENT
6713When
6714.Nm
6715is started, it inspects the following environment variables:
6716.Bl -tag -width LC_CTYPE
6717.It Ev EDITOR
6718If the command specified in this variable contains the string
6719.Ql vi
6720and
6721.Ev VISUAL
6722is unset, use vi-style key bindings.
6723Overridden by the
6724.Ic mode-keys
6725and
6726.Ic status-keys
6727options.
6728.It Ev HOME
6729The user's login directory.
6730If unset, the
6731.Xr passwd 5
6732database is consulted.
6733.It Ev LC_CTYPE
6734The character encoding
6735.Xr locale 1 .
6736It is used for two separate purposes.
6737For output to the terminal, UTF-8 is used if the
6738.Fl u
6739option is given or if
6740.Ev LC_CTYPE
6741contains
6742.Qq UTF-8
6743or
6744.Qq UTF8 .
6745Otherwise, only ASCII characters are written and non-ASCII characters
6746are replaced with underscores
6747.Pq Ql _ .
6748For input,
6749.Nm
6750always runs with a UTF-8 locale.
6751If en_US.UTF-8 is provided by the operating system, it is used and
6752.Ev LC_CTYPE
6753is ignored for input.
6754Otherwise,
6755.Ev LC_CTYPE
6756tells
6757.Nm
6758what the UTF-8 locale is called on the current system.
6759If the locale specified by
6760.Ev LC_CTYPE
6761is not available or is not a UTF-8 locale,
6762.Nm
6763exits with an error message.
6764.It Ev LC_TIME
6765The date and time format
6766.Xr locale 1 .
6767It is used for locale-dependent
6768.Xr strftime 3
6769format specifiers.
6770.It Ev PWD
6771The current working directory to be set in the global environment.
6772This may be useful if it contains symbolic links.
6773If the value of the variable does not match the current working
6774directory, the variable is ignored and the result of
6775.Xr getcwd 3
6776is used instead.
6777.It Ev SHELL
6778The absolute path to the default shell for new windows.
6779See the
6780.Ic default-shell
6781option for details.
6782.It Ev TMUX_TMPDIR
6783The parent directory of the directory containing the server sockets.
6784See the
6785.Fl L
6786option for details.
6787.It Ev VISUAL
6788If the command specified in this variable contains the string
6789.Ql vi ,
6790use vi-style key bindings.
6791Overridden by the
6792.Ic mode-keys
6793and
6794.Ic status-keys
6795options.
6796.El
6797.Sh FILES
6798.Bl -tag -width "/etc/tmux.confXXX" -compact
6799.It Pa ~/.tmux.conf
6800Default
6801.Nm
6802configuration file.
6803.It Pa /etc/tmux.conf
6804System-wide configuration file.
6805.El
6806.Sh EXAMPLES
6807To create a new
6808.Nm
6809session running
6810.Xr vi 1 :
6811.Pp
6812.Dl $ tmux new-session vi
6813.Pp
6814Most commands have a shorter form, known as an alias.
6815For new-session, this is
6816.Ic new :
6817.Pp
6818.Dl $ tmux new vi
6819.Pp
6820Alternatively, the shortest unambiguous form of a command is accepted.
6821If there are several options, they are listed:
6822.Bd -literal -offset indent
6823$ tmux n
6824ambiguous command: n, could be: new-session, new-window, next-window
6825.Ed
6826.Pp
6827Within an active session, a new window may be created by typing
6828.Ql C-b c
6829(Ctrl
6830followed by the
6831.Ql b
6832key
6833followed by the
6834.Ql c
6835key).
6836.Pp
6837Windows may be navigated with:
6838.Ql C-b 0
6839(to select window 0),
6840.Ql C-b 1
6841(to select window 1), and so on;
6842.Ql C-b n
6843to select the next window; and
6844.Ql C-b p
6845to select the previous window.
6846.Pp
6847A session may be detached using
6848.Ql C-b d
6849(or by an external event such as
6850.Xr ssh 1
6851disconnection) and reattached with:
6852.Pp
6853.Dl $ tmux attach-session
6854.Pp
6855Typing
6856.Ql C-b \&?
6857lists the current key bindings in the current window; up and down may be used
6858to navigate the list or
6859.Ql q
6860to exit from it.
6861.Pp
6862Commands to be run when the
6863.Nm
6864server is started may be placed in the
6865.Pa ~/.tmux.conf
6866configuration file.
6867Common examples include:
6868.Pp
6869Changing the default prefix key:
6870.Bd -literal -offset indent
6871set-option -g prefix C-a
6872unbind-key C-b
6873bind-key C-a send-prefix
6874.Ed
6875.Pp
6876Turning the status line off, or changing its colour:
6877.Bd -literal -offset indent
6878set-option -g status off
6879set-option -g status-style bg=blue
6880.Ed
6881.Pp
6882Setting other options, such as the default command,
6883or locking after 30 minutes of inactivity:
6884.Bd -literal -offset indent
6885set-option -g default-command "exec /bin/ksh"
6886set-option -g lock-after-time 1800
6887.Ed
6888.Pp
6889Creating new key bindings:
6890.Bd -literal -offset indent
6891bind-key b set-option status
6892bind-key / command-prompt "split-window 'exec man %%'"
6893bind-key S command-prompt "new-window -n %1 'ssh %1'"
6894.Ed
6895.Sh SEE ALSO
6896.Xr pty 4
6897.Sh AUTHORS
6898.An Nicholas Marriott Aq Mt nicholas.marriott@gmail.com
6899