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