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