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