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