xref: /netbsd-src/external/bsd/tmux/dist/tmux.1 (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1.\" $OpenBSD$
2.\"
3.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
14.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
15.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd January 6, 2020
18.Dt TMUX 1
19.Os
20.Sh NAME
21.Nm tmux
22.Nd terminal multiplexer
23.Sh SYNOPSIS
24.Nm tmux
25.Bk -words
26.Op Fl 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 @SYSCONFDIR@/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 use space and the
1786.Ql - ,
1787.Ql _
1788and
1789.Ql @
1790characters as word delimiters by default, but this can be adjusted by
1791setting the
1792.Em word-separators
1793session option.
1794Next word moves to the start of the next word, next word end to the end of the
1795next word and previous word to the start of the previous word.
1796The three next and previous space keys work similarly but use a space alone as
1797the word separator.
1798.Pp
1799The jump commands enable quick movement within a line.
1800For instance, typing
1801.Ql f
1802followed by
1803.Ql /
1804will move the cursor to the next
1805.Ql /
1806character on the current line.
1807A
1808.Ql \&;
1809will then jump to the next occurrence.
1810.Pp
1811Commands in copy mode may be prefaced by an optional repeat count.
1812With vi key bindings, a prefix is entered using the number keys; with
1813emacs, the Alt (meta) key and a number begins prefix entry.
1814.Pp
1815The synopsis for the
1816.Ic copy-mode
1817command is:
1818.Bl -tag -width Ds
1819.It Xo Ic copy-mode
1820.Op Fl eHMqu
1821.Op Fl s Ar src-pane
1822.Op Fl t Ar target-pane
1823.Xc
1824Enter copy mode.
1825The
1826.Fl u
1827option scrolls one page up.
1828.Fl M
1829begins a mouse drag (only valid if bound to a mouse key binding, see
1830.Sx MOUSE SUPPORT ) .
1831.Fl H
1832hides the position indicator in the top right.
1833.Fl q
1834cancels copy mode and any other modes.
1835.Fl s
1836copies from
1837.Ar src-pane
1838instead of
1839.Ar target-pane .
1840.Pp
1841.Fl e
1842specifies that scrolling to the bottom of the history (to the visible screen)
1843should exit copy mode.
1844While in copy mode, pressing a key other than those used for scrolling will
1845disable this behaviour.
1846This is intended to allow fast scrolling through a pane's history, for
1847example with:
1848.Bd -literal -offset indent
1849bind PageUp copy-mode -eu
1850.Ed
1851.El
1852.Pp
1853A number of preset arrangements of panes are available, these are called layouts.
1854These may be selected with the
1855.Ic select-layout
1856command or cycled with
1857.Ic next-layout
1858(bound to
1859.Ql Space
1860by default); once a layout is chosen, panes within it may be moved and resized
1861as normal.
1862.Pp
1863The following layouts are supported:
1864.Bl -tag -width Ds
1865.It Ic even-horizontal
1866Panes are spread out evenly from left to right across the window.
1867.It Ic even-vertical
1868Panes are spread evenly from top to bottom.
1869.It Ic main-horizontal
1870A large (main) pane is shown at the top of the window and the remaining panes
1871are spread from left to right in the leftover space at the bottom.
1872Use the
1873.Em main-pane-height
1874window option to specify the height of the top pane.
1875.It Ic main-vertical
1876Similar to
1877.Ic main-horizontal
1878but the large pane is placed on the left and the others spread from top to
1879bottom along the right.
1880See the
1881.Em main-pane-width
1882window option.
1883.It Ic tiled
1884Panes are spread out as evenly as possible over the window in both rows and
1885columns.
1886.El
1887.Pp
1888In addition,
1889.Ic select-layout
1890may be used to apply a previously used layout - the
1891.Ic list-windows
1892command displays the layout of each window in a form suitable for use with
1893.Ic select-layout .
1894For example:
1895.Bd -literal -offset indent
1896$ tmux list-windows
18970: ksh [159x48]
1898    layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
1899$ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
1900.Ed
1901.Pp
1902.Nm
1903automatically adjusts the size of the layout for the current window size.
1904Note that a layout cannot be applied to a window with more panes than that
1905from which the layout was originally defined.
1906.Pp
1907Commands related to windows and panes are as follows:
1908.Bl -tag -width Ds
1909.It Xo Ic break-pane
1910.Op Fl abdP
1911.Op Fl F Ar format
1912.Op Fl n Ar window-name
1913.Op Fl s Ar src-pane
1914.Op Fl t Ar dst-window
1915.Xc
1916.D1 (alias: Ic breakp )
1917Break
1918.Ar src-pane
1919off from its containing window to make it the only pane in
1920.Ar dst-window .
1921With
1922.Fl a
1923or
1924.Fl b ,
1925the window is moved to the next index after or before (existing windows are
1926moved if necessary).
1927If
1928.Fl d
1929is given, the new window does not become the current window.
1930The
1931.Fl P
1932option prints information about the new window after it has been created.
1933By default, it uses the format
1934.Ql #{session_name}:#{window_index}.#{pane_index}
1935but a different format may be specified with
1936.Fl F .
1937.It Xo Ic capture-pane
1938.Op Fl aepPqCJN
1939.Op Fl b Ar buffer-name
1940.Op Fl E Ar end-line
1941.Op Fl S Ar start-line
1942.Op Fl t Ar target-pane
1943.Xc
1944.D1 (alias: Ic capturep )
1945Capture the contents of a pane.
1946If
1947.Fl p
1948is given, the output goes to stdout, otherwise to the buffer specified with
1949.Fl b
1950or a new buffer if omitted.
1951If
1952.Fl a
1953is given, the alternate screen is used, and the history is not accessible.
1954If no alternate screen exists, an error will be returned unless
1955.Fl q
1956is given.
1957If
1958.Fl e
1959is given, the output includes escape sequences for text and background
1960attributes.
1961.Fl C
1962also escapes non-printable characters as octal \exxx.
1963.Fl N
1964preserves trailing spaces at each line's end and
1965.Fl J
1966preserves trailing spaces and joins any wrapped lines.
1967.Fl P
1968captures only any output that the pane has received that is the beginning of an
1969as-yet incomplete escape sequence.
1970.Pp
1971.Fl S
1972and
1973.Fl E
1974specify the starting and ending line numbers, zero is the first line of the
1975visible pane and negative numbers are lines in the history.
1976.Ql -
1977to
1978.Fl S
1979is the start of the history and to
1980.Fl E
1981the end of the visible pane.
1982The default is to capture only the visible contents of the pane.
1983.It Xo
1984.Ic choose-client
1985.Op Fl NrZ
1986.Op Fl F Ar format
1987.Op Fl f Ar filter
1988.Op Fl K Ar key-format
1989.Op Fl O Ar sort-order
1990.Op Fl t Ar target-pane
1991.Op Ar template
1992.Xc
1993Put a pane into client mode, allowing a client to be selected interactively from
1994a list.
1995Each client is shown on one line.
1996A shortcut key is shown on the left in brackets allowing for immediate choice,
1997or the list may be navigated and an item chosen or otherwise manipulated using
1998the keys below.
1999.Fl Z
2000zooms the pane.
2001The following keys may be used in client mode:
2002.Bl -column "Key" "Function" -offset indent
2003.It Sy "Key" Ta Sy "Function"
2004.It Li "Enter" Ta "Choose selected client"
2005.It Li "Up" Ta "Select previous client"
2006.It Li "Down" Ta "Select next client"
2007.It Li "C-s" Ta "Search by name"
2008.It Li "n" Ta "Repeat last search"
2009.It Li "t" Ta "Toggle if client is tagged"
2010.It Li "T" Ta "Tag no clients"
2011.It Li "C-t" Ta "Tag all clients"
2012.It Li "d" Ta "Detach selected client"
2013.It Li "D" Ta "Detach tagged clients"
2014.It Li "x" Ta "Detach and HUP selected client"
2015.It Li "X" Ta "Detach and HUP tagged clients"
2016.It Li "z" Ta "Suspend selected client"
2017.It Li "Z" Ta "Suspend tagged clients"
2018.It Li "f" Ta "Enter a format to filter items"
2019.It Li "O" Ta "Change sort field"
2020.It Li "r" Ta "Reverse sort order"
2021.It Li "v" Ta "Toggle preview"
2022.It Li "q" Ta "Exit mode"
2023.El
2024.Pp
2025After a client is chosen,
2026.Ql %%
2027is replaced by the client name in
2028.Ar template
2029and the result executed as a command.
2030If
2031.Ar template
2032is not given, "detach-client -t '%%'" is used.
2033.Pp
2034.Fl O
2035specifies the initial sort field: one of
2036.Ql name ,
2037.Ql size ,
2038.Ql creation ,
2039or
2040.Ql activity .
2041.Fl r
2042reverses the sort order.
2043.Fl f
2044specifies an initial filter: the filter is a format - if it evaluates to zero,
2045the item in the list is not shown, otherwise it is shown.
2046If a filter would lead to an empty list, it is ignored.
2047.Fl F
2048specifies the format for each item in the list and
2049.Fl K
2050a format for each shortcut key; both are evaluated once for each line.
2051.Fl N
2052starts without the preview.
2053This command works only if at least one client is attached.
2054.It Xo
2055.Ic choose-tree
2056.Op Fl GNrswZ
2057.Op Fl F Ar format
2058.Op Fl f Ar filter
2059.Op Fl K Ar key-format
2060.Op Fl O Ar sort-order
2061.Op Fl t Ar target-pane
2062.Op Ar template
2063.Xc
2064Put a pane into tree mode, where a session, window or pane may be chosen
2065interactively from a tree.
2066Each session, window or pane is shown on one line.
2067A shortcut key is shown on the left in brackets allowing for immediate choice,
2068or the tree may be navigated and an item chosen or otherwise manipulated using
2069the keys below.
2070.Fl s
2071starts with sessions collapsed and
2072.Fl w
2073with windows collapsed.
2074.Fl Z
2075zooms the pane.
2076The following keys may be used in tree mode:
2077.Bl -column "Key" "Function" -offset indent
2078.It Sy "Key" Ta Sy "Function"
2079.It Li "Enter" Ta "Choose selected item"
2080.It Li "Up" Ta "Select previous item"
2081.It Li "Down" Ta "Select next item"
2082.It Li "+" Ta "Expand selected item"
2083.It Li "-" Ta "Collapse selected item"
2084.It Li "M-+" Ta "Expand all items"
2085.It Li "M--" Ta "Collapse all items"
2086.It Li "x" Ta "Kill selected item"
2087.It Li "X" Ta "Kill tagged items"
2088.It Li "<" Ta "Scroll list of previews left"
2089.It Li ">" Ta "Scroll list of previews right"
2090.It Li "C-s" Ta "Search by name"
2091.It Li "m" Ta "Set the marked pane"
2092.It Li "M" Ta "Clear the marked pane"
2093.It Li "n" Ta "Repeat last search"
2094.It Li "t" Ta "Toggle if item is tagged"
2095.It Li "T" Ta "Tag no items"
2096.It Li "C-t" Ta "Tag all items"
2097.It Li "\&:" Ta "Run a command for each tagged item"
2098.It Li "f" Ta "Enter a format to filter items"
2099.It Li "H" Ta "Jump to the starting pane"
2100.It Li "O" Ta "Change sort field"
2101.It Li "r" Ta "Reverse sort order"
2102.It Li "v" Ta "Toggle preview"
2103.It Li "q" Ta "Exit mode"
2104.El
2105.Pp
2106After a session, window or pane is chosen,
2107.Ql %%
2108is replaced by the target in
2109.Ar template
2110and the result executed as a command.
2111If
2112.Ar template
2113is not given, "switch-client -t '%%'" is used.
2114.Pp
2115.Fl O
2116specifies the initial sort field: one of
2117.Ql index ,
2118.Ql name ,
2119or
2120.Ql time .
2121.Fl r
2122reverses the sort order.
2123.Fl f
2124specifies an initial filter: the filter is a format - if it evaluates to zero,
2125the item in the list is not shown, otherwise it is shown.
2126If a filter would lead to an empty list, it is ignored.
2127.Fl F
2128specifies the format for each item in the tree and
2129.Fl K
2130a format for each shortcut key; both are evaluated once for each line.
2131.Fl N
2132starts without the preview.
2133.Fl G
2134includes all sessions in any session groups in the tree rather than only the
2135first.
2136This command works only if at least one client is attached.
2137.It Xo
2138.Ic customize-mode
2139.Op Fl NZ
2140.Op Fl F Ar format
2141.Op Fl f Ar filter
2142.Op Fl t Ar target-pane
2143.Op Ar template
2144.Xc
2145Put a pane into customize mode, where options and key bindings may be browsed
2146and modified from a list.
2147Option values in the list are shown for the active pane in the current window.
2148.Fl Z
2149zooms the pane.
2150The following keys may be used in customize mode:
2151.Bl -column "Key" "Function" -offset indent
2152.It Sy "Key" Ta Sy "Function"
2153.It Li "Enter" Ta "Set pane, window, session or global option value"
2154.It Li "Up" Ta "Select previous item"
2155.It Li "Down" Ta "Select next item"
2156.It Li "+" Ta "Expand selected item"
2157.It Li "-" Ta "Collapse selected item"
2158.It Li "M-+" Ta "Expand all items"
2159.It Li "M--" Ta "Collapse all items"
2160.It Li "s" Ta "Set option value or key attribute"
2161.It Li "S" Ta "Set global option value"
2162.It Li "w" Ta "Set window option value, if option is for pane and window"
2163.It Li "d" Ta "Set an option or key to the default"
2164.It Li "D" Ta "Set tagged options and tagged keys to the default"
2165.It Li "u" Ta "Unset an option (set to default value if global) or unbind a key"
2166.It Li "U" Ta "Unset tagged options and unbind tagged keys"
2167.It Li "C-s" Ta "Search by name"
2168.It Li "n" Ta "Repeat last search"
2169.It Li "t" Ta "Toggle if item is tagged"
2170.It Li "T" Ta "Tag no items"
2171.It Li "C-t" Ta "Tag all items"
2172.It Li "f" Ta "Enter a format to filter items"
2173.It Li "v" Ta "Toggle option information"
2174.It Li "q" Ta "Exit mode"
2175.El
2176.Pp
2177.Fl f
2178specifies an initial filter: the filter is a format - if it evaluates to zero,
2179the item in the list is not shown, otherwise it is shown.
2180If a filter would lead to an empty list, it is ignored.
2181.Fl F
2182specifies the format for each item in the tree.
2183.Fl N
2184starts without the option information.
2185This command works only if at least one client is attached.
2186.It Xo
2187.Ic display-panes
2188.Op Fl bN
2189.Op Fl d Ar duration
2190.Op Fl t Ar target-client
2191.Op Ar template
2192.Xc
2193.D1 (alias: Ic displayp )
2194Display a visible indicator of each pane shown by
2195.Ar target-client .
2196See the
2197.Ic display-panes-colour
2198and
2199.Ic display-panes-active-colour
2200session options.
2201The indicator is closed when a key is pressed (unless
2202.Fl N
2203is given) or
2204.Ar duration
2205milliseconds have passed.
2206If
2207.Fl d
2208is not given,
2209.Ic display-panes-time
2210is used.
2211A duration of zero means the indicator stays until a key is pressed.
2212While the indicator is on screen, a pane may be chosen with the
2213.Ql 0
2214to
2215.Ql 9
2216keys, which will cause
2217.Ar template
2218to be executed as a command with
2219.Ql %%
2220substituted by the pane ID.
2221The default
2222.Ar template
2223is "select-pane -t '%%'".
2224With
2225.Fl b ,
2226other commands are not blocked from running until the indicator is closed.
2227.It Xo Ic find-window
2228.Op Fl iCNrTZ
2229.Op Fl t Ar target-pane
2230.Ar match-string
2231.Xc
2232.D1 (alias: Ic findw )
2233Search for a
2234.Xr fnmatch 3
2235pattern or, with
2236.Fl r ,
2237regular expression
2238.Ar match-string
2239in window names, titles, and visible content (but not history).
2240The flags control matching behavior:
2241.Fl C
2242matches only visible window contents,
2243.Fl N
2244matches only the window name and
2245.Fl T
2246matches only the window title.
2247.Fl i
2248makes the search ignore case.
2249The default is
2250.Fl CNT .
2251.Fl Z
2252zooms the pane.
2253.Pp
2254This command works only if at least one client is attached.
2255.It Xo Ic join-pane
2256.Op Fl bdfhv
2257.Op Fl l Ar size
2258.Op Fl s Ar src-pane
2259.Op Fl t Ar dst-pane
2260.Xc
2261.D1 (alias: Ic joinp )
2262Like
2263.Ic split-window ,
2264but instead of splitting
2265.Ar dst-pane
2266and creating a new pane, split it and move
2267.Ar src-pane
2268into the space.
2269This can be used to reverse
2270.Ic break-pane .
2271The
2272.Fl b
2273option causes
2274.Ar src-pane
2275to be joined to left of or above
2276.Ar dst-pane .
2277.Pp
2278If
2279.Fl s
2280is omitted and a marked pane is present (see
2281.Ic select-pane
2282.Fl m ) ,
2283the marked pane is used rather than the current pane.
2284.It Xo Ic kill-pane
2285.Op Fl a
2286.Op Fl t Ar target-pane
2287.Xc
2288.D1 (alias: Ic killp )
2289Destroy the given pane.
2290If no panes remain in the containing window, it is also destroyed.
2291The
2292.Fl a
2293option kills all but the pane given with
2294.Fl t .
2295.It Xo Ic kill-window
2296.Op Fl a
2297.Op Fl t Ar target-window
2298.Xc
2299.D1 (alias: Ic killw )
2300Kill the current window or the window at
2301.Ar target-window ,
2302removing it from any sessions to which it is linked.
2303The
2304.Fl a
2305option kills all but the window given with
2306.Fl t .
2307.It Xo Ic last-pane
2308.Op Fl deZ
2309.Op Fl t Ar target-window
2310.Xc
2311.D1 (alias: Ic lastp )
2312Select the last (previously selected) pane.
2313.Fl Z
2314keeps the window zoomed if it was zoomed.
2315.Fl e
2316enables or
2317.Fl d
2318disables input to the pane.
2319.It Ic last-window Op Fl t Ar target-session
2320.D1 (alias: Ic last )
2321Select the last (previously selected) window.
2322If no
2323.Ar target-session
2324is specified, select the last window of the current session.
2325.It Xo Ic link-window
2326.Op Fl abdk
2327.Op Fl s Ar src-window
2328.Op Fl t Ar dst-window
2329.Xc
2330.D1 (alias: Ic linkw )
2331Link the window at
2332.Ar src-window
2333to the specified
2334.Ar dst-window .
2335If
2336.Ar dst-window
2337is specified and no such window exists, the
2338.Ar src-window
2339is linked there.
2340With
2341.Fl a
2342or
2343.Fl b
2344the window is moved to the next index after or before
2345.Ar dst-window
2346(existing windows are moved if necessary).
2347If
2348.Fl k
2349is given and
2350.Ar dst-window
2351exists, it is killed, otherwise an error is generated.
2352If
2353.Fl d
2354is given, the newly linked window is not selected.
2355.It Xo Ic list-panes
2356.Op Fl as
2357.Op Fl F Ar format
2358.Op Fl f Ar filter
2359.Op Fl t Ar target
2360.Xc
2361.D1 (alias: Ic lsp )
2362If
2363.Fl a
2364is given,
2365.Ar target
2366is ignored and all panes on the server are listed.
2367If
2368.Fl s
2369is given,
2370.Ar target
2371is a session (or the current session).
2372If neither is given,
2373.Ar target
2374is a window (or the current window).
2375.Fl F
2376specifies the format of each line and
2377.Fl f
2378a filter.
2379Only panes for which the filter is true are shown.
2380See the
2381.Sx FORMATS
2382section.
2383.It Xo Ic list-windows
2384.Op Fl a
2385.Op Fl F Ar format
2386.Op Fl f Ar filter
2387.Op Fl t Ar target-session
2388.Xc
2389.D1 (alias: Ic lsw )
2390If
2391.Fl a
2392is given, list all windows on the server.
2393Otherwise, list windows in the current session or in
2394.Ar target-session .
2395.Fl F
2396specifies the format of each line and
2397.Fl f
2398a filter.
2399Only windows for which the filter is true are shown.
2400See the
2401.Sx FORMATS
2402section.
2403.It Xo Ic move-pane
2404.Op Fl bdfhv
2405.Op Fl l Ar size
2406.Op Fl s Ar src-pane
2407.Op Fl t Ar dst-pane
2408.Xc
2409.D1 (alias: Ic movep )
2410Does the same as
2411.Ic join-pane .
2412.It Xo Ic move-window
2413.Op Fl abrdk
2414.Op Fl s Ar src-window
2415.Op Fl t Ar dst-window
2416.Xc
2417.D1 (alias: Ic movew )
2418This is similar to
2419.Ic link-window ,
2420except the window at
2421.Ar src-window
2422is moved to
2423.Ar dst-window .
2424With
2425.Fl r ,
2426all windows in the session are renumbered in sequential order, respecting
2427the
2428.Ic base-index
2429option.
2430.It Xo Ic new-window
2431.Op Fl abdkPS
2432.Op Fl c Ar start-directory
2433.Op Fl e Ar environment
2434.Op Fl F Ar format
2435.Op Fl n Ar window-name
2436.Op Fl t Ar target-window
2437.Op Ar shell-command
2438.Xc
2439.D1 (alias: Ic neww )
2440Create a new window.
2441With
2442.Fl a
2443or
2444.Fl b ,
2445the new window is inserted at the next index after or before the specified
2446.Ar target-window ,
2447moving windows up if necessary;
2448otherwise
2449.Ar target-window
2450is the new window location.
2451.Pp
2452If
2453.Fl d
2454is given, the session does not make the new window the current window.
2455.Ar target-window
2456represents the window to be created; if the target already exists an error is
2457shown, unless the
2458.Fl k
2459flag is used, in which case it is destroyed.
2460If
2461.Fl S
2462is given and a window named
2463.Ar window-name
2464already exists, it is selected (unless
2465.Fl d
2466is also given in which case the command does nothing).
2467.Pp
2468.Ar shell-command
2469is the command to execute.
2470If
2471.Ar shell-command
2472is not specified, the value of the
2473.Ic default-command
2474option is used.
2475.Fl c
2476specifies the working directory in which the new window is created.
2477.Pp
2478When the shell command completes, the window closes.
2479See the
2480.Ic remain-on-exit
2481option to change this behaviour.
2482.Pp
2483.Fl e
2484takes the form
2485.Ql VARIABLE=value
2486and sets an environment variable for the newly created window; it may be
2487specified multiple times.
2488.Pp
2489The
2490.Ev TERM
2491environment variable must be set to
2492.Ql screen
2493or
2494.Ql tmux
2495for all programs running
2496.Em inside
2497.Nm .
2498New windows will automatically have
2499.Ql TERM=screen
2500added to their environment, but care must be taken not to reset this in shell
2501start-up files or by the
2502.Fl e
2503option.
2504.Pp
2505The
2506.Fl P
2507option prints information about the new window after it has been created.
2508By default, it uses the format
2509.Ql #{session_name}:#{window_index}
2510but a different format may be specified with
2511.Fl F .
2512.It Ic next-layout Op Fl t Ar target-window
2513.D1 (alias: Ic nextl )
2514Move a window to the next layout and rearrange the panes to fit.
2515.It Xo Ic next-window
2516.Op Fl a
2517.Op Fl t Ar target-session
2518.Xc
2519.D1 (alias: Ic next )
2520Move to the next window in the session.
2521If
2522.Fl a
2523is used, move to the next window with an alert.
2524.It Xo Ic pipe-pane
2525.Op Fl IOo
2526.Op Fl t Ar target-pane
2527.Op Ar shell-command
2528.Xc
2529.D1 (alias: Ic pipep )
2530Pipe output sent by the program in
2531.Ar target-pane
2532to a shell command or vice versa.
2533A pane may only be connected to one command at a time, any existing pipe is
2534closed before
2535.Ar shell-command
2536is executed.
2537The
2538.Ar shell-command
2539string may contain the special character sequences supported by the
2540.Ic status-left
2541option.
2542If no
2543.Ar shell-command
2544is given, the current pipe (if any) is closed.
2545.Pp
2546.Fl I
2547and
2548.Fl O
2549specify which of the
2550.Ar shell-command
2551output streams are connected to the pane:
2552with
2553.Fl I
2554stdout is connected (so anything
2555.Ar shell-command
2556prints is written to the pane as if it were typed);
2557with
2558.Fl O
2559stdin is connected (so any output in the pane is piped to
2560.Ar shell-command ) .
2561Both may be used together and if neither are specified,
2562.Fl O
2563is used.
2564.Pp
2565The
2566.Fl o
2567option only opens a new pipe if no previous pipe exists, allowing a pipe to
2568be toggled with a single key, for example:
2569.Bd -literal -offset indent
2570bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
2571.Ed
2572.It Xo Ic previous-layout
2573.Op Fl t Ar target-window
2574.Xc
2575.D1 (alias: Ic prevl )
2576Move to the previous layout in the session.
2577.It Xo Ic previous-window
2578.Op Fl a
2579.Op Fl t Ar target-session
2580.Xc
2581.D1 (alias: Ic prev )
2582Move to the previous window in the session.
2583With
2584.Fl a ,
2585move to the previous window with an alert.
2586.It Xo Ic rename-window
2587.Op Fl t Ar target-window
2588.Ar new-name
2589.Xc
2590.D1 (alias: Ic renamew )
2591Rename the current window, or the window at
2592.Ar target-window
2593if specified, to
2594.Ar new-name .
2595.It Xo Ic resize-pane
2596.Op Fl DLMRTUZ
2597.Op Fl t Ar target-pane
2598.Op Fl x Ar width
2599.Op Fl y Ar height
2600.Op Ar adjustment
2601.Xc
2602.D1 (alias: Ic resizep )
2603Resize a pane, up, down, left or right by
2604.Ar adjustment
2605with
2606.Fl U ,
2607.Fl D ,
2608.Fl L
2609or
2610.Fl R ,
2611or
2612to an absolute size
2613with
2614.Fl x
2615or
2616.Fl y .
2617The
2618.Ar adjustment
2619is given in lines or columns (the default is 1);
2620.Fl x
2621and
2622.Fl y
2623may be a given as a number of lines or columns or followed by
2624.Ql %
2625for a percentage of the window size (for example
2626.Ql -x 10% ) .
2627With
2628.Fl Z ,
2629the active pane is toggled between zoomed (occupying the whole of the window)
2630and unzoomed (its normal position in the layout).
2631.Pp
2632.Fl M
2633begins mouse resizing (only valid if bound to a mouse key binding, see
2634.Sx MOUSE SUPPORT ) .
2635.Pp
2636.Fl T
2637trims all lines below the current cursor position and moves lines out of the
2638history to replace them.
2639.It Xo Ic resize-window
2640.Op Fl aADLRU
2641.Op Fl t Ar target-window
2642.Op Fl x Ar width
2643.Op Fl y Ar height
2644.Op Ar adjustment
2645.Xc
2646.D1 (alias: Ic resizew )
2647Resize a window, up, down, left or right by
2648.Ar adjustment
2649with
2650.Fl U ,
2651.Fl D ,
2652.Fl L
2653or
2654.Fl R ,
2655or
2656to an absolute size
2657with
2658.Fl x
2659or
2660.Fl y .
2661The
2662.Ar adjustment
2663is given in lines or cells (the default is 1).
2664.Fl A
2665sets the size of the largest session containing the window;
2666.Fl a
2667the size of the smallest.
2668This command will automatically set
2669.Ic window-size
2670to manual in the window options.
2671.It Xo Ic respawn-pane
2672.Op Fl k
2673.Op Fl c Ar start-directory
2674.Op Fl e Ar environment
2675.Op Fl t Ar target-pane
2676.Op Ar shell-command
2677.Xc
2678.D1 (alias: Ic respawnp )
2679Reactivate a pane in which the command has exited (see the
2680.Ic remain-on-exit
2681window option).
2682If
2683.Ar shell-command
2684is not given, the command used when the pane was created or last respawned is
2685executed.
2686The pane must be already inactive, unless
2687.Fl k
2688is given, in which case any existing command is killed.
2689.Fl c
2690specifies a new working directory for the pane.
2691The
2692.Fl e
2693option has the same meaning as for the
2694.Ic new-window
2695command.
2696.It Xo Ic respawn-window
2697.Op Fl k
2698.Op Fl c Ar start-directory
2699.Op Fl e Ar environment
2700.Op Fl t Ar target-window
2701.Op Ar shell-command
2702.Xc
2703.D1 (alias: Ic respawnw )
2704Reactivate a window in which the command has exited (see the
2705.Ic remain-on-exit
2706window option).
2707If
2708.Ar shell-command
2709is not given, the command used when the window was created or last respawned is
2710executed.
2711The window must be already inactive, unless
2712.Fl k
2713is given, in which case any existing command is killed.
2714.Fl c
2715specifies a new working directory for the window.
2716The
2717.Fl e
2718option has the same meaning as for the
2719.Ic new-window
2720command.
2721.It Xo Ic rotate-window
2722.Op Fl DUZ
2723.Op Fl t Ar target-window
2724.Xc
2725.D1 (alias: Ic rotatew )
2726Rotate the positions of the panes within a window, either upward (numerically
2727lower) with
2728.Fl U
2729or downward (numerically higher).
2730.Fl Z
2731keeps the window zoomed if it was zoomed.
2732.It Xo Ic select-layout
2733.Op Fl Enop
2734.Op Fl t Ar target-pane
2735.Op Ar layout-name
2736.Xc
2737.D1 (alias: Ic selectl )
2738Choose a specific layout for a window.
2739If
2740.Ar layout-name
2741is not given, the last preset layout used (if any) is reapplied.
2742.Fl n
2743and
2744.Fl p
2745are equivalent to the
2746.Ic next-layout
2747and
2748.Ic previous-layout
2749commands.
2750.Fl o
2751applies the last set layout if possible (undoes the most recent layout change).
2752.Fl E
2753spreads the current pane and any panes next to it out evenly.
2754.It Xo Ic select-pane
2755.Op Fl DdeLlMmRUZ
2756.Op Fl T Ar title
2757.Op Fl t Ar target-pane
2758.Xc
2759.D1 (alias: Ic selectp )
2760Make pane
2761.Ar target-pane
2762the active pane in its window.
2763If one of
2764.Fl D ,
2765.Fl L ,
2766.Fl R ,
2767or
2768.Fl U
2769is used, respectively the pane below, to the left, to the right, or above the
2770target pane is used.
2771.Fl Z
2772keeps the window zoomed if it was zoomed.
2773.Fl l
2774is the same as using the
2775.Ic last-pane
2776command.
2777.Fl e
2778enables or
2779.Fl d
2780disables input to the pane.
2781.Fl T
2782sets the pane title.
2783.Pp
2784.Fl m
2785and
2786.Fl M
2787are used to set and clear the
2788.Em marked pane .
2789There is one marked pane at a time, setting a new marked pane clears the last.
2790The marked pane is the default target for
2791.Fl s
2792to
2793.Ic join-pane ,
2794.Ic move-pane ,
2795.Ic swap-pane
2796and
2797.Ic swap-window .
2798.It Xo Ic select-window
2799.Op Fl lnpT
2800.Op Fl t Ar target-window
2801.Xc
2802.D1 (alias: Ic selectw )
2803Select the window at
2804.Ar target-window .
2805.Fl l ,
2806.Fl n
2807and
2808.Fl p
2809are equivalent to the
2810.Ic last-window ,
2811.Ic next-window
2812and
2813.Ic previous-window
2814commands.
2815If
2816.Fl T
2817is given and the selected window is already the current window,
2818the command behaves like
2819.Ic last-window .
2820.It Xo Ic split-window
2821.Op Fl bdfhIvPZ
2822.Op Fl c Ar start-directory
2823.Op Fl e Ar environment
2824.Op Fl l Ar size
2825.Op Fl t Ar target-pane
2826.Op Ar shell-command
2827.Op Fl F Ar format
2828.Xc
2829.D1 (alias: Ic splitw )
2830Create a new pane by splitting
2831.Ar target-pane :
2832.Fl h
2833does a horizontal split and
2834.Fl v
2835a vertical split; if neither is specified,
2836.Fl v
2837is assumed.
2838The
2839.Fl l
2840option specifies the size of the new pane in lines (for vertical split) or in
2841columns (for horizontal split);
2842.Ar size
2843may be followed by
2844.Ql %
2845to specify a percentage of the available space.
2846The
2847.Fl b
2848option causes the new pane to be created to the left of or above
2849.Ar target-pane .
2850The
2851.Fl f
2852option creates a new pane spanning the full window height (with
2853.Fl h )
2854or full window width (with
2855.Fl v ) ,
2856instead of splitting the active pane.
2857.Fl Z
2858zooms if the window is not zoomed, or keeps it zoomed if already zoomed.
2859.Pp
2860An empty
2861.Ar shell-command
2862('') will create a pane with no command running in it.
2863Output can be sent to such a pane with the
2864.Ic display-message
2865command.
2866The
2867.Fl I
2868flag (if
2869.Ar shell-command
2870is not specified or empty)
2871will create an empty pane and forward any output from stdin to it.
2872For example:
2873.Bd -literal -offset indent
2874$ make 2>&1|tmux splitw -dI &
2875.Ed
2876.Pp
2877All other options have the same meaning as for the
2878.Ic new-window
2879command.
2880.It Xo Ic swap-pane
2881.Op Fl dDUZ
2882.Op Fl s Ar src-pane
2883.Op Fl t Ar dst-pane
2884.Xc
2885.D1 (alias: Ic swapp )
2886Swap two panes.
2887If
2888.Fl U
2889is used and no source pane is specified with
2890.Fl s ,
2891.Ar dst-pane
2892is swapped with the previous pane (before it numerically);
2893.Fl D
2894swaps with the next pane (after it numerically).
2895.Fl d
2896instructs
2897.Nm
2898not to change the active pane and
2899.Fl Z
2900keeps the window zoomed if it was zoomed.
2901.Pp
2902If
2903.Fl s
2904is omitted and a marked pane is present (see
2905.Ic select-pane
2906.Fl m ) ,
2907the marked pane is used rather than the current pane.
2908.It Xo Ic swap-window
2909.Op Fl d
2910.Op Fl s Ar src-window
2911.Op Fl t Ar dst-window
2912.Xc
2913.D1 (alias: Ic swapw )
2914This is similar to
2915.Ic link-window ,
2916except the source and destination windows are swapped.
2917It is an error if no window exists at
2918.Ar src-window .
2919If
2920.Fl d
2921is given, the new window does not become the current window.
2922.Pp
2923If
2924.Fl s
2925is omitted and a marked pane is present (see
2926.Ic select-pane
2927.Fl m ) ,
2928the window containing the marked pane is used rather than the current window.
2929.It Xo Ic unlink-window
2930.Op Fl k
2931.Op Fl t Ar target-window
2932.Xc
2933.D1 (alias: Ic unlinkw )
2934Unlink
2935.Ar target-window .
2936Unless
2937.Fl k
2938is given, a window may be unlinked only if it is linked to multiple sessions -
2939windows may not be linked to no sessions;
2940if
2941.Fl k
2942is specified and the window is linked to only one session, it is unlinked and
2943destroyed.
2944.El
2945.Sh KEY BINDINGS
2946.Nm
2947allows a command to be bound to most keys, with or without a prefix key.
2948When specifying keys, most represent themselves (for example
2949.Ql A
2950to
2951.Ql Z ) .
2952Ctrl keys may be prefixed with
2953.Ql C-
2954or
2955.Ql ^ ,
2956Shift keys with
2957.Ql S-
2958and Alt (meta) with
2959.Ql M- .
2960In addition, the following special key names are accepted:
2961.Em Up ,
2962.Em Down ,
2963.Em Left ,
2964.Em Right ,
2965.Em BSpace ,
2966.Em BTab ,
2967.Em DC
2968(Delete),
2969.Em End ,
2970.Em Enter ,
2971.Em Escape ,
2972.Em F1
2973to
2974.Em F12 ,
2975.Em Home ,
2976.Em IC
2977(Insert),
2978.Em NPage/PageDown/PgDn ,
2979.Em PPage/PageUp/PgUp ,
2980.Em Space ,
2981and
2982.Em Tab .
2983Note that to bind the
2984.Ql \&"
2985or
2986.Ql '
2987keys, quotation marks are necessary, for example:
2988.Bd -literal -offset indent
2989bind-key '"' split-window
2990bind-key "'" new-window
2991.Ed
2992.Pp
2993A command bound to the
2994.Em Any
2995key will execute for all keys which do not have a more specific binding.
2996.Pp
2997Commands related to key bindings are as follows:
2998.Bl -tag -width Ds
2999.It Xo Ic bind-key
3000.Op Fl nr
3001.Op Fl N Ar note
3002.Op Fl T Ar key-table
3003.Ar key command Op Ar arguments
3004.Xc
3005.D1 (alias: Ic bind )
3006Bind key
3007.Ar key
3008to
3009.Ar command .
3010Keys are bound in a key table.
3011By default (without -T), the key is bound in
3012the
3013.Em prefix
3014key table.
3015This table is used for keys pressed after the prefix key (for example,
3016by default
3017.Ql c
3018is bound to
3019.Ic new-window
3020in the
3021.Em prefix
3022table, so
3023.Ql C-b c
3024creates a new window).
3025The
3026.Em root
3027table is used for keys pressed without the prefix key: binding
3028.Ql c
3029to
3030.Ic new-window
3031in the
3032.Em root
3033table (not recommended) means a plain
3034.Ql c
3035will create a new window.
3036.Fl n
3037is an alias
3038for
3039.Fl T Ar root .
3040Keys may also be bound in custom key tables and the
3041.Ic switch-client
3042.Fl T
3043command used to switch to them from a key binding.
3044The
3045.Fl r
3046flag indicates this key may repeat, see the
3047.Ic repeat-time
3048option.
3049.Fl N
3050attaches a note to the key (shown with
3051.Ic list-keys
3052.Fl N ) .
3053.Pp
3054To view the default bindings and possible commands, see the
3055.Ic list-keys
3056command.
3057.It Xo Ic list-keys
3058.Op Fl 1aN
3059.Op Fl P Ar prefix-string Fl T Ar key-table
3060.Op Ar key
3061.Xc
3062.D1 (alias: Ic lsk )
3063List key bindings.
3064There are two forms: the default lists keys as
3065.Ic bind-key
3066commands;
3067.Fl N
3068lists only keys with attached notes and shows only the key and note for each
3069key.
3070.Pp
3071With the default form, all key tables are listed by default.
3072.Fl T
3073lists only keys in
3074.Ar key-table .
3075.Pp
3076With the
3077.Fl N
3078form, only keys in the
3079.Em root
3080and
3081.Em prefix
3082key tables are listed by default;
3083.Fl T
3084also lists only keys in
3085.Ar key-table .
3086.Fl P
3087specifies a prefix to print before each key and
3088.Fl 1
3089lists only the first matching key.
3090.Fl a
3091lists the command for keys that do not have a note rather than skipping them.
3092.It Xo Ic send-keys
3093.Op Fl FHlMRX
3094.Op Fl N Ar repeat-count
3095.Op Fl t Ar target-pane
3096.Ar key Ar ...
3097.Xc
3098.D1 (alias: Ic send )
3099Send a key or keys to a window.
3100Each argument
3101.Ar key
3102is the name of the key (such as
3103.Ql C-a
3104or
3105.Ql NPage )
3106to send; if the string is not recognised as a key, it is sent as a series of
3107characters.
3108All arguments are sent sequentially from first to last.
3109.Pp
3110The
3111.Fl l
3112flag disables key name lookup and processes the keys as literal UTF-8
3113characters.
3114The
3115.Fl H
3116flag expects each key to be a hexadecimal number for an ASCII character.
3117.Pp
3118The
3119.Fl R
3120flag causes the terminal state to be reset.
3121.Pp
3122.Fl M
3123passes through a mouse event (only valid if bound to a mouse key binding, see
3124.Sx MOUSE SUPPORT ) .
3125.Pp
3126.Fl X
3127is used to send a command into copy mode - see
3128the
3129.Sx WINDOWS AND PANES
3130section.
3131.Fl N
3132specifies a repeat count and
3133.Fl F
3134expands formats in arguments where appropriate.
3135.It Xo Ic send-prefix
3136.Op Fl 2
3137.Op Fl t Ar target-pane
3138.Xc
3139Send the prefix key, or with
3140.Fl 2
3141the secondary prefix key, to a window as if it was pressed.
3142.It Xo Ic unbind-key
3143.Op Fl anq
3144.Op Fl T Ar key-table
3145.Ar key
3146.Xc
3147.D1 (alias: Ic unbind )
3148Unbind the command bound to
3149.Ar key .
3150.Fl n
3151and
3152.Fl T
3153are the same as for
3154.Ic bind-key .
3155If
3156.Fl a
3157is present, all key bindings are removed.
3158The
3159.Fl q
3160option prevents errors being returned.
3161.El
3162.Sh OPTIONS
3163The appearance and behaviour of
3164.Nm
3165may be modified by changing the value of various options.
3166There are four types of option:
3167.Em server options ,
3168.Em session options ,
3169.Em window options ,
3170and
3171.Em pane options .
3172.Pp
3173The
3174.Nm
3175server has a set of global server options which do not apply to any particular
3176window or session or pane.
3177These are altered with the
3178.Ic set-option
3179.Fl s
3180command, or displayed with the
3181.Ic show-options
3182.Fl s
3183command.
3184.Pp
3185In addition, each individual session may have a set of session options, and
3186there is a separate set of global session options.
3187Sessions which do not have a particular option configured inherit the value
3188from the global session options.
3189Session options are set or unset with the
3190.Ic set-option
3191command and may be listed with the
3192.Ic show-options
3193command.
3194The available server and session options are listed under the
3195.Ic set-option
3196command.
3197.Pp
3198Similarly, a set of window options is attached to each window and a set of pane
3199options to each pane.
3200Pane options inherit from window options.
3201This means any pane option may be set as a window option to apply the option to
3202all panes in the window without the option set, for example these commands will
3203set the background colour to red for all panes except pane 0:
3204.Bd -literal -offset indent
3205set -w window-style bg=red
3206set -pt:.0 window-style bg=blue
3207.Ed
3208.Pp
3209There is also a set of global window options from which any unset window or
3210pane options are inherited.
3211Window and pane options are altered with
3212.Ic set-option
3213.Fl w
3214and
3215.Fl p
3216commands and displayed with
3217.Ic show-option
3218.Fl w
3219and
3220.Fl p .
3221.Pp
3222.Nm
3223also supports user options which are prefixed with a
3224.Ql \&@ .
3225User options may have any name, so long as they are prefixed with
3226.Ql \&@ ,
3227and be set to any string.
3228For example:
3229.Bd -literal -offset indent
3230$ tmux set -wq @foo "abc123"
3231$ tmux show -wv @foo
3232abc123
3233.Ed
3234.Pp
3235Commands which set options are as follows:
3236.Bl -tag -width Ds
3237.It Xo Ic set-option
3238.Op Fl aFgopqsuUw
3239.Op Fl t Ar target-pane
3240.Ar option Ar value
3241.Xc
3242.D1 (alias: Ic set )
3243Set a pane option with
3244.Fl p ,
3245a window option with
3246.Fl w ,
3247a server option with
3248.Fl s ,
3249otherwise a session option.
3250If the option is not a user option,
3251.Fl w
3252or
3253.Fl s
3254may be unnecessary -
3255.Nm
3256will infer the type from the option name, assuming
3257.Fl w
3258for pane options.
3259If
3260.Fl g
3261is given, the global session or window option is set.
3262.Pp
3263.Fl F
3264expands formats in the option value.
3265The
3266.Fl u
3267flag unsets an option, so a session inherits the option from the global
3268options (or with
3269.Fl g ,
3270restores a global option to the default).
3271.Fl U
3272unsets an option (like
3273.Fl u )
3274but if the option is a pane option also unsets the option on any panes in the
3275window.
3276.Ar value
3277depends on the option and may be a number, a string, or a flag (on, off, or
3278omitted to toggle).
3279.Pp
3280The
3281.Fl o
3282flag prevents setting an option that is already set and the
3283.Fl q
3284flag suppresses errors about unknown or ambiguous options.
3285.Pp
3286With
3287.Fl a ,
3288and if the option expects a string or a style,
3289.Ar value
3290is appended to the existing setting.
3291For example:
3292.Bd -literal -offset indent
3293set -g status-left "foo"
3294set -ag status-left "bar"
3295.Ed
3296.Pp
3297Will result in
3298.Ql foobar .
3299And:
3300.Bd -literal -offset indent
3301set -g status-style "bg=red"
3302set -ag status-style "fg=blue"
3303.Ed
3304.Pp
3305Will result in a red background
3306.Em and
3307blue foreground.
3308Without
3309.Fl a ,
3310the result would be the default background and a blue foreground.
3311.It Xo Ic show-options
3312.Op Fl AgHpqsvw
3313.Op Fl t Ar target-pane
3314.Op Ar option
3315.Xc
3316.D1 (alias: Ic show )
3317Show the pane options (or a single option if
3318.Ar option
3319is provided) with
3320.Fl p ,
3321the window options with
3322.Fl w ,
3323the server options with
3324.Fl s ,
3325otherwise the session options.
3326If the option is not a user option,
3327.Fl w
3328or
3329.Fl s
3330may be unnecessary -
3331.Nm
3332will infer the type from the option name, assuming
3333.Fl w
3334for pane options.
3335Global session or window options are listed if
3336.Fl g
3337is used.
3338.Fl v
3339shows only the option value, not the name.
3340If
3341.Fl q
3342is set, no error will be returned if
3343.Ar option
3344is unset.
3345.Fl H
3346includes hooks (omitted by default).
3347.Fl A
3348includes options inherited from a parent set of options, such options are
3349marked with an asterisk.
3350.El
3351.Pp
3352Available server options are:
3353.Bl -tag -width Ds
3354.It Ic backspace Ar key
3355Set the key sent by
3356.Nm
3357for backspace.
3358.It Ic buffer-limit Ar number
3359Set the number of buffers; as new buffers are added to the top of the stack,
3360old ones are removed from the bottom if necessary to maintain this maximum
3361length.
3362.It Xo Ic command-alias[]
3363.Ar name=value
3364.Xc
3365This is an array of custom aliases for commands.
3366If an unknown command matches
3367.Ar name ,
3368it is replaced with
3369.Ar value .
3370For example, after:
3371.Pp
3372.Dl set -s command-alias[100] zoom='resize-pane -Z'
3373.Pp
3374Using:
3375.Pp
3376.Dl zoom -t:.1
3377.Pp
3378Is equivalent to:
3379.Pp
3380.Dl resize-pane -Z -t:.1
3381.Pp
3382Note that aliases are expanded when a command is parsed rather than when it is
3383executed, so binding an alias with
3384.Ic bind-key
3385will bind the expanded form.
3386.It Ic default-terminal Ar terminal
3387Set the default terminal for new windows created in this session - the
3388default value of the
3389.Ev TERM
3390environment variable.
3391For
3392.Nm
3393to work correctly, this
3394.Em must
3395be set to
3396.Ql screen ,
3397.Ql tmux
3398or a derivative of them.
3399.It Ic copy-command Ar shell-command
3400Give the command to pipe to if the
3401.Ic copy-pipe
3402copy mode command is used without arguments.
3403.It Ic escape-time Ar time
3404Set the time in milliseconds for which
3405.Nm
3406waits after an escape is input to determine if it is part of a function or meta
3407key sequences.
3408The default is 500 milliseconds.
3409.It Ic editor Ar shell-command
3410Set the command used when
3411.Nm
3412runs an editor.
3413.It Xo Ic exit-empty
3414.Op Ic on | off
3415.Xc
3416If enabled (the default), the server will exit when there are no active
3417sessions.
3418.It Xo Ic exit-unattached
3419.Op Ic on | off
3420.Xc
3421If enabled, the server will exit when there are no attached clients.
3422.It Xo Ic extended-keys
3423.Op Ic on | off | always
3424.Xc
3425When
3426.Ic on
3427or
3428.Ic always ,
3429the escape sequence to enable extended keys is sent to the terminal, if
3430.Nm
3431knows that it is supported.
3432.Nm
3433always recognises extended keys itself.
3434If this option is
3435.Ic on ,
3436.Nm
3437will only forward extended keys to applications when they request them; if
3438.Ic always ,
3439.Nm
3440will always forward the keys.
3441.It Xo Ic focus-events
3442.Op Ic on | off
3443.Xc
3444When enabled, focus events are requested from the terminal if supported and
3445passed through to applications running in
3446.Nm .
3447Attached clients should be detached and attached again after changing this
3448option.
3449.It Ic history-file Ar path
3450If not empty, a file to which
3451.Nm
3452will write command prompt history on exit and load it from on start.
3453.It Ic message-limit Ar number
3454Set the number of error or information messages to save in the message log for
3455each client.
3456The default is 100.
3457.It Xo Ic set-clipboard
3458.Op Ic on | external | off
3459.Xc
3460Attempt to set the terminal clipboard content using the
3461.Xr xterm 1
3462escape sequence, if there is an
3463.Em \&Ms
3464entry in the
3465.Xr terminfo 5
3466description (see the
3467.Sx TERMINFO EXTENSIONS
3468section).
3469.Pp
3470If set to
3471.Ic on ,
3472.Nm
3473will both accept the escape sequence to create a buffer and attempt to set
3474the terminal clipboard.
3475If set to
3476.Ic external ,
3477.Nm
3478will attempt to set the terminal clipboard but ignore attempts
3479by applications to set
3480.Nm
3481buffers.
3482If
3483.Ic off ,
3484.Nm
3485will neither accept the clipboard escape sequence nor attempt to set the
3486clipboard.
3487.Pp
3488Note that this feature needs to be enabled in
3489.Xr xterm 1
3490by setting the resource:
3491.Bd -literal -offset indent
3492disallowedWindowOps: 20,21,SetXprop
3493.Ed
3494.Pp
3495Or changing this property from the
3496.Xr xterm 1
3497interactive menu when required.
3498.It Ic terminal-features[] Ar string
3499Set terminal features for terminal types read from
3500.Xr terminfo 5 .
3501.Nm
3502has a set of named terminal features.
3503Each will apply appropriate changes to the
3504.Xr terminfo 5
3505entry in use.
3506.Pp
3507.Nm
3508can detect features for a few common terminals; this option can be used to
3509easily tell tmux about features supported by terminals it cannot detect.
3510The
3511.Ic terminal-overrides
3512option allows individual
3513.Xr terminfo 5
3514capabilities to be set instead,
3515.Ic terminal-features
3516is intended for classes of functionality supported in a standard way but not
3517reported by
3518.Xr terminfo 5 .
3519Care must be taken to configure this only with features the terminal actually
3520supports.
3521.Pp
3522This is an array option where each entry is a colon-separated string made up
3523of a terminal type pattern (matched using
3524.Xr fnmatch 3 )
3525followed by a list of terminal features.
3526The available features are:
3527.Bl -tag -width Ds
3528.It 256
3529Supports 256 colours with the SGR escape sequences.
3530.It clipboard
3531Allows setting the system clipboard.
3532.It ccolour
3533Allows setting the cursor colour.
3534.It cstyle
3535Allows setting the cursor style.
3536.It extkeys
3537Supports extended keys.
3538.It focus
3539Supports focus reporting.
3540.It margins
3541Supports DECSLRM margins.
3542.It mouse
3543Supports
3544.Xr xterm 1
3545mouse sequences.
3546.It overline
3547Supports the overline SGR attribute.
3548.It rectfill
3549Supports the DECFRA rectangle fill escape sequence.
3550.It RGB
3551Supports RGB colour with the SGR escape sequences.
3552.It strikethrough
3553Supports the strikethrough SGR escape sequence.
3554.It sync
3555Supports synchronized updates.
3556.It title
3557Supports
3558.Xr xterm 1
3559title setting.
3560.It usstyle
3561Allows underscore style and colour to be set.
3562.El
3563.It Ic terminal-overrides[] Ar string
3564Allow terminal descriptions read using
3565.Xr terminfo 5
3566to be overridden.
3567Each entry is a colon-separated string made up of a terminal type pattern
3568(matched using
3569.Xr fnmatch 3 )
3570and a set of
3571.Em name=value
3572entries.
3573.Pp
3574For example, to set the
3575.Ql clear
3576.Xr terminfo 5
3577entry to
3578.Ql \ee[H\ee[2J
3579for all terminal types matching
3580.Ql rxvt* :
3581.Pp
3582.Dl "rxvt*:clear=\ee[H\ee[2J"
3583.Pp
3584The terminal entry value is passed through
3585.Xr strunvis 3
3586before interpretation.
3587.It Ic user-keys[] Ar key
3588Set list of user-defined key escape sequences.
3589Each item is associated with a key named
3590.Ql User0 ,
3591.Ql User1 ,
3592and so on.
3593.Pp
3594For example:
3595.Bd -literal -offset indent
3596set -s user-keys[0] "\ee[5;30012~"
3597bind User0 resize-pane -L 3
3598.Ed
3599.El
3600.Pp
3601Available session options are:
3602.Bl -tag -width Ds
3603.It Xo Ic activity-action
3604.Op Ic any | none | current | other
3605.Xc
3606Set action on window activity when
3607.Ic monitor-activity
3608is on.
3609.Ic any
3610means activity in any window linked to a session causes a bell or message
3611(depending on
3612.Ic visual-activity )
3613in the current window of that session,
3614.Ic none
3615means all activity is ignored (equivalent to
3616.Ic monitor-activity
3617being off),
3618.Ic current
3619means only activity in windows other than the current window are ignored and
3620.Ic other
3621means activity in the current window is ignored but not those in other windows.
3622.It Ic assume-paste-time Ar milliseconds
3623If keys are entered faster than one in
3624.Ar milliseconds ,
3625they are assumed to have been pasted rather than typed and
3626.Nm
3627key bindings are not processed.
3628The default is one millisecond and zero disables.
3629.It Ic base-index Ar index
3630Set the base index from which an unused index should be searched when a new
3631window is created.
3632The default is zero.
3633.It Xo Ic bell-action
3634.Op Ic any | none | current | other
3635.Xc
3636Set action on a bell in a window when
3637.Ic monitor-bell
3638is on.
3639The values are the same as those for
3640.Ic activity-action .
3641.It Ic default-command Ar shell-command
3642Set the command used for new windows (if not specified when the window is
3643created) to
3644.Ar shell-command ,
3645which may be any
3646.Xr sh 1
3647command.
3648The default is an empty string, which instructs
3649.Nm
3650to create a login shell using the value of the
3651.Ic default-shell
3652option.
3653.It Ic default-shell Ar path
3654Specify the default shell.
3655This is used as the login shell for new windows when the
3656.Ic default-command
3657option is set to empty, and must be the full path of the executable.
3658When started
3659.Nm
3660tries to set a default value from the first suitable of the
3661.Ev SHELL
3662environment variable, the shell returned by
3663.Xr getpwuid 3 ,
3664or
3665.Pa /bin/sh .
3666This option should be configured when
3667.Nm
3668is used as a login shell.
3669.It Ic default-size Ar XxY
3670Set the default size of new windows when the
3671.Ic window-size
3672option is set to manual or when a session is created with
3673.Ic new-session
3674.Fl d .
3675The value is the width and height separated by an
3676.Ql x
3677character.
3678The default is 80x24.
3679.It Xo Ic destroy-unattached
3680.Op Ic on | off
3681.Xc
3682If enabled and the session is no longer attached to any clients, it is
3683destroyed.
3684.It Xo Ic detach-on-destroy
3685.Op Ic off | on | no-detached
3686.Xc
3687If on (the default), the client is detached when the session it is attached to
3688is destroyed.
3689If off, the client is switched to the most recently active of the remaining
3690sessions.
3691If
3692.Ic no-detached ,
3693the client is detached only if there are no detached sessions; if detached
3694sessions exist, the client is switched to the most recently active.
3695.It Ic display-panes-active-colour Ar colour
3696Set the colour used by the
3697.Ic display-panes
3698command to show the indicator for the active pane.
3699.It Ic display-panes-colour Ar colour
3700Set the colour used by the
3701.Ic display-panes
3702command to show the indicators for inactive panes.
3703.It Ic display-panes-time Ar time
3704Set the time in milliseconds for which the indicators shown by the
3705.Ic display-panes
3706command appear.
3707.It Ic display-time Ar time
3708Set the amount of time for which status line messages and other on-screen
3709indicators are displayed.
3710If set to 0, messages and indicators are displayed until a key is pressed.
3711.Ar time
3712is in milliseconds.
3713.It Ic history-limit Ar lines
3714Set the maximum number of lines held in window history.
3715This setting applies only to new windows - existing window histories are not
3716resized and retain the limit at the point they were created.
3717.It Ic key-table Ar key-table
3718Set the default key table to
3719.Ar key-table
3720instead of
3721.Em root .
3722.It Ic lock-after-time Ar number
3723Lock the session (like the
3724.Ic lock-session
3725command) after
3726.Ar number
3727seconds of inactivity.
3728The default is not to lock (set to 0).
3729.It Ic lock-command Ar shell-command
3730Command to run when locking each client.
3731The default is to run
3732.Xr lock 1
3733with
3734.Fl np .
3735.It Ic message-command-style Ar style
3736Set status line message command style.
3737This is used for the command prompt with
3738.Xr vi 1
3739keys when in command mode.
3740For how to specify
3741.Ar style ,
3742see the
3743.Sx STYLES
3744section.
3745.It Ic message-style Ar style
3746Set status line message style.
3747This is used for messages and for the command prompt.
3748For how to specify
3749.Ar style ,
3750see the
3751.Sx STYLES
3752section.
3753.It Xo Ic mouse
3754.Op Ic on | off
3755.Xc
3756If on,
3757.Nm
3758captures the mouse and allows mouse events to be bound as key bindings.
3759See the
3760.Sx MOUSE SUPPORT
3761section for details.
3762.It Ic prefix Ar key
3763Set the key accepted as a prefix key.
3764In addition to the standard keys described under
3765.Sx KEY BINDINGS ,
3766.Ic prefix
3767can be set to the special key
3768.Ql None
3769to set no prefix.
3770.It Ic prefix2 Ar key
3771Set a secondary key accepted as a prefix key.
3772Like
3773.Ic prefix ,
3774.Ic prefix2
3775can be set to
3776.Ql None .
3777.It Xo Ic renumber-windows
3778.Op Ic on | off
3779.Xc
3780If on, when a window is closed in a session, automatically renumber the other
3781windows in numerical order.
3782This respects the
3783.Ic base-index
3784option if it has been set.
3785If off, do not renumber the windows.
3786.It Ic repeat-time Ar time
3787Allow multiple commands to be entered without pressing the prefix-key again
3788in the specified
3789.Ar time
3790milliseconds (the default is 500).
3791Whether a key repeats may be set when it is bound using the
3792.Fl r
3793flag to
3794.Ic bind-key .
3795Repeat is enabled for the default keys bound to the
3796.Ic resize-pane
3797command.
3798.It Xo Ic set-titles
3799.Op Ic on | off
3800.Xc
3801Attempt to set the client terminal title using the
3802.Em tsl
3803and
3804.Em fsl
3805.Xr terminfo 5
3806entries if they exist.
3807.Nm
3808automatically sets these to the \ee]0;...\e007 sequence if
3809the terminal appears to be
3810.Xr xterm 1 .
3811This option is off by default.
3812.It Ic set-titles-string Ar string
3813String used to set the client terminal title if
3814.Ic set-titles
3815is on.
3816Formats are expanded, see the
3817.Sx FORMATS
3818section.
3819.It Xo Ic silence-action
3820.Op Ic any | none | current | other
3821.Xc
3822Set action on window silence when
3823.Ic monitor-silence
3824is on.
3825The values are the same as those for
3826.Ic activity-action .
3827.It Xo Ic status
3828.Op Ic off | on | 2 | 3 | 4 | 5
3829.Xc
3830Show or hide the status line or specify its size.
3831Using
3832.Ic on
3833gives a status line one row in height;
3834.Ic 2 ,
3835.Ic 3 ,
3836.Ic 4
3837or
3838.Ic 5
3839more rows.
3840.It Ic status-format[] Ar format
3841Specify the format to be used for each line of the status line.
3842The default builds the top status line from the various individual status
3843options below.
3844.It Ic status-interval Ar interval
3845Update the status line every
3846.Ar interval
3847seconds.
3848By default, updates will occur every 15 seconds.
3849A setting of zero disables redrawing at interval.
3850.It Xo Ic status-justify
3851.Op Ic left | centre | right | absolute-centre
3852.Xc
3853Set the position of the window list in the status line: left, centre or right.
3854centre puts the window list in the relative centre of the available free space;
3855absolute-centre uses the centre of the entire horizontal space.
3856.It Xo Ic status-keys
3857.Op Ic vi | emacs
3858.Xc
3859Use vi or emacs-style
3860key bindings in the status line, for example at the command prompt.
3861The default is emacs, unless the
3862.Ev VISUAL
3863or
3864.Ev EDITOR
3865environment variables are set and contain the string
3866.Ql vi .
3867.It Ic status-left Ar string
3868Display
3869.Ar string
3870(by default the session name) to the left of the status line.
3871.Ar string
3872will be passed through
3873.Xr strftime 3 .
3874Also see the
3875.Sx FORMATS
3876and
3877.Sx STYLES
3878sections.
3879.Pp
3880For details on how the names and titles can be set see the
3881.Sx "NAMES AND TITLES"
3882section.
3883.Pp
3884Examples are:
3885.Bd -literal -offset indent
3886#(sysctl vm.loadavg)
3887#[fg=yellow,bold]#(apm -l)%%#[default] [#S]
3888.Ed
3889.Pp
3890The default is
3891.Ql "[#S] " .
3892.It Ic status-left-length Ar length
3893Set the maximum
3894.Ar length
3895of the left component of the status line.
3896The default is 10.
3897.It Ic status-left-style Ar style
3898Set the style of the left part of the status line.
3899For how to specify
3900.Ar style ,
3901see the
3902.Sx STYLES
3903section.
3904.It Xo Ic status-position
3905.Op Ic top | bottom
3906.Xc
3907Set the position of the status line.
3908.It Ic status-right Ar string
3909Display
3910.Ar string
3911to the right of the status line.
3912By default, the current pane title in double quotes, the date and the time
3913are shown.
3914As with
3915.Ic status-left ,
3916.Ar string
3917will be passed to
3918.Xr strftime 3
3919and character pairs are replaced.
3920.It Ic status-right-length Ar length
3921Set the maximum
3922.Ar length
3923of the right component of the status line.
3924The default is 40.
3925.It Ic status-right-style Ar style
3926Set the style of the right part of the status line.
3927For how to specify
3928.Ar style ,
3929see the
3930.Sx STYLES
3931section.
3932.It Ic status-style Ar style
3933Set status line style.
3934For how to specify
3935.Ar style ,
3936see the
3937.Sx STYLES
3938section.
3939.It Ic update-environment[] Ar variable
3940Set list of environment variables to be copied into the session environment
3941when a new session is created or an existing session is attached.
3942Any variables that do not exist in the source environment are set to be
3943removed from the session environment (as if
3944.Fl r
3945was given to the
3946.Ic set-environment
3947command).
3948.It Xo Ic visual-activity
3949.Op Ic on | off | both
3950.Xc
3951If on, display a message instead of sending a bell when activity occurs in a
3952window for which the
3953.Ic monitor-activity
3954window option is enabled.
3955If set to both, a bell and a message are produced.
3956.It Xo Ic visual-bell
3957.Op Ic on | off | both
3958.Xc
3959If on, a message is shown on a bell in a window for which the
3960.Ic monitor-bell
3961window option is enabled instead of it being passed through to the
3962terminal (which normally makes a sound).
3963If set to both, a bell and a message are produced.
3964Also see the
3965.Ic bell-action
3966option.
3967.It Xo Ic visual-silence
3968.Op Ic on | off | both
3969.Xc
3970If
3971.Ic monitor-silence
3972is enabled, prints a message after the interval has expired on a given window
3973instead of sending a bell.
3974If set to both, a bell and a message are produced.
3975.It Ic word-separators Ar string
3976Sets the session's conception of what characters are considered word
3977separators, for the purposes of the next and previous word commands in
3978copy mode.
3979The default is
3980.Ql \ -_@ .
3981.El
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.Sh HOOKS
4337.Nm
4338allows commands to run on various triggers, called
4339.Em hooks .
4340Most
4341.Nm
4342commands have an
4343.Em after
4344hook and there are a number of hooks not associated with commands.
4345.Pp
4346Hooks are stored as array options, members of the array are executed in
4347order when the hook is triggered.
4348Like options different hooks may be global or belong to a session, window or pane.
4349Hooks may be configured with the
4350.Ic set-hook
4351or
4352.Ic set-option
4353commands and displayed with
4354.Ic show-hooks
4355or
4356.Ic show-options
4357.Fl H .
4358The following two commands are equivalent:
4359.Bd -literal -offset indent.
4360set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red'
4361set-option -g pane-mode-changed[42] 'set -g status-left-style bg=red'
4362.Ed
4363.Pp
4364Setting a hook without specifying an array index clears the hook and sets the
4365first member of the array.
4366.Pp
4367A command's after
4368hook is run after it completes, except when the command is run as part of a hook
4369itself.
4370They are named with an
4371.Ql after-
4372prefix.
4373For example, the following command adds a hook to select the even-vertical
4374layout after every
4375.Ic split-window :
4376.Bd -literal -offset indent
4377set-hook -g after-split-window "selectl even-vertical"
4378.Ed
4379.Pp
4380All the notifications listed in the
4381.Sx CONTROL MODE
4382section are hooks (without any arguments), except
4383.Ic %exit .
4384The following additional hooks are available:
4385.Bl -tag -width "XXXXXXXXXXXXXXXXXXXXXX"
4386.It alert-activity
4387Run when a window has activity.
4388See
4389.Ic monitor-activity .
4390.It alert-bell
4391Run when a window has received a bell.
4392See
4393.Ic monitor-bell .
4394.It alert-silence
4395Run when a window has been silent.
4396See
4397.Ic monitor-silence .
4398.It client-attached
4399Run when a client is attached.
4400.It client-detached
4401Run when a client is detached
4402.It client-resized
4403Run when a client is resized.
4404.It client-session-changed
4405Run when a client's attached session is changed.
4406.It pane-died
4407Run when the program running in a pane exits, but
4408.Ic remain-on-exit
4409is on so the pane has not closed.
4410.It pane-exited
4411Run when the program running in a pane exits.
4412.It pane-focus-in
4413Run when the focus enters a pane, if the
4414.Ic focus-events
4415option is on.
4416.It pane-focus-out
4417Run when the focus exits a pane, if the
4418.Ic focus-events
4419option is on.
4420.It pane-set-clipboard
4421Run when the terminal clipboard is set using the
4422.Xr xterm 1
4423escape sequence.
4424.It session-created
4425Run when a new session created.
4426.It session-closed
4427Run when a session closed.
4428.It session-renamed
4429Run when a session is renamed.
4430.It window-linked
4431Run when a window is linked into a session.
4432.It window-renamed
4433Run when a window is renamed.
4434.It window-unlinked
4435Run when a window is unlinked from a session.
4436.El
4437.Pp
4438Hooks are managed with these commands:
4439.Bl -tag -width Ds
4440.It Xo Ic set-hook
4441.Op Fl agpRuw
4442.Op Fl t Ar target-pane
4443.Ar hook-name
4444.Ar command
4445.Xc
4446Without
4447.Fl R ,
4448sets (or with
4449.Fl u
4450unsets) hook
4451.Ar hook-name
4452to
4453.Ar command .
4454The flags are the same as for
4455.Ic set-option .
4456.Pp
4457With
4458.Fl R ,
4459run
4460.Ar hook-name
4461immediately.
4462.It Xo Ic show-hooks
4463.Op Fl gpw
4464.Op Fl t Ar target-pane
4465.Xc
4466Shows hooks.
4467The flags are the same as for
4468.Ic show-options .
4469.El
4470.Sh MOUSE SUPPORT
4471If the
4472.Ic mouse
4473option is on (the default is off),
4474.Nm
4475allows mouse events to be bound as keys.
4476The name of each key is made up of a mouse event (such as
4477.Ql MouseUp1 )
4478and a location suffix, one of the following:
4479.Bl -column "XXXXXXXXXXXXX" -offset indent
4480.It Li "Pane" Ta "the contents of a pane"
4481.It Li "Border" Ta "a pane border"
4482.It Li "Status" Ta "the status line window list"
4483.It Li "StatusLeft" Ta "the left part of the status line"
4484.It Li "StatusRight" Ta "the right part of the status line"
4485.It Li "StatusDefault" Ta "any other part of the status line"
4486.El
4487.Pp
4488The following mouse events are available:
4489.Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent
4490.It Li "WheelUp" Ta "WheelDown" Ta ""
4491.It Li "MouseDown1" Ta "MouseUp1" Ta "MouseDrag1" Ta "MouseDragEnd1"
4492.It Li "MouseDown2" Ta "MouseUp2" Ta "MouseDrag2" Ta "MouseDragEnd2"
4493.It Li "MouseDown3" Ta "MouseUp3" Ta "MouseDrag3" Ta "MouseDragEnd3"
4494.It Li "SecondClick1" Ta "SecondClick2" Ta "SecondClick3"
4495.It Li "DoubleClick1" Ta "DoubleClick2" Ta "DoubleClick3"
4496.It Li "TripleClick1" Ta "TripleClick2" Ta "TripleClick3"
4497.El
4498.Pp
4499The
4500.Ql SecondClick
4501events are fired for the second click of a double click, even if there may be a
4502third click which will fire
4503.Ql TripleClick
4504instead of
4505.Ql DoubleClick .
4506.Pp
4507Each should be suffixed with a location, for example
4508.Ql MouseDown1Status .
4509.Pp
4510The special token
4511.Ql {mouse}
4512or
4513.Ql =
4514may be used as
4515.Ar target-window
4516or
4517.Ar target-pane
4518in commands bound to mouse key bindings.
4519It resolves to the window or pane over which the mouse event took place
4520(for example, the window in the status line over which button 1 was released for a
4521.Ql MouseUp1Status
4522binding, or the pane over which the wheel was scrolled for a
4523.Ql WheelDownPane
4524binding).
4525.Pp
4526The
4527.Ic send-keys
4528.Fl M
4529flag may be used to forward a mouse event to a pane.
4530.Pp
4531The default key bindings allow the mouse to be used to select and resize panes,
4532to copy text and to change window using the status line.
4533These take effect if the
4534.Ic mouse
4535option is turned on.
4536.Sh FORMATS
4537Certain commands accept the
4538.Fl F
4539flag with a
4540.Ar format
4541argument.
4542This is a string which controls the output format of the command.
4543Format variables are enclosed in
4544.Ql #{
4545and
4546.Ql } ,
4547for example
4548.Ql #{session_name} .
4549The possible variables are listed in the table below, or the name of a
4550.Nm
4551option may be used for an option's value.
4552Some variables have a shorter alias such as
4553.Ql #S ;
4554.Ql ##
4555is replaced by a single
4556.Ql # ,
4557.Ql #,
4558by a
4559.Ql \&,
4560and
4561.Ql #}
4562by a
4563.Ql } .
4564.Pp
4565Conditionals are available by prefixing with
4566.Ql \&?
4567and separating two alternatives with a comma;
4568if the specified variable exists and is not zero, the first alternative
4569is chosen, otherwise the second is used.
4570For example
4571.Ql #{?session_attached,attached,not attached}
4572will include the string
4573.Ql attached
4574if the session is attached and the string
4575.Ql not attached
4576if it is unattached, or
4577.Ql #{?automatic-rename,yes,no}
4578will include
4579.Ql yes
4580if
4581.Ic automatic-rename
4582is enabled, or
4583.Ql no
4584if not.
4585Conditionals can be nested arbitrarily.
4586Inside a conditional,
4587.Ql \&,
4588and
4589.Ql }
4590must be escaped as
4591.Ql #,
4592and
4593.Ql #} ,
4594unless they are part of a
4595.Ql #{...}
4596replacement.
4597For example:
4598.Bd -literal -offset indent
4599#{?pane_in_mode,#[fg=white#,bg=red],#[fg=red#,bg=white]}#W .
4600.Ed
4601.Pp
4602String comparisons may be expressed by prefixing two comma-separated
4603alternatives by
4604.Ql == ,
4605.Ql != ,
4606.Ql < ,
4607.Ql > ,
4608.Ql <=
4609or
4610.Ql >=
4611and a colon.
4612For example
4613.Ql #{==:#{host},myhost}
4614will be replaced by
4615.Ql 1
4616if running on
4617.Ql myhost ,
4618otherwise by
4619.Ql 0 .
4620.Ql ||
4621and
4622.Ql &&
4623evaluate to true if either or both of two comma-separated alternatives are
4624true, for example
4625.Ql #{||:#{pane_in_mode},#{alternate_on}} .
4626.Pp
4627An
4628.Ql m
4629specifies an
4630.Xr fnmatch 3
4631or regular expression comparison.
4632The first argument is the pattern and the second the string to compare.
4633An optional argument specifies flags:
4634.Ql r
4635means the pattern is a regular expression instead of the default
4636.Xr fnmatch 3
4637pattern, and
4638.Ql i
4639means to ignore case.
4640For example:
4641.Ql #{m:*foo*,#{host}}
4642or
4643.Ql #{m/ri:^A,MYVAR} .
4644A
4645.Ql C
4646performs a search for an
4647.Xr fnmatch 3
4648pattern or regular expression in the pane content and evaluates to zero if not
4649found, or a line number if found.
4650Like
4651.Ql m ,
4652an
4653.Ql r
4654flag means search for a regular expression and
4655.Ql i
4656ignores case.
4657For example:
4658.Ql #{C/r:^Start}
4659.Pp
4660Numeric operators may be performed by prefixing two comma-separated alternatives with an
4661.Ql e
4662and an operator.
4663An optional
4664.Ql f
4665flag may be given after the operator to use floating point numbers, otherwise integers are used.
4666This may be followed by a number giving the number of decimal places to use for the result.
4667The available operators are:
4668addition
4669.Ql + ,
4670subtraction
4671.Ql - ,
4672multiplication
4673.Ql * ,
4674division
4675.Ql / ,
4676modulus
4677.Ql m
4678or
4679.Ql %
4680(note that
4681.Ql %
4682must be escaped as
4683.Ql %%
4684in formats which are also expanded by
4685.Xr strftime 3 )
4686and numeric comparison operators
4687.Ql == ,
4688.Ql != ,
4689.Ql < ,
4690.Ql <= ,
4691.Ql >
4692and
4693.Ql >= .
4694For example,
4695.Ql #{e|*|f|4:5.5,3}
4696multiplies 5.5 by 3 for a result with four decimal places and
4697.Ql #{e|%%:7,3}
4698returns the modulus of 7 and 3.
4699.Ql a
4700replaces a numeric argument by its ASCII equivalent, so
4701.Ql #{a:98}
4702results in
4703.Ql b .
4704.Pp
4705A limit may be placed on the length of the resultant string by prefixing it
4706by an
4707.Ql = ,
4708a number and a colon.
4709Positive numbers count from the start of the string and negative from the end,
4710so
4711.Ql #{=5:pane_title}
4712will include at most the first five characters of the pane title, or
4713.Ql #{=-5:pane_title}
4714the last five characters.
4715A suffix or prefix may be given as a second argument - if provided then it is
4716appended or prepended to the string if the length has been trimmed, for example
4717.Ql #{=/5/...:pane_title}
4718will append
4719.Ql ...
4720if the pane title is more than five characters.
4721Similarly,
4722.Ql p
4723pads the string to a given width, for example
4724.Ql #{p10:pane_title}
4725will result in a width of at least 10 characters.
4726A positive width pads on the left, a negative on the right.
4727.Ql n
4728expands to the length of the variable and
4729.Ql w
4730to its width when displayed, for example
4731.Ql #{n:window_name} .
4732.Pp
4733Prefixing a time variable with
4734.Ql t:\&
4735will convert it to a string, so if
4736.Ql #{window_activity}
4737gives
4738.Ql 1445765102 ,
4739.Ql #{t:window_activity}
4740gives
4741.Ql Sun Oct 25 09:25:02 2015 .
4742Adding
4743.Ql p (
4744.Ql `t/p` )
4745will use shorter but less accurate time format for times in the past.
4746A custom format may be given using an
4747.Ql f
4748suffix (note that
4749.Ql %
4750must be escaped as
4751.Ql %%
4752if the format is separately being passed through
4753.Xr strftime 3 ,
4754for example in the
4755.Ic status-left
4756option):
4757.Ql #{t/f/%%H#:%%M:window_activity} ,
4758see
4759.Xr strftime 3 .
4760.Pp
4761The
4762.Ql b:\&
4763and
4764.Ql d:\&
4765prefixes are
4766.Xr basename 3
4767and
4768.Xr dirname 3
4769of the variable respectively.
4770.Ql q:\&
4771will escape
4772.Xr sh 1
4773special characters or with a
4774.Ql h
4775suffix, escape hash characters (so
4776.Ql #
4777becomes
4778.Ql ## ) .
4779.Ql E:\&
4780will expand the format twice, for example
4781.Ql #{E:status-left}
4782is the result of expanding the content of the
4783.Ic status-left
4784option rather than the option itself.
4785.Ql T:\&
4786is like
4787.Ql E:\&
4788but also expands
4789.Xr strftime 3
4790specifiers.
4791.Ql S:\& ,
4792.Ql W:\&
4793or
4794.Ql P:\&
4795will loop over each session, window or pane and insert the format once
4796for each.
4797For windows and panes, two comma-separated formats may be given:
4798the second is used for the current window or active pane.
4799For example, to get a list of windows formatted like the status line:
4800.Bd -literal -offset indent
4801#{W:#{E:window-status-format} ,#{E:window-status-current-format} }
4802.Ed
4803.Pp
4804.Ql N:\&
4805checks if a window (without any suffix or with the
4806.Ql w
4807suffix) or a session (with the
4808.Ql s
4809suffix) name exists, for example
4810.Ql `N/w:foo`
4811is replaced with 1 if a window named
4812.Ql foo
4813exists.
4814.Pp
4815A prefix of the form
4816.Ql s/foo/bar/:\&
4817will substitute
4818.Ql foo
4819with
4820.Ql bar
4821throughout.
4822The first argument may be an extended regular expression and a final argument may be
4823.Ql i
4824to ignore case, for example
4825.Ql s/a(.)/\e1x/i:\&
4826would change
4827.Ql abABab
4828into
4829.Ql bxBxbx .
4830.Pp
4831In addition, the last line of a shell command's output may be inserted using
4832.Ql #() .
4833For example,
4834.Ql #(uptime)
4835will insert the system's uptime.
4836When constructing formats,
4837.Nm
4838does not wait for
4839.Ql #()
4840commands to finish; instead, the previous result from running the same command is used,
4841or a placeholder if the command has not been run before.
4842If the command hasn't exited, the most recent line of output will be used, but the status
4843line will not be updated more than once a second.
4844Commands are executed with the
4845.Nm
4846global environment set (see the
4847.Sx GLOBAL AND SESSION ENVIRONMENT
4848section).
4849.Pp
4850An
4851.Ql l
4852specifies that a string should be interpreted literally and not expanded.
4853For example
4854.Ql #{l:#{?pane_in_mode,yes,no}}
4855will be replaced by
4856.Ql #{?pane_in_mode,yes,no} .
4857.Pp
4858The following variables are available, where appropriate:
4859.Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX"
4860.It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with"
4861.It Li "active_window_index" Ta "" Ta "Index of active window in session"
4862.It Li "alternate_on" Ta "" Ta "1 if pane is in alternate screen"
4863.It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen"
4864.It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen"
4865.It Li "buffer_created" Ta "" Ta "Time buffer created"
4866.It Li "buffer_name" Ta "" Ta "Name of buffer"
4867.It Li "buffer_sample" Ta "" Ta "Sample of start of buffer"
4868.It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes"
4869.It Li "client_activity" Ta "" Ta "Time client last had activity"
4870.It Li "client_cell_height" Ta "" Ta "Height of each client cell in pixels"
4871.It Li "client_cell_width" Ta "" Ta "Width of each client cell in pixels"
4872.It Li "client_control_mode" Ta "" Ta "1 if client is in control mode"
4873.It Li "client_created" Ta "" Ta "Time client created"
4874.It Li "client_discarded" Ta "" Ta "Bytes discarded when client behind"
4875.It Li "client_flags" Ta "" Ta "List of client flags"
4876.It Li "client_height" Ta "" Ta "Height of client"
4877.It Li "client_key_table" Ta "" Ta "Current key table"
4878.It Li "client_last_session" Ta "" Ta "Name of the client's last session"
4879.It Li "client_name" Ta "" Ta "Name of client"
4880.It Li "client_pid" Ta "" Ta "PID of client process"
4881.It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed"
4882.It Li "client_readonly" Ta "" Ta "1 if client is readonly"
4883.It Li "client_session" Ta "" Ta "Name of the client's session"
4884.It Li "client_termfeatures" Ta "" Ta "Terminal features of client, if any"
4885.It Li "client_termname" Ta "" Ta "Terminal name of client"
4886.It Li "client_termtype" Ta "" Ta "Terminal type of client, if available"
4887.It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
4888.It Li "client_utf8" Ta "" Ta "1 if client supports UTF-8"
4889.It Li "client_width" Ta "" Ta "Width of client"
4890.It Li "client_written" Ta "" Ta "Bytes written to client"
4891.It Li "command" Ta "" Ta "Name of command in use, if any"
4892.It Li "command_list_alias" Ta "" Ta "Command alias if listing commands"
4893.It Li "command_list_name" Ta "" Ta "Command name if listing commands"
4894.It Li "command_list_usage" Ta "" Ta "Command usage if listing commands"
4895.It Li "config_files" Ta "" Ta "List of configuration files loaded"
4896.It Li "copy_cursor_line" Ta "" Ta "Line the cursor is on in copy mode"
4897.It Li "copy_cursor_word" Ta "" Ta "Word under cursor in copy mode"
4898.It Li "copy_cursor_x" Ta "" Ta "Cursor X position in copy mode"
4899.It Li "copy_cursor_y" Ta "" Ta "Cursor Y position in copy mode"
4900.It Li "current_file" Ta "" Ta "Current configuration file"
4901.It Li "cursor_character" Ta "" Ta "Character at cursor in pane"
4902.It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
4903.It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
4904.It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"
4905.It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
4906.It Li "history_limit" Ta "" Ta "Maximum window history lines"
4907.It Li "history_size" Ta "" Ta "Size of history in lines"
4908.It Li "hook" Ta "" Ta "Name of running hook, if any"
4909.It Li "hook_pane" Ta "" Ta "ID of pane where hook was run, if any"
4910.It Li "hook_session" Ta "" Ta "ID of session where hook was run, if any"
4911.It Li "hook_session_name" Ta "" Ta "Name of session where hook was run, if any"
4912.It Li "hook_window" Ta "" Ta "ID of window where hook was run, if any"
4913.It Li "hook_window_name" Ta "" Ta "Name of window where hook was run, if any"
4914.It Li "host" Ta "#H" Ta "Hostname of local host"
4915.It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)"
4916.It Li "insert_flag" Ta "" Ta "Pane insert flag"
4917.It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag"
4918.It Li "keypad_flag" Ta "" Ta "Pane keypad flag"
4919.It Li "last_window_index" Ta "" Ta "Index of last window in session"
4920.It Li "line" Ta "" Ta "Line number in the list"
4921.It Li "mouse_all_flag" Ta "" Ta "Pane mouse all flag"
4922.It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag"
4923.It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag"
4924.It Li "mouse_line" Ta "" Ta "Line under mouse, if any"
4925.It Li "mouse_sgr_flag" Ta "" Ta "Pane mouse SGR flag"
4926.It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
4927.It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
4928.It Li "mouse_word" Ta "" Ta "Word under mouse, if any"
4929.It Li "mouse_x" Ta "" Ta "Mouse X position, if any"
4930.It Li "mouse_y" Ta "" Ta "Mouse Y position, if any"
4931.It Li "origin_flag" Ta "" Ta "Pane origin flag"
4932.It Li "pane_active" Ta "" Ta "1 if active pane"
4933.It Li "pane_at_bottom" Ta "" Ta "1 if pane is at the bottom of window"
4934.It Li "pane_at_left" Ta "" Ta "1 if pane is at the left of window"
4935.It Li "pane_at_right" Ta "" Ta "1 if pane is at the right of window"
4936.It Li "pane_at_top" Ta "" Ta "1 if pane is at the top of window"
4937.It Li "pane_bg" Ta "" Ta "Pane background colour"
4938.It Li "pane_bottom" Ta "" Ta "Bottom of pane"
4939.It Li "pane_current_command" Ta "" Ta "Current command if available"
4940.It Li "pane_current_path" Ta "" Ta "Current path if available"
4941.It Li "pane_dead" Ta "" Ta "1 if pane is dead"
4942.It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane"
4943.It Li "pane_fg" Ta "" Ta "Pane foreground colour"
4944.It Li "pane_format" Ta "" Ta "1 if format is for a pane"
4945.It Li "pane_height" Ta "" Ta "Height of pane"
4946.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
4947.It Li "pane_in_mode" Ta "" Ta "1 if pane is in a mode"
4948.It Li "pane_index" Ta "#P" Ta "Index of pane"
4949.It Li "pane_input_off" Ta "" Ta "1 if input to pane is disabled"
4950.It Li "pane_last" Ta "" Ta "1 if last pane"
4951.It Li "pane_left" Ta "" Ta "Left of pane"
4952.It Li "pane_marked" Ta "" Ta "1 if this is the marked pane"
4953.It Li "pane_marked_set" Ta "" Ta "1 if a marked pane is set"
4954.It Li "pane_mode" Ta "" Ta "Name of pane mode, if any"
4955.It Li "pane_path" Ta "" Ta "Path of pane (can be set by application)"
4956.It Li "pane_pid" Ta "" Ta "PID of first process in pane"
4957.It Li "pane_pipe" Ta "" Ta "1 if pane is being piped"
4958.It Li "pane_right" Ta "" Ta "Right of pane"
4959.It Li "pane_search_string" Ta "" Ta "Last search string in copy mode"
4960.It Li "pane_start_command" Ta "" Ta "Command pane started with"
4961.It Li "pane_synchronized" Ta "" Ta "1 if pane is synchronized"
4962.It Li "pane_tabs" Ta "" Ta "Pane tab positions"
4963.It Li "pane_title" Ta "#T" Ta "Title of pane (can be set by application)"
4964.It Li "pane_top" Ta "" Ta "Top of pane"
4965.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
4966.It Li "pane_width" Ta "" Ta "Width of pane"
4967.It Li "pid" Ta "" Ta "Server PID"
4968.It Li "rectangle_toggle" Ta "" Ta "1 if rectangle selection is activated"
4969.It Li "scroll_position" Ta "" Ta "Scroll position in copy mode"
4970.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
4971.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
4972.It Li "search_match" Ta "" Ta "Search match if any"
4973.It Li "search_present" Ta "" Ta "1 if search started in copy mode"
4974.It Li "selection_active" Ta "" Ta "1 if selection started and changes with the cursor in copy mode"
4975.It Li "selection_end_x" Ta "" Ta "X position of the end of the selection"
4976.It Li "selection_end_y" Ta "" Ta "Y position of the end of the selection"
4977.It Li "selection_present" Ta "" Ta "1 if selection started in copy mode"
4978.It Li "selection_start_x" Ta "" Ta "X position of the start of the selection"
4979.It Li "selection_start_y" Ta "" Ta "Y position of the start of the selection"
4980.It Li "session_activity" Ta "" Ta "Time of session last activity"
4981.It Li "session_alerts" Ta "" Ta "List of window indexes with alerts"
4982.It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
4983.It Li "session_attached_list" Ta "" Ta "List of clients session is attached to"
4984.It Li "session_created" Ta "" Ta "Time session created"
4985.It Li "session_format" Ta "" Ta "1 if format is for a session"
4986.It Li "session_group" Ta "" Ta "Name of session group"
4987.It Li "session_group_attached" Ta "" Ta "Number of clients sessions in group are attached to"
4988.It Li "session_group_attached_list" Ta "" Ta "List of clients sessions in group are attached to"
4989.It Li "session_group_list" Ta "" Ta "List of sessions in group"
4990.It Li "session_group_many_attached" Ta "" Ta "1 if multiple clients attached to sessions in group"
4991.It Li "session_group_size" Ta "" Ta "Size of session group"
4992.It Li "session_grouped" Ta "" Ta "1 if session in a group"
4993.It Li "session_id" Ta "" Ta "Unique session ID"
4994.It Li "session_last_attached" Ta "" Ta "Time session last attached"
4995.It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached"
4996.It Li "session_marked" Ta "" Ta "1 if this session contains the marked pane"
4997.It Li "session_name" Ta "#S" Ta "Name of session"
4998.It Li "session_path" Ta "" Ta "Working directory of session"
4999.It Li "session_stack" Ta "" Ta "Window indexes in most recent order"
5000.It Li "session_windows" Ta "" Ta "Number of windows in session"
5001.It Li "socket_path" Ta "" Ta "Server socket path"
5002.It Li "start_time" Ta "" Ta "Server start time"
5003.It Li "version" Ta "" Ta "Server version"
5004.It Li "window_active" Ta "" Ta "1 if window active"
5005.It Li "window_active_clients" Ta "" Ta "Number of clients viewing this window"
5006.It Li "window_active_clients_list" Ta "" Ta "List of clients viewing this window"
5007.It Li "window_active_sessions" Ta "" Ta "Number of sessions on which this window is active"
5008.It Li "window_active_sessions_list" Ta "" Ta "List of sessions on which this window is active"
5009.It Li "window_activity" Ta "" Ta "Time of window last activity"
5010.It Li "window_activity_flag" Ta "" Ta "1 if window has activity"
5011.It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
5012.It Li "window_bigger" Ta "" Ta "1 if window is larger than client"
5013.It Li "window_cell_height" Ta "" Ta "Height of each cell in pixels"
5014.It Li "window_cell_width" Ta "" Ta "Width of each cell in pixels"
5015.It Li "window_end_flag" Ta "" Ta "1 if window has the highest index"
5016.It Li "window_flags" Ta "#F" Ta "Window flags with # escaped as ##"
5017.It Li "window_raw_flags" Ta "" Ta "Window flags with nothing escaped"
5018.It Li "window_format" Ta "" Ta "1 if format is for a window"
5019.It Li "window_height" Ta "" Ta "Height of window"
5020.It Li "window_id" Ta "" Ta "Unique window ID"
5021.It Li "window_index" Ta "#I" Ta "Index of window"
5022.It Li "window_last_flag" Ta "" Ta "1 if window is the last used"
5023.It Li "window_layout" Ta "" Ta "Window layout description, ignoring zoomed window panes"
5024.It Li "window_linked" Ta "" Ta "1 if window is linked across sessions"
5025.It Li "window_linked_sessions" Ta "" Ta "Number of sessions this window is linked to"
5026.It Li "window_linked_sessions_list" Ta "" Ta "List of sessions this window is linked to"
5027.It Li "window_marked_flag" Ta "" Ta "1 if window contains the marked pane"
5028.It Li "window_name" Ta "#W" Ta "Name of window"
5029.It Li "window_offset_x" Ta "" Ta "X offset into window if larger than client"
5030.It Li "window_offset_y" Ta "" Ta "Y offset into window if larger than client"
5031.It Li "window_panes" Ta "" Ta "Number of panes in window"
5032.It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
5033.It Li "window_stack_index" Ta "" Ta "Index in session most recent stack"
5034.It Li "window_start_flag" Ta "" Ta "1 if window has the lowest index"
5035.It Li "window_visible_layout" Ta "" Ta "Window layout description, respecting zoomed window panes"
5036.It Li "window_width" Ta "" Ta "Width of window"
5037.It Li "window_zoomed_flag" Ta "" Ta "1 if window is zoomed"
5038.It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
5039.El
5040.Sh STYLES
5041.Nm
5042offers various options to specify the colour and attributes of aspects of the
5043interface, for example
5044.Ic status-style
5045for the status line.
5046In addition, embedded styles may be specified in format options, such as
5047.Ic status-left ,
5048by enclosing them in
5049.Ql #[
5050and
5051.Ql \&] .
5052.Pp
5053A style may be the single term
5054.Ql default
5055to specify the default style (which may come from an option, for example
5056.Ic status-style
5057in the status line) or a space
5058or comma separated list of the following:
5059.Bl -tag -width Ds
5060.It Ic fg=colour
5061Set the foreground colour.
5062The colour is one of:
5063.Ic black ,
5064.Ic red ,
5065.Ic green ,
5066.Ic yellow ,
5067.Ic blue ,
5068.Ic magenta ,
5069.Ic cyan ,
5070.Ic white ;
5071if supported the bright variants
5072.Ic brightred ,
5073.Ic brightgreen ,
5074.Ic brightyellow ;
5075.Ic colour0
5076to
5077.Ic colour255
5078from the 256-colour set;
5079.Ic default
5080for the default colour;
5081.Ic terminal
5082for the terminal default colour; or a hexadecimal RGB string such as
5083.Ql #ffffff .
5084.It Ic bg=colour
5085Set the background colour.
5086.It Ic none
5087Set no attributes (turn off any active attributes).
5088.It Xo Ic acs ,
5089.Ic bright
5090(or
5091.Ic bold ) ,
5092.Ic dim ,
5093.Ic underscore ,
5094.Ic blink ,
5095.Ic reverse ,
5096.Ic hidden ,
5097.Ic italics ,
5098.Ic overline ,
5099.Ic strikethrough ,
5100.Ic double-underscore ,
5101.Ic curly-underscore ,
5102.Ic dotted-underscore ,
5103.Ic dashed-underscore
5104.Xc
5105Set an attribute.
5106Any of the attributes may be prefixed with
5107.Ql no
5108to unset.
5109.Ic acs
5110is the terminal alternate character set.
5111.It Xo Ic align=left
5112(or
5113.Ic noalign ) ,
5114.Ic align=centre ,
5115.Ic align=right
5116.Xc
5117Align text to the left, centre or right of the available space if appropriate.
5118.It Ic fill=colour
5119Fill the available space with a background colour if appropriate.
5120.It Xo Ic list=on ,
5121.Ic list=focus ,
5122.Ic list=left-marker ,
5123.Ic list=right-marker ,
5124.Ic nolist
5125.Xc
5126Mark the position of the various window list components in the
5127.Ic status-format
5128option:
5129.Ic list=on
5130marks the start of the list;
5131.Ic list=focus
5132is the part of the list that should be kept in focus if the entire list won't fit
5133in the available space (typically the current window);
5134.Ic list=left-marker
5135and
5136.Ic list=right-marker
5137mark the text to be used to mark that text has been trimmed from the left or
5138right of the list if there is not enough space.
5139.It Xo Ic push-default ,
5140.Ic pop-default
5141.Xc
5142Store the current colours and attributes as the default or reset to the previous
5143default.
5144A
5145.Ic push-default
5146affects any subsequent use of the
5147.Ic default
5148term until a
5149.Ic pop-default .
5150Only one default may be pushed (each
5151.Ic push-default
5152replaces the previous saved default).
5153.It Xo Ic range=left ,
5154.Ic range=right ,
5155.Ic range=window|X ,
5156.Ic norange
5157.Xc
5158Mark a range in the
5159.Ic status-format
5160option.
5161.Ic range=left
5162and
5163.Ic range=right
5164are the text used for the
5165.Ql StatusLeft
5166and
5167.Ql StatusRight
5168mouse keys.
5169.Ic range=window|X
5170is the range for a window passed to the
5171.Ql Status
5172mouse key, where
5173.Ql X
5174is a window index.
5175.El
5176.Pp
5177Examples are:
5178.Bd -literal -offset indent
5179fg=yellow bold underscore blink
5180bg=black,fg=default,noreverse
5181.Ed
5182.Sh NAMES AND TITLES
5183.Nm
5184distinguishes between names and titles.
5185Windows and sessions have names, which may be used to specify them in targets
5186and are displayed in the status line and various lists: the name is the
5187.Nm
5188identifier for a window or session.
5189Only panes have titles.
5190A pane's title is typically set by the program running inside the pane using
5191an escape sequence (like it would set the
5192.Xr xterm 1
5193window title in
5194.Xr X 7 ) .
5195Windows themselves do not have titles - a window's title is the title of its
5196active pane.
5197.Nm
5198itself may set the title of the terminal in which the client is running, see
5199the
5200.Ic set-titles
5201option.
5202.Pp
5203A session's name is set with the
5204.Ic new-session
5205and
5206.Ic rename-session
5207commands.
5208A window's name is set with one of:
5209.Bl -enum -width Ds
5210.It
5211A command argument (such as
5212.Fl n
5213for
5214.Ic new-window
5215or
5216.Ic new-session ) .
5217.It
5218An escape sequence (if the
5219.Ic allow-rename
5220option is turned on):
5221.Bd -literal -offset indent
5222$ printf '\e033kWINDOW_NAME\e033\e\e'
5223.Ed
5224.It
5225Automatic renaming, which sets the name to the active command in the window's
5226active pane.
5227See the
5228.Ic automatic-rename
5229option.
5230.El
5231.Pp
5232When a pane is first created, its title is the hostname.
5233A pane's title can be set via the title setting escape sequence, for example:
5234.Bd -literal -offset indent
5235$ printf '\e033]2;My Title\e033\e\e'
5236.Ed
5237.Pp
5238It can also be modified with the
5239.Ic select-pane
5240.Fl T
5241command.
5242.Sh GLOBAL AND SESSION ENVIRONMENT
5243When the server is started,
5244.Nm
5245copies the environment into the
5246.Em global environment ;
5247in addition, each session has a
5248.Em session environment .
5249When a window is created, the session and global environments are merged.
5250If a variable exists in both, the value from the session environment is used.
5251The result is the initial environment passed to the new process.
5252.Pp
5253The
5254.Ic update-environment
5255session option may be used to update the session environment from the client
5256when a new session is created or an old reattached.
5257.Nm
5258also initialises the
5259.Ev TMUX
5260variable with some internal information to allow commands to be executed
5261from inside, and the
5262.Ev TERM
5263variable with the correct terminal setting of
5264.Ql screen .
5265.Pp
5266Variables in both session and global environments may be marked as hidden.
5267Hidden variables are not passed into the environment of new processes and
5268instead can only be used by tmux itself (for example in formats, see the
5269.Sx FORMATS
5270section).
5271.Pp
5272Commands to alter and view the environment are:
5273.Bl -tag -width Ds
5274.It Xo Ic set-environment
5275.Op Fl Fhgru
5276.Op Fl t Ar target-session
5277.Ar name Op Ar value
5278.Xc
5279.D1 (alias: Ic setenv )
5280Set or unset an environment variable.
5281If
5282.Fl g
5283is used, the change is made in the global environment; otherwise, it is applied
5284to the session environment for
5285.Ar target-session .
5286If
5287.Fl F
5288is present, then
5289.Ar value
5290is expanded as a format.
5291The
5292.Fl u
5293flag unsets a variable.
5294.Fl r
5295indicates the variable is to be removed from the environment before starting a
5296new process.
5297.Fl h
5298marks the variable as hidden.
5299.It Xo Ic show-environment
5300.Op Fl hgs
5301.Op Fl t Ar target-session
5302.Op Ar variable
5303.Xc
5304.D1 (alias: Ic showenv )
5305Display the environment for
5306.Ar target-session
5307or the global environment with
5308.Fl g .
5309If
5310.Ar variable
5311is omitted, all variables are shown.
5312Variables removed from the environment are prefixed with
5313.Ql - .
5314If
5315.Fl s
5316is used, the output is formatted as a set of Bourne shell commands.
5317.Fl h
5318shows hidden variables (omitted by default).
5319.El
5320.Sh STATUS LINE
5321.Nm
5322includes an optional status line which is displayed in the bottom line of each
5323terminal.
5324.Pp
5325By default, the status line is enabled and one line in height (it may be
5326disabled or made multiple lines with the
5327.Ic status
5328session option) and contains, from left-to-right: the name of the current
5329session in square brackets; the window list; the title of the active pane
5330in double quotes; and the time and date.
5331.Pp
5332Each line of the status line is configured with the
5333.Ic status-format
5334option.
5335The default is made of three parts: configurable left and right sections (which
5336may contain dynamic content such as the time or output from a shell command,
5337see the
5338.Ic status-left ,
5339.Ic status-left-length ,
5340.Ic status-right ,
5341and
5342.Ic status-right-length
5343options below), and a central window list.
5344By default, the window list shows the index, name and (if any) flag of the
5345windows present in the current session in ascending numerical order.
5346It may be customised with the
5347.Ar window-status-format
5348and
5349.Ar window-status-current-format
5350options.
5351The flag is one of the following symbols appended to the window name:
5352.Bl -column "Symbol" "Meaning" -offset indent
5353.It Sy "Symbol" Ta Sy "Meaning"
5354.It Li "*" Ta "Denotes the current window."
5355.It Li "-" Ta "Marks the last window (previously selected)."
5356.It Li "#" Ta "Window activity is monitored and activity has been detected."
5357.It Li "\&!" Ta "Window bells are monitored and a bell has occurred in the window."
5358.It Li "~" Ta "The window has been silent for the monitor-silence interval."
5359.It Li "M" Ta "The window contains the marked pane."
5360.It Li "Z" Ta "The window's active pane is zoomed."
5361.El
5362.Pp
5363The # symbol relates to the
5364.Ic monitor-activity
5365window option.
5366The window name is printed in inverted colours if an alert (bell, activity or
5367silence) is present.
5368.Pp
5369The colour and attributes of the status line may be configured, the entire
5370status line using the
5371.Ic status-style
5372session option and individual windows using the
5373.Ic window-status-style
5374window option.
5375.Pp
5376The status line is automatically refreshed at interval if it has changed, the
5377interval may be controlled with the
5378.Ic status-interval
5379session option.
5380.Pp
5381Commands related to the status line are as follows:
5382.Bl -tag -width Ds
5383.It Xo Ic command-prompt
5384.Op Fl 1ikNTW
5385.Op Fl I Ar inputs
5386.Op Fl p Ar prompts
5387.Op Fl t Ar target-client
5388.Op Ar template
5389.Xc
5390Open the command prompt in a client.
5391This may be used from inside
5392.Nm
5393to execute commands interactively.
5394.Pp
5395If
5396.Ar template
5397is specified, it is used as the command.
5398If present,
5399.Fl I
5400is a comma-separated list of the initial text for each prompt.
5401If
5402.Fl p
5403is given,
5404.Ar prompts
5405is a comma-separated list of prompts which are displayed in order; otherwise
5406a single prompt is displayed, constructed from
5407.Ar template
5408if it is present, or
5409.Ql \&:
5410if not.
5411.Pp
5412Before the command is executed, the first occurrence of the string
5413.Ql %%
5414and all occurrences of
5415.Ql %1
5416are replaced by the response to the first prompt, all
5417.Ql %2
5418are replaced with the response to the second prompt, and so on for further
5419prompts.
5420Up to nine prompt responses may be replaced
5421.Po
5422.Ql %1
5423to
5424.Ql %9
5425.Pc .
5426.Ql %%%
5427is like
5428.Ql %%
5429but any quotation marks are escaped.
5430.Pp
5431.Fl 1
5432makes the prompt only accept one key press, in this case the resulting input
5433is a single character.
5434.Fl k
5435is like
5436.Fl 1
5437but the key press is translated to a key name.
5438.Fl N
5439makes the prompt only accept numeric key presses.
5440.Fl i
5441executes the command every time the prompt input changes instead of when the
5442user exits the command prompt.
5443.Fl T
5444tells
5445.Nm
5446that the prompt is for a target which affects what completions are offered when
5447.Em Tab
5448is pressed;
5449.Fl W
5450is similar but indicates the prompt is for a window.
5451.Pp
5452The following keys have a special meaning in the command prompt, depending
5453on the value of the
5454.Ic status-keys
5455option:
5456.Bl -column "FunctionXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXX" "emacsX" -offset indent
5457.It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
5458.It Li "Cancel command prompt" Ta "q" Ta "Escape"
5459.It Li "Delete from cursor to start of word" Ta "" Ta "C-w"
5460.It Li "Delete entire command" Ta "d" Ta "C-u"
5461.It Li "Delete from cursor to end" Ta "D" Ta "C-k"
5462.It Li "Execute command" Ta "Enter" Ta "Enter"
5463.It Li "Get next command from history" Ta "" Ta "Down"
5464.It Li "Get previous command from history" Ta "" Ta "Up"
5465.It Li "Insert top paste buffer" Ta "p" Ta "C-y"
5466.It Li "Look for completions" Ta "Tab" Ta "Tab"
5467.It Li "Move cursor left" Ta "h" Ta "Left"
5468.It Li "Move cursor right" Ta "l" Ta "Right"
5469.It Li "Move cursor to end" Ta "$" Ta "C-e"
5470.It Li "Move cursor to next word" Ta "w" Ta "M-f"
5471.It Li "Move cursor to previous word" Ta "b" Ta "M-b"
5472.It Li "Move cursor to start" Ta "0" Ta "C-a"
5473.It Li "Transpose characters" Ta "" Ta "C-t"
5474.El
5475.It Xo Ic confirm-before
5476.Op Fl p Ar prompt
5477.Op Fl t Ar target-client
5478.Ar command
5479.Xc
5480.D1 (alias: Ic confirm )
5481Ask for confirmation before executing
5482.Ar command .
5483If
5484.Fl p
5485is given,
5486.Ar prompt
5487is the prompt to display; otherwise a prompt is constructed from
5488.Ar command .
5489It may contain the special character sequences supported by the
5490.Ic status-left
5491option.
5492.Pp
5493This command works only from inside
5494.Nm .
5495.It Xo Ic display-menu
5496.Op Fl O
5497.Op Fl c Ar target-client
5498.Op Fl t Ar target-pane
5499.Op Fl T Ar title
5500.Op Fl x Ar position
5501.Op Fl y Ar position
5502.Ar name
5503.Ar key
5504.Ar command
5505.Ar ...
5506.Xc
5507.D1 (alias: Ic menu )
5508Display a menu on
5509.Ar target-client .
5510.Ar target-pane
5511gives the target for any commands run from the menu.
5512.Pp
5513A menu is passed as a series of arguments: first the menu item name,
5514second the key shortcut (or empty for none) and third the command
5515to run when the menu item is chosen.
5516The name and command are formats, see the
5517.Sx FORMATS
5518and
5519.Sx STYLES
5520sections.
5521If the name begins with a hyphen (-), then the item is disabled (shown dim) and
5522may not be chosen.
5523The name may be empty for a separator line, in which case both the key and
5524command should be omitted.
5525.Pp
5526.Fl T
5527is a format for the menu title (see
5528.Sx FORMATS ) .
5529.Pp
5530.Fl x
5531and
5532.Fl y
5533give the position of the menu.
5534Both may be a row or column number, or one of the following special values:
5535.Bl -column "XXXXX" "XXXX" -offset indent
5536.It Sy "Value" Ta Sy "Flag" Ta Sy "Meaning"
5537.It Li "C" Ta "Both" Ta "The centre of the terminal"
5538.It Li "R" Ta Fl x Ta "The right side of the terminal"
5539.It Li "P" Ta "Both" Ta "The bottom left of the pane"
5540.It Li "M" Ta "Both" Ta "The mouse position"
5541.It Li "W" Ta "Both" Ta "The window position on the status line"
5542.It Li "S" Ta Fl y Ta "The line above or below the status line"
5543.El
5544.Pp
5545Or a format, which is expanded including the following additional variables:
5546.Bl -column "XXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent
5547.It Sy "Variable name" Ta Sy "Replaced with"
5548.It Li "popup_centre_x" Ta "Centered in the client"
5549.It Li "popup_centre_y" Ta "Centered in the client"
5550.It Li "popup_height" Ta "Height of menu or popup"
5551.It Li "popup_mouse_bottom" Ta "Bottom of at the mouse"
5552.It Li "popup_mouse_centre_x" Ta "Horizontal centre at the mouse"
5553.It Li "popup_mouse_centre_y" Ta "Vertical centre at the mouse"
5554.It Li "popup_mouse_top" Ta "Top at the mouse"
5555.It Li "popup_mouse_x" Ta "Mouse X position"
5556.It Li "popup_mouse_y" Ta "Mouse Y position"
5557.It Li "popup_pane_bottom" Ta "Bottom of the pane"
5558.It Li "popup_pane_left" Ta "Left of the pane"
5559.It Li "popup_pane_right" Ta "Right of the pane"
5560.It Li "popup_pane_top" Ta "Top of the pane"
5561.It Li "popup_status_line_y" Ta "Above or below the status line"
5562.It Li "popup_width" Ta "Width of menu or popup"
5563.It Li "popup_window_status_line_x" Ta "At the window position in status line"
5564.It Li "popup_window_status_line_y" Ta "At the status line showing the window"
5565.El
5566.Pp
5567Each menu consists of items followed by a key shortcut shown in brackets.
5568If the menu is too large to fit on the terminal, it is not displayed.
5569Pressing the key shortcut chooses the corresponding item.
5570If the mouse is enabled and the menu is opened from a mouse key binding,
5571releasing the mouse button with an item selected chooses that item and
5572releasing the mouse button without an item selected closes the menu.
5573.Fl O
5574changes this behaviour so that the menu does not close when the mouse button is
5575released without an item selected the menu is not closed and a mouse button
5576must be clicked to choose an item.
5577.Pp
5578The following keys are also available:
5579.Bl -column "Key" "Function" -offset indent
5580.It Sy "Key" Ta Sy "Function"
5581.It Li "Enter" Ta "Choose selected item"
5582.It Li "Up" Ta "Select previous item"
5583.It Li "Down" Ta "Select next item"
5584.It Li "q" Ta "Exit menu"
5585.El
5586.It Xo Ic display-message
5587.Op Fl aINpv
5588.Op Fl c Ar target-client
5589.Op Fl d Ar delay
5590.Op Fl t Ar target-pane
5591.Op Ar message
5592.Xc
5593.D1 (alias: Ic display )
5594Display a message.
5595If
5596.Fl p
5597is given, the output is printed to stdout, otherwise it is displayed in the
5598.Ar target-client
5599status line for up to
5600.Ar delay
5601milliseconds.
5602If
5603.Ar delay
5604is not given, the
5605.Ic message-time
5606option is used; a delay of zero waits for a key press.
5607.Ql N
5608ignores key presses and closes only after the delay expires.
5609The format of
5610.Ar message
5611is described in the
5612.Sx FORMATS
5613section; information is taken from
5614.Ar target-pane
5615if
5616.Fl t
5617is given, otherwise the active pane.
5618.Pp
5619.Fl v
5620prints verbose logging as the format is parsed and
5621.Fl a
5622lists the format variables and their values.
5623.Pp
5624.Fl I
5625forwards any input read from stdin to the empty pane given by
5626.Ar target-pane .
5627.It Xo Ic display-popup
5628.Op Fl CE
5629.Op Fl c Ar target-client
5630.Op Fl d Ar start-directory
5631.Op Fl h Ar height
5632.Op Fl t Ar target-pane
5633.Op Fl w Ar width
5634.Op Fl x Ar position
5635.Op Fl y Ar position
5636.Op Ar shell-command
5637.Xc
5638.D1 (alias: Ic popup )
5639Display a popup running
5640.Ar shell-command
5641on
5642.Ar target-client .
5643A popup is a rectangular box drawn over the top of any panes.
5644Panes are not updated while a popup is present.
5645.Pp
5646.Fl E
5647closes the popup automatically when
5648.Ar shell-command
5649exits.
5650Two
5651.Fl E
5652closes the popup only if
5653.Ar shell-command
5654exited with success.
5655.Pp
5656.Fl x
5657and
5658.Fl y
5659give the position of the popup, they have the same meaning as for the
5660.Ic display-menu
5661command.
5662.Fl w
5663and
5664.Fl h
5665give the width and height - both may be a percentage (followed by
5666.Ql % ) .
5667If omitted, half of the terminal size is used.
5668.Pp
5669The
5670.Fl C
5671flag closes any popup on the client.
5672.El
5673.Sh BUFFERS
5674.Nm
5675maintains a set of named
5676.Em paste buffers .
5677Each buffer may be either explicitly or automatically named.
5678Explicitly named buffers are named when created with the
5679.Ic set-buffer
5680or
5681.Ic load-buffer
5682commands, or by renaming an automatically named buffer with
5683.Ic set-buffer
5684.Fl n .
5685Automatically named buffers are given a name such as
5686.Ql buffer0001 ,
5687.Ql buffer0002
5688and so on.
5689When the
5690.Ic buffer-limit
5691option is reached, the oldest automatically named buffer is deleted.
5692Explicitly named buffers are not subject to
5693.Ic buffer-limit
5694and may be deleted with the
5695.Ic delete-buffer
5696command.
5697.Pp
5698Buffers may be added using
5699.Ic copy-mode
5700or the
5701.Ic set-buffer
5702and
5703.Ic load-buffer
5704commands, and pasted into a window using the
5705.Ic paste-buffer
5706command.
5707If a buffer command is used and no buffer is specified, the most
5708recently added automatically named buffer is assumed.
5709.Pp
5710A configurable history buffer is also maintained for each window.
5711By default, up to 2000 lines are kept; this can be altered with the
5712.Ic history-limit
5713option (see the
5714.Ic set-option
5715command above).
5716.Pp
5717The buffer commands are as follows:
5718.Bl -tag -width Ds
5719.It Xo
5720.Ic choose-buffer
5721.Op Fl NZr
5722.Op Fl F Ar format
5723.Op Fl f Ar filter
5724.Op Fl K Ar key-format
5725.Op Fl O Ar sort-order
5726.Op Fl t Ar target-pane
5727.Op Ar template
5728.Xc
5729Put a pane into buffer mode, where a buffer may be chosen interactively from
5730a list.
5731Each buffer is shown on one line.
5732A shortcut key is shown on the left in brackets allowing for immediate choice,
5733or the list may be navigated and an item chosen or otherwise manipulated using
5734the keys below.
5735.Fl Z
5736zooms the pane.
5737The following keys may be used in buffer mode:
5738.Bl -column "Key" "Function" -offset indent
5739.It Sy "Key" Ta Sy "Function"
5740.It Li "Enter" Ta "Paste selected buffer"
5741.It Li "Up" Ta "Select previous buffer"
5742.It Li "Down" Ta "Select next buffer"
5743.It Li "C-s" Ta "Search by name or content"
5744.It Li "n" Ta "Repeat last search"
5745.It Li "t" Ta "Toggle if buffer is tagged"
5746.It Li "T" Ta "Tag no buffers"
5747.It Li "C-t" Ta "Tag all buffers"
5748.It Li "p" Ta "Paste selected buffer"
5749.It Li "P" Ta "Paste tagged buffers"
5750.It Li "d" Ta "Delete selected buffer"
5751.It Li "D" Ta "Delete tagged buffers"
5752.It Li "e" Ta "Open the buffer in an editor"
5753.It Li "f" Ta "Enter a format to filter items"
5754.It Li "O" Ta "Change sort field"
5755.It Li "r" Ta "Reverse sort order"
5756.It Li "v" Ta "Toggle preview"
5757.It Li "q" Ta "Exit mode"
5758.El
5759.Pp
5760After a buffer is chosen,
5761.Ql %%
5762is replaced by the buffer name in
5763.Ar template
5764and the result executed as a command.
5765If
5766.Ar template
5767is not given, "paste-buffer -b '%%'" is used.
5768.Pp
5769.Fl O
5770specifies the initial sort field: one of
5771.Ql time ,
5772.Ql name
5773or
5774.Ql size .
5775.Fl r
5776reverses the sort order.
5777.Fl f
5778specifies an initial filter: the filter is a format - if it evaluates to zero,
5779the item in the list is not shown, otherwise it is shown.
5780If a filter would lead to an empty list, it is ignored.
5781.Fl F
5782specifies the format for each item in the list and
5783.Fl K
5784a format for each shortcut key; both are evaluated once for each line.
5785.Fl N
5786starts without the preview.
5787This command works only if at least one client is attached.
5788.It Ic clear-history Op Fl t Ar target-pane
5789.D1 (alias: Ic clearhist )
5790Remove and free the history for the specified pane.
5791.It Ic delete-buffer Op Fl b Ar buffer-name
5792.D1 (alias: Ic deleteb )
5793Delete the buffer named
5794.Ar buffer-name ,
5795or the most recently added automatically named buffer if not specified.
5796.It Xo Ic list-buffers
5797.Op Fl F Ar format
5798.Op Fl f Ar filter
5799.Xc
5800.D1 (alias: Ic lsb )
5801List the global buffers.
5802.Fl F
5803specifies the format of each line and
5804.Fl f
5805a filter.
5806Only buffers for which the filter is true are shown.
5807See the
5808.Sx FORMATS
5809section.
5810.It Xo Ic load-buffer
5811.Op Fl w
5812.Op Fl b Ar buffer-name
5813.Op Fl t Ar target-client
5814.Ar path
5815.Xc
5816.D1 (alias: Ic loadb )
5817Load the contents of the specified paste buffer from
5818.Ar path .
5819If
5820.Fl w
5821is given, the buffer is also sent to the clipboard for
5822.Ar target-client
5823using the
5824.Xr xterm 1
5825escape sequence, if possible.
5826.It Xo Ic paste-buffer
5827.Op Fl dpr
5828.Op Fl b Ar buffer-name
5829.Op Fl s Ar separator
5830.Op Fl t Ar target-pane
5831.Xc
5832.D1 (alias: Ic pasteb )
5833Insert the contents of a paste buffer into the specified pane.
5834If not specified, paste into the current one.
5835With
5836.Fl d ,
5837also delete the paste buffer.
5838When output, any linefeed (LF) characters in the paste buffer are replaced with
5839a separator, by default carriage return (CR).
5840A custom separator may be specified using the
5841.Fl s
5842flag.
5843The
5844.Fl r
5845flag means to do no replacement (equivalent to a separator of LF).
5846If
5847.Fl p
5848is specified, paste bracket control codes are inserted around the
5849buffer if the application has requested bracketed paste mode.
5850.It Xo Ic save-buffer
5851.Op Fl a
5852.Op Fl b Ar buffer-name
5853.Ar path
5854.Xc
5855.D1 (alias: Ic saveb )
5856Save the contents of the specified paste buffer to
5857.Ar path .
5858The
5859.Fl a
5860option appends to rather than overwriting the file.
5861.It Xo Ic set-buffer
5862.Op Fl aw
5863.Op Fl b Ar buffer-name
5864.Op Fl t Ar target-client
5865.Op Fl n Ar new-buffer-name
5866.Ar data
5867.Xc
5868.D1 (alias: Ic setb )
5869Set the contents of the specified buffer to
5870.Ar data .
5871If
5872.Fl w
5873is given, the buffer is also sent to the clipboard for
5874.Ar target-client
5875using the
5876.Xr xterm 1
5877escape sequence, if possible.
5878The
5879.Fl a
5880option appends to rather than overwriting the buffer.
5881The
5882.Fl n
5883option renames the buffer to
5884.Ar new-buffer-name .
5885.It Xo Ic show-buffer
5886.Op Fl b Ar buffer-name
5887.Xc
5888.D1 (alias: Ic showb )
5889Display the contents of the specified buffer.
5890.El
5891.Sh MISCELLANEOUS
5892Miscellaneous commands are as follows:
5893.Bl -tag -width Ds
5894.It Ic clock-mode Op Fl t Ar target-pane
5895Display a large clock.
5896.It Xo Ic if-shell
5897.Op Fl bF
5898.Op Fl t Ar target-pane
5899.Ar shell-command command
5900.Op Ar command
5901.Xc
5902.D1 (alias: Ic if )
5903Execute the first
5904.Ar command
5905if
5906.Ar shell-command
5907returns success or the second
5908.Ar command
5909otherwise.
5910Before being executed,
5911.Ar shell-command
5912is expanded using the rules specified in the
5913.Sx FORMATS
5914section, including those relevant to
5915.Ar target-pane .
5916With
5917.Fl b ,
5918.Ar shell-command
5919is run in the background.
5920.Pp
5921If
5922.Fl F
5923is given,
5924.Ar shell-command
5925is not executed but considered success if neither empty nor zero (after formats
5926are expanded).
5927.It Ic lock-server
5928.D1 (alias: Ic lock )
5929Lock each client individually by running the command specified by the
5930.Ic lock-command
5931option.
5932.It Xo Ic run-shell
5933.Op Fl bC
5934.Op Fl d Ar delay
5935.Op Fl t Ar target-pane
5936.Op Ar shell-command
5937.Xc
5938.D1 (alias: Ic run )
5939Execute
5940.Ar shell-command
5941or (with
5942.Fl C )
5943a
5944.Nm
5945command in the background without creating a window.
5946Before being executed,
5947.Ar shell-command
5948is expanded using the rules specified in the
5949.Sx FORMATS
5950section.
5951With
5952.Fl b ,
5953the command is run in the background.
5954.Fl d
5955waits for
5956.Ar delay
5957seconds before starting the command.
5958If
5959.Fl C
5960is not given, any output to stdout is displayed in view mode (in the pane
5961specified by
5962.Fl t
5963or the current pane if omitted) after the command finishes.
5964If the command fails, the exit status is also displayed.
5965.It Xo Ic wait-for
5966.Op Fl L | S | U
5967.Ar channel
5968.Xc
5969.D1 (alias: Ic wait )
5970When used without options, prevents the client from exiting until woken using
5971.Ic wait-for
5972.Fl S
5973with the same channel.
5974When
5975.Fl L
5976is used, the channel is locked and any clients that try to lock the same
5977channel are made to wait until the channel is unlocked with
5978.Ic wait-for
5979.Fl U .
5980.El
5981.Sh EXIT MESSAGES
5982When a
5983.Nm
5984client detaches, it prints a message.
5985This may be one of:
5986.Bl -tag -width Ds
5987.It detached (from session ...)
5988The client was detached normally.
5989.It detached and SIGHUP
5990The client was detached and its parent sent the
5991.Dv SIGHUP
5992signal (for example with
5993.Ic detach-client
5994.Fl P ) .
5995.It lost tty
5996The client's
5997.Xr tty 4
5998or
5999.Xr pty 4
6000was unexpectedly destroyed.
6001.It terminated
6002The client was killed with
6003.Dv SIGTERM .
6004.It too far behind
6005The client is in control mode and became unable to keep up with the data from
6006.Nm .
6007.It exited
6008The server exited when it had no sessions.
6009.It server exited
6010The server exited when it received
6011.Dv SIGTERM .
6012.It server exited unexpectedly
6013The server crashed or otherwise exited without telling the client the reason.
6014.El
6015.Sh TERMINFO EXTENSIONS
6016.Nm
6017understands some unofficial extensions to
6018.Xr terminfo 5 .
6019It is not normally necessary to set these manually, instead the
6020.Ic terminal-features
6021option should be used.
6022.Bl -tag -width Ds
6023.It Em \&AX
6024An existing extension that tells
6025.Nm
6026the terminal supports default colours.
6027.It Em \&Bidi
6028Tell
6029.Nm
6030that the terminal supports the VTE bidirectional text extensions.
6031.It Em \&Cs , Cr
6032Set the cursor colour.
6033The first takes a single string argument and is used to set the colour;
6034the second takes no arguments and restores the default cursor colour.
6035If set, a sequence such as this may be used
6036to change the cursor colour from inside
6037.Nm :
6038.Bd -literal -offset indent
6039$ printf '\e033]12;red\e033\e\e'
6040.Ed
6041.It Em \&Cmg, \&Clmg, \&Dsmg , \&Enmg
6042Set, clear, disable or enable DECSLRM margins.
6043These are set automatically if the terminal reports it is
6044.Em VT420
6045compatible.
6046.It Em \&Dsbp , \&Enbp
6047Disable and enable bracketed paste.
6048These are set automatically if the
6049.Em XT
6050capability is present.
6051.It Em \&Dseks , \&Eneks
6052Disable and enable extended keys.
6053.It Em \&Dsfcs , \&Enfcs
6054Disable and enable focus reporting.
6055These are set automatically if the
6056.Em XT
6057capability is present.
6058.It Em \&Rect
6059Tell
6060.Nm
6061that the terminal supports rectangle operations.
6062.It Em \&Smol
6063Enable the overline attribute.
6064.It Em \&Smulx
6065Set a styled underscore.
6066The single parameter is one of: 0 for no underscore, 1 for normal
6067underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted
6068underscore and 5 for dashed underscore.
6069.It Em \&Setulc , \&ol
6070Set the underscore colour or reset to the default.
6071The argument is (red * 65536) + (green * 256) + blue where each is between 0
6072and 255.
6073.It Em \&Ss , Se
6074Set or reset the cursor style.
6075If set, a sequence such as this may be used
6076to change the cursor to an underline:
6077.Bd -literal -offset indent
6078$ printf '\e033[4 q'
6079.Ed
6080.Pp
6081If
6082.Em Se
6083is not set, \&Ss with argument 0 will be used to reset the cursor style instead.
6084.It Em \&Sync
6085Start (parameter is 1) or end (parameter is 2) a synchronized update.
6086.It Em \&Tc
6087Indicate that the terminal supports the
6088.Ql direct colour
6089RGB escape sequence (for example, \ee[38;2;255;255;255m).
6090.Pp
6091If supported, this is used for the initialize colour escape sequence (which
6092may be enabled by adding the
6093.Ql initc
6094and
6095.Ql ccc
6096capabilities to the
6097.Nm
6098.Xr terminfo 5
6099entry).
6100.Pp
6101This is equivalent to the
6102.Em RGB
6103.Xr terminfo 5
6104capability.
6105.It Em \&Ms
6106Store the current buffer in the host terminal's selection (clipboard).
6107See the
6108.Em set-clipboard
6109option above and the
6110.Xr xterm 1
6111man page.
6112.It Em \&XT
6113This is an existing extension capability that tmux uses to mean that the
6114terminal supports the
6115.Xr xterm 1
6116title set sequences and to automatically set some of the capabilities above.
6117.El
6118.Sh CONTROL MODE
6119.Nm
6120offers a textual interface called
6121.Em control mode .
6122This allows applications to communicate with
6123.Nm
6124using a simple text-only protocol.
6125.Pp
6126In control mode, a client sends
6127.Nm
6128commands or command sequences terminated by newlines on standard input.
6129Each command will produce one block of output on standard output.
6130An output block consists of a
6131.Em %begin
6132line followed by the output (which may be empty).
6133The output block ends with a
6134.Em %end
6135or
6136.Em %error .
6137.Em %begin
6138and matching
6139.Em %end
6140or
6141.Em %error
6142have three arguments: an integer time (as seconds from epoch), command number and
6143flags (currently not used).
6144For example:
6145.Bd -literal -offset indent
6146%begin 1363006971 2 1
61470: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
6148%end 1363006971 2 1
6149.Ed
6150.Pp
6151The
6152.Ic refresh-client
6153.Fl C
6154command may be used to set the size of a client in control mode.
6155.Pp
6156In control mode,
6157.Nm
6158outputs notifications.
6159A notification will never occur inside an output block.
6160.Pp
6161The following notifications are defined:
6162.Bl -tag -width Ds
6163.It Ic %client-detached Ar client
6164The client has detached.
6165.It Ic %client-session-changed Ar client session-id name
6166The client is now attached to the session with ID
6167.Ar session-id ,
6168which is named
6169.Ar name .
6170.It Ic %continue Ar pane-id
6171The pane has been continued after being paused (if the
6172.Ar pause-after
6173flag is set, see
6174.Ic refresh-client
6175.Fl A ) .
6176.It Ic %exit Op Ar reason
6177The
6178.Nm
6179client is exiting immediately, either because it is not attached to any session
6180or an error occurred.
6181If present,
6182.Ar reason
6183describes why the client exited.
6184.It Ic %extended-output Ar pane-id Ar age Ar ... \&  : Ar value
6185New form of
6186.Ic %output
6187sent when the
6188.Ar pause-after
6189flag is set.
6190.Ar age
6191is the time in milliseconds for which tmux had buffered the output before it was sent.
6192Any subsequent arguments up until a single
6193.Ql \&:
6194are for future use and should be ignored.
6195.It Ic %layout-change Ar window-id Ar window-layout Ar window-visible-layout Ar window-flags
6196The layout of a window with ID
6197.Ar window-id
6198changed.
6199The new layout is
6200.Ar window-layout .
6201The window's visible layout is
6202.Ar window-visible-layout
6203and the window flags are
6204.Ar window-flags .
6205.It Ic %output Ar pane-id Ar value
6206A window pane produced output.
6207.Ar value
6208escapes non-printable characters and backslash as octal \\xxx.
6209.It Ic %pane-mode-changed Ar pane-id
6210The pane with ID
6211.Ar pane-id
6212has changed mode.
6213.It Ic %pause Ar pane-id
6214The pane has been paused (if the
6215.Ar pause-after
6216flag is set).
6217.It Ic %session-changed Ar session-id Ar name
6218The client is now attached to the session with ID
6219.Ar session-id ,
6220which is named
6221.Ar name .
6222.It Ic %session-renamed Ar name
6223The current session was renamed to
6224.Ar name .
6225.It Ic %session-window-changed Ar session-id Ar window-id
6226The session with ID
6227.Ar session-id
6228changed its active window to the window with ID
6229.Ar window-id .
6230.It Ic %sessions-changed
6231A session was created or destroyed.
6232.It Xo Ic %subscription-changed
6233.Ar name
6234.Ar session-id
6235.Ar window-id
6236.Ar window-index
6237.Ar pane-id ... \&  :
6238.Ar value
6239.Xc
6240The value of the format associated with subscription
6241.Ar name
6242has changed to
6243.Ar value .
6244See
6245.Ic refresh-client
6246.Fl B .
6247Any arguments after
6248.Ar pane-id
6249up until a single
6250.Ql \&:
6251are for future use and should be ignored.
6252.It Ic %unlinked-window-add Ar window-id
6253The window with ID
6254.Ar window-id
6255was created but is not linked to the current session.
6256.It Ic %window-add Ar window-id
6257The window with ID
6258.Ar window-id
6259was linked to the current session.
6260.It Ic %window-close Ar window-id
6261The window with ID
6262.Ar window-id
6263closed.
6264.It Ic %window-pane-changed Ar window-id Ar pane-id
6265The active pane in the window with ID
6266.Ar window-id
6267changed to the pane with ID
6268.Ar pane-id .
6269.It Ic %window-renamed Ar window-id Ar name
6270The window with ID
6271.Ar window-id
6272was renamed to
6273.Ar name .
6274.El
6275.Sh ENVIRONMENT
6276When
6277.Nm
6278is started, it inspects the following environment variables:
6279.Bl -tag -width LC_CTYPE
6280.It Ev EDITOR
6281If the command specified in this variable contains the string
6282.Ql vi
6283and
6284.Ev VISUAL
6285is unset, use vi-style key bindings.
6286Overridden by the
6287.Ic mode-keys
6288and
6289.Ic status-keys
6290options.
6291.It Ev HOME
6292The user's login directory.
6293If unset, the
6294.Xr passwd 5
6295database is consulted.
6296.It Ev LC_CTYPE
6297The character encoding
6298.Xr locale 1 .
6299It is used for two separate purposes.
6300For output to the terminal, UTF-8 is used if the
6301.Fl u
6302option is given or if
6303.Ev LC_CTYPE
6304contains
6305.Qq UTF-8
6306or
6307.Qq UTF8 .
6308Otherwise, only ASCII characters are written and non-ASCII characters
6309are replaced with underscores
6310.Pq Ql _ .
6311For input,
6312.Nm
6313always runs with a UTF-8 locale.
6314If en_US.UTF-8 is provided by the operating system it is used and
6315.Ev LC_CTYPE
6316is ignored for input.
6317Otherwise,
6318.Ev LC_CTYPE
6319tells
6320.Nm
6321what the UTF-8 locale is called on the current system.
6322If the locale specified by
6323.Ev LC_CTYPE
6324is not available or is not a UTF-8 locale,
6325.Nm
6326exits with an error message.
6327.It Ev LC_TIME
6328The date and time format
6329.Xr locale 1 .
6330It is used for locale-dependent
6331.Xr strftime 3
6332format specifiers.
6333.It Ev PWD
6334The current working directory to be set in the global environment.
6335This may be useful if it contains symbolic links.
6336If the value of the variable does not match the current working
6337directory, the variable is ignored and the result of
6338.Xr getcwd 3
6339is used instead.
6340.It Ev SHELL
6341The absolute path to the default shell for new windows.
6342See the
6343.Ic default-shell
6344option for details.
6345.It Ev TMUX_TMPDIR
6346The parent directory of the directory containing the server sockets.
6347See the
6348.Fl L
6349option for details.
6350.It Ev VISUAL
6351If the command specified in this variable contains the string
6352.Ql vi ,
6353use vi-style key bindings.
6354Overridden by the
6355.Ic mode-keys
6356and
6357.Ic status-keys
6358options.
6359.El
6360.Sh FILES
6361.Bl -tag -width "@SYSCONFDIR@/tmux.confXXX" -compact
6362.It Pa ~/.tmux.conf
6363Default
6364.Nm
6365configuration file.
6366.It Pa @SYSCONFDIR@/tmux.conf
6367System-wide configuration file.
6368.El
6369.Sh EXAMPLES
6370To create a new
6371.Nm
6372session running
6373.Xr vi 1 :
6374.Pp
6375.Dl $ tmux new-session vi
6376.Pp
6377Most commands have a shorter form, known as an alias.
6378For new-session, this is
6379.Ic new :
6380.Pp
6381.Dl $ tmux new vi
6382.Pp
6383Alternatively, the shortest unambiguous form of a command is accepted.
6384If there are several options, they are listed:
6385.Bd -literal -offset indent
6386$ tmux n
6387ambiguous command: n, could be: new-session, new-window, next-window
6388.Ed
6389.Pp
6390Within an active session, a new window may be created by typing
6391.Ql C-b c
6392(Ctrl
6393followed by the
6394.Ql b
6395key
6396followed by the
6397.Ql c
6398key).
6399.Pp
6400Windows may be navigated with:
6401.Ql C-b 0
6402(to select window 0),
6403.Ql C-b 1
6404(to select window 1), and so on;
6405.Ql C-b n
6406to select the next window; and
6407.Ql C-b p
6408to select the previous window.
6409.Pp
6410A session may be detached using
6411.Ql C-b d
6412(or by an external event such as
6413.Xr ssh 1
6414disconnection) and reattached with:
6415.Pp
6416.Dl $ tmux attach-session
6417.Pp
6418Typing
6419.Ql C-b \&?
6420lists the current key bindings in the current window; up and down may be used
6421to navigate the list or
6422.Ql q
6423to exit from it.
6424.Pp
6425Commands to be run when the
6426.Nm
6427server is started may be placed in the
6428.Pa ~/.tmux.conf
6429configuration file.
6430Common examples include:
6431.Pp
6432Changing the default prefix key:
6433.Bd -literal -offset indent
6434set-option -g prefix C-a
6435unbind-key C-b
6436bind-key C-a send-prefix
6437.Ed
6438.Pp
6439Turning the status line off, or changing its colour:
6440.Bd -literal -offset indent
6441set-option -g status off
6442set-option -g status-style bg=blue
6443.Ed
6444.Pp
6445Setting other options, such as the default command,
6446or locking after 30 minutes of inactivity:
6447.Bd -literal -offset indent
6448set-option -g default-command "exec /bin/ksh"
6449set-option -g lock-after-time 1800
6450.Ed
6451.Pp
6452Creating new key bindings:
6453.Bd -literal -offset indent
6454bind-key b set-option status
6455bind-key / command-prompt "split-window 'exec man %%'"
6456bind-key S command-prompt "new-window -n %1 'ssh %1'"
6457.Ed
6458.Sh SEE ALSO
6459.Xr pty 4
6460.Sh AUTHORS
6461.An Nicholas Marriott Aq Mt nicholas.marriott@gmail.com
6462