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