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