xref: /minix3/external/bsd/tmux/dist/tmux.1 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1.\" Id
2.\"
3.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
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: March 25 2013 $
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 2lCquvV
27.Op Fl c Ar shell-command
28.Op Fl f Ar file
29.Op Fl L Ar socket-name
30.Op Fl S Ar socket-path
31.Op Ar command Op Ar flags
32.Ek
33.Sh DESCRIPTION
34.Nm
35is a terminal multiplexer:
36it enables a number of terminals to be created, accessed, and
37controlled from a single screen.
38.Nm
39may be detached from a screen
40and continue running in the background,
41then later reattached.
42.Pp
43When
44.Nm
45is started it creates a new
46.Em session
47with a single
48.Em window
49and displays it on screen.
50A status line at the bottom of the screen
51shows information on the current session
52and is used to enter interactive commands.
53.Pp
54A session is a single collection of
55.Em pseudo terminals
56under the management of
57.Nm .
58Each session has one or more
59windows linked to it.
60A window occupies the entire screen
61and may be split into rectangular panes,
62each of which is a separate pseudo terminal
63(the
64.Xr pty 7
65manual page documents the technical details of pseudo terminals).
66Any number of
67.Nm
68instances may connect to the same session,
69and any number of windows may be present in the same session.
70Once all sessions are killed,
71.Nm
72exits.
73.Pp
74Each session is persistent and will survive accidental disconnection
75(such as
76.Xr ssh 1
77connection timeout) or intentional detaching (with the
78.Ql C-b d
79key strokes).
80.Nm
81may be reattached using:
82.Pp
83.Dl $ tmux attach
84.Pp
85In
86.Nm ,
87a session is displayed on screen by a
88.Em client
89and all sessions are managed by a single
90.Em server .
91The server and each client are separate processes which communicate through a
92socket in
93.Pa /tmp .
94.Pp
95The options are as follows:
96.Bl -tag -width "XXXXXXXXXXXX"
97.It Fl 2
98Force
99.Nm
100to assume the terminal supports 256 colours.
101.It Fl C
102Start in control mode (see the
103.Sx CONTROL MODE
104section).
105Given twice
106.Xo ( Fl CC ) Xc
107disables echo.
108.It Fl c Ar shell-command
109Execute
110.Ar shell-command
111using the default shell.
112If necessary, the
113.Nm
114server will be started to retrieve the
115.Ic default-shell
116option.
117This option is for compatibility with
118.Xr sh 1
119when
120.Nm
121is used as a login shell.
122.It Fl f Ar file
123Specify an alternative configuration file.
124By default,
125.Nm
126loads the system configuration file from
127.Pa @SYSCONFDIR@/tmux.conf ,
128if present, then looks for a user configuration file at
129.Pa ~/.tmux.conf .
130.Pp
131The configuration file is a set of
132.Nm
133commands which are executed in sequence when the server is first started.
134.Nm
135loads configuration files once when the server process has started.
136The
137.Ic source-file
138command may be used to load a file later.
139.Pp
140.Nm
141shows any error messages from commands in configuration files in the first
142session created, and continues to process the rest of the configuration file.
143.It Fl L Ar socket-name
144.Nm
145stores the server socket in a directory under
146.Ev TMUX_TMPDIR ,
147.Ev TMPDIR
148if it is unset, or
149.Pa /tmp
150if both are unset.
151The default socket is named
152.Em default .
153This option allows a different socket name to be specified, allowing several
154independent
155.Nm
156servers to be run.
157Unlike
158.Fl S
159a full path is not necessary: the sockets are all created in the same
160directory.
161.Pp
162If the socket is accidentally removed, the
163.Dv SIGUSR1
164signal may be sent to the
165.Nm
166server process to recreate it.
167.It Fl l
168Behave as a login shell.
169This flag currently has no effect and is for compatibility with other shells
170when using tmux as a login shell.
171.It Fl q
172Set the
173.Ic quiet
174server option to prevent the server sending various informational messages.
175.It Fl S Ar socket-path
176Specify a full alternative path to the server socket.
177If
178.Fl S
179is specified, the default socket directory is not used and any
180.Fl L
181flag is ignored.
182.It Fl u
183.Nm
184attempts to guess if the terminal is likely to support UTF-8 by checking the
185first of the
186.Ev LC_ALL ,
187.Ev LC_CTYPE
188and
189.Ev LANG
190environment variables to be set for the string "UTF-8".
191This is not always correct: the
192.Fl u
193flag explicitly informs
194.Nm
195that UTF-8 is supported.
196.Pp
197If the server is started from a client passed
198.Fl u
199or where UTF-8 is detected, the
200.Ic utf8
201and
202.Ic status-utf8
203options are enabled in the global window and session options respectively.
204.It Fl v
205Request verbose logging.
206This option may be specified multiple times for increasing verbosity.
207Log messages will be saved into
208.Pa tmux-client-PID.log
209and
210.Pa tmux-server-PID.log
211files in the current directory, where
212.Em PID
213is the PID of the server or client process.
214.It Fl V
215Report the
216.Nm
217version.
218.It Ar command Op Ar flags
219This specifies one of a set of commands used to control
220.Nm ,
221as described in the following sections.
222If no commands are specified, the
223.Ic new-session
224command is assumed.
225.El
226.Sh KEY BINDINGS
227.Nm
228may be controlled from an attached client by using a key combination of a
229prefix key,
230.Ql C-b
231(Ctrl-b) by default, followed by a command key.
232.Pp
233The default command key bindings are:
234.Pp
235.Bl -tag -width "XXXXXXXXXX" -offset indent -compact
236.It C-b
237Send the prefix key (C-b) through to the application.
238.It C-o
239Rotate the panes in the current window forwards.
240.It C-z
241Suspend the
242.Nm
243client.
244.It !
245Break the current pane out of the window.
246.It \&"
247Split the current pane into two, top and bottom.
248.It #
249List all paste buffers.
250.It $
251Rename the current session.
252.It %
253Split the current pane into two, left and right.
254.It &
255Kill the current window.
256.It '
257Prompt for a window index to select.
258.It ,
259Rename the current window.
260.It -
261Delete the most recently copied buffer of text.
262.It .
263Prompt for an index to move the current window.
264.It 0 to 9
265Select windows 0 to 9.
266.It :
267Enter the
268.Nm
269command prompt.
270.It ;
271Move to the previously active pane.
272.It =
273Choose which buffer to paste interactively from a list.
274.It \&?
275List all key bindings.
276.It D
277Choose a client to detach.
278.It \&[
279Enter copy mode to copy text or view the history.
280.It \&]
281Paste the most recently copied buffer of text.
282.It c
283Create a new window.
284.It d
285Detach the current client.
286.It f
287Prompt to search for text in open windows.
288.It i
289Display some information about the current window.
290.It l
291Move to the previously selected window.
292.It n
293Change to the next window.
294.It o
295Select the next pane in the current window.
296.It p
297Change to the previous window.
298.It q
299Briefly display pane indexes.
300.It r
301Force redraw of the attached client.
302.It s
303Select a new session for the attached client interactively.
304.It L
305Switch the attached client back to the last session.
306.It t
307Show the time.
308.It w
309Choose the current window interactively.
310.It x
311Kill the current pane.
312.It {
313Swap the current pane with the previous pane.
314.It }
315Swap the current pane with the next pane.
316.It ~
317Show previous messages from
318.Nm ,
319if any.
320.It Page Up
321Enter copy mode and scroll one page up.
322.It Up, Down
323.It Left, Right
324Change to the pane above, below, to the left, or to the right of the current
325pane.
326.It M-1 to M-5
327Arrange panes in one of the five preset layouts: even-horizontal,
328even-vertical, main-horizontal, main-vertical, or tiled.
329.It M-n
330Move to the next window with a bell or activity marker.
331.It M-o
332Rotate the panes in the current window backwards.
333.It M-p
334Move to the previous window with a bell or activity marker.
335.It C-Up, C-Down
336.It C-Left, C-Right
337Resize the current pane in steps of one cell.
338.It M-Up, M-Down
339.It M-Left, M-Right
340Resize the current pane in steps of five cells.
341.El
342.Pp
343Key bindings may be changed with the
344.Ic bind-key
345and
346.Ic unbind-key
347commands.
348.Sh COMMANDS
349This section contains a list of the commands supported by
350.Nm .
351Most commands accept the optional
352.Fl t
353argument with one of
354.Ar target-client ,
355.Ar target-session
356.Ar target-window ,
357or
358.Ar target-pane .
359These specify the client, session, window or pane which a command should affect.
360.Ar target-client
361is the name of the
362.Xr pty 7
363file to which the client is connected, for example either of
364.Pa /dev/ttyp1
365or
366.Pa ttyp1
367for the client attached to
368.Pa /dev/ttyp1 .
369If no client is specified, the current client is chosen, if possible, or an
370error is reported.
371Clients may be listed with the
372.Ic list-clients
373command.
374.Pp
375.Ar target-session
376is the session id prefixed with a $, the name of a session (as listed by the
377.Ic list-sessions
378command), or the name of a client with the same syntax as
379.Ar target-client ,
380in which case the session attached to the client is used.
381When looking for the session name,
382.Nm
383initially searches for an exact match; if none is found, the session names
384are checked for any for which
385.Ar target-session
386is a prefix or for which it matches as an
387.Xr fnmatch 3
388pattern.
389If a single match is found, it is used as the target session; multiple matches
390produce an error.
391If a session is omitted, the current session is used if available; if no
392current session is available, the most recently used is chosen.
393.Pp
394.Ar target-window
395specifies a window in the form
396.Em session Ns \&: Ns Em window .
397.Em session
398follows the same rules as for
399.Ar target-session ,
400and
401.Em window
402is looked for in order: as a window index, for example mysession:1;
403as a window ID, such as @1;
404as an exact window name, such as mysession:mywindow; then as an
405.Xr fnmatch 3
406pattern or the start of a window name, such as mysession:mywin* or
407mysession:mywin.
408An empty window name specifies the next unused index if appropriate (for
409example the
410.Ic new-window
411and
412.Ic link-window
413commands)
414otherwise the current window in
415.Em session
416is chosen.
417The special character
418.Ql \&!
419uses the last (previously current) window,
420.Ql ^
421selects the highest numbered window,
422.Ql $
423selects the lowest numbered window, and
424.Ql +
425and
426.Ql -
427select the next window or the previous window by number.
428When the argument does not contain a colon,
429.Nm
430first attempts to parse it as window; if that fails, an attempt is made to
431match a session.
432.Pp
433.Ar target-pane
434takes a similar form to
435.Ar target-window
436but with the optional addition of a period followed by a pane index, for
437example: mysession:mywindow.1.
438If the pane index is omitted, the currently active pane in the specified
439window is used.
440If neither a colon nor period appears,
441.Nm
442first attempts to use the argument as a pane index; if that fails, it is looked
443up as for
444.Ar target-window .
445A
446.Ql +
447or
448.Ql -
449indicate the next or previous pane index, respectively.
450One of the strings
451.Em top ,
452.Em bottom ,
453.Em left ,
454.Em right ,
455.Em top-left ,
456.Em top-right ,
457.Em bottom-left
458or
459.Em bottom-right
460may be used instead of a pane index.
461.Pp
462The special characters
463.Ql +
464and
465.Ql -
466may be followed by an offset, for example:
467.Bd -literal -offset indent
468select-window -t:+2
469.Ed
470.Pp
471When dealing with a session that doesn't contain sequential window indexes,
472they will be correctly skipped.
473.Pp
474.Nm
475also gives each pane created in a server an identifier consisting of a
476.Ql %
477and a number, starting from zero.
478A pane's identifier is unique for the life of the
479.Nm
480server and is passed to the child process of the pane in the
481.Ev TMUX_PANE
482environment variable.
483It may be used alone to target a pane or the window containing it.
484.Pp
485.Ar shell-command
486arguments are
487.Xr sh 1
488commands.
489These must be passed as a single item, which typically means quoting them, for
490example:
491.Bd -literal -offset indent
492new-window 'vi /etc/passwd'
493.Ed
494.Pp
495.Ar command
496.Op Ar arguments
497refers to a
498.Nm
499command, passed with the command and arguments separately, for example:
500.Bd -literal -offset indent
501bind-key F1 set-window-option force-width 81
502.Ed
503.Pp
504Or if using
505.Xr sh 1 :
506.Bd -literal -offset indent
507$ tmux bind-key F1 set-window-option force-width 81
508.Ed
509.Pp
510Multiple commands may be specified together as part of a
511.Em command sequence .
512Each command should be separated by spaces and a semicolon;
513commands are executed sequentially from left to right and
514lines ending with a backslash continue on to the next line,
515except when escaped by another backslash.
516A literal semicolon may be included by escaping it with a backslash (for
517example, when specifying a command sequence to
518.Ic bind-key ) .
519.Pp
520Example
521.Nm
522commands include:
523.Bd -literal -offset indent
524refresh-client -t/dev/ttyp2
525
526rename-session -tfirst newname
527
528set-window-option -t:0 monitor-activity on
529
530new-window ; split-window -d
531
532bind-key R source-file ~/.tmux.conf \e; \e
533	display-message "source-file done"
534.Ed
535.Pp
536Or from
537.Xr sh 1 :
538.Bd -literal -offset indent
539$ tmux kill-window -t :1
540
541$ tmux new-window \e; split-window -d
542
543$ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
544.Ed
545.Sh CLIENTS AND SESSIONS
546The
547.Nm
548server manages clients, sessions, windows and panes.
549Clients are attached to sessions to interact with them, either
550when they are created with the
551.Ic new-session
552command, or later with the
553.Ic attach-session
554command.
555Each session has one or more windows
556.Em linked
557into it.
558Windows may be linked to multiple sessions and are made up of one or
559more panes,
560each of which contains a pseudo terminal.
561Commands for creating, linking and otherwise manipulating windows
562are covered
563in the
564.Sx WINDOWS AND PANES
565section.
566.Pp
567The following commands are available to manage clients and sessions:
568.Bl -tag -width Ds
569.It Xo Ic attach-session
570.Op Fl dr
571.Op Fl c Ar working-directory
572.Op Fl t Ar target-session
573.Xc
574.D1 (alias: Ic attach )
575If run from outside
576.Nm ,
577create a new client in the current terminal and attach it to
578.Ar target-session .
579If used from inside, switch the current client.
580If
581.Fl d
582is specified, any other clients attached to the session are detached.
583.Fl r
584signifies the client is read-only (only keys bound to the
585.Ic detach-client
586or
587.Ic switch-client
588commands have any effect)
589.Pp
590If no server is started,
591.Ic attach-session
592will attempt to start it; this will fail unless sessions are created in the
593configuration file.
594.Pp
595The
596.Ar target-session
597rules for
598.Ic attach-session
599are slightly adjusted: if
600.Nm
601needs to select the most recently used session, it will prefer the most
602recently used
603.Em unattached
604session.
605.Pp
606.Fl c
607will set the session working directory (used for new windows) to
608.Ar working-directory .
609.It Xo Ic detach-client
610.Op Fl P
611.Op Fl a
612.Op Fl s Ar target-session
613.Op Fl t Ar target-client
614.Xc
615.D1 (alias: Ic detach )
616Detach the current client if bound to a key, the client specified with
617.Fl t ,
618or all clients currently attached to the session specified by
619.Fl s .
620The
621.Fl a
622option kills all but the client given with
623.Fl t .
624If
625.Fl P
626is given, send SIGHUP to the parent process of the client, typically causing it
627to exit.
628.It Ic has-session Op Fl t Ar target-session
629.D1 (alias: Ic has )
630Report an error and exit with 1 if the specified session does not exist.
631If it does exist, exit with 0.
632.It Ic kill-server
633Kill the
634.Nm
635server and clients and destroy all sessions.
636.It Xo Ic kill-session
637.Op Fl a
638.Op Fl t Ar target-session
639.Xc
640Destroy the given session, closing any windows linked to it and no other
641sessions, and detaching all clients attached to it.
642If
643.Fl a
644is given, all sessions but the specified one is killed.
645.It Xo Ic list-clients
646.Op Fl F Ar format
647.Op Fl t Ar target-session
648.Xc
649.D1 (alias: Ic lsc )
650List all clients attached to the server.
651For the meaning of the
652.Fl F
653flag, see the
654.Sx FORMATS
655section.
656If
657.Ar target-session
658is specified, list only clients connected to that session.
659.It Ic list-commands
660.D1 (alias: Ic lscm )
661List the syntax of all commands supported by
662.Nm .
663.It Ic list-sessions Op Fl F Ar format
664.D1 (alias: Ic ls )
665List all sessions managed by the server.
666For the meaning of the
667.Fl F
668flag, see the
669.Sx FORMATS
670section.
671.It Ic lock-client Op Fl t Ar target-client
672.D1 (alias: Ic lockc )
673Lock
674.Ar target-client ,
675see the
676.Ic lock-server
677command.
678.It Ic lock-session Op Fl t Ar target-session
679.D1 (alias: Ic locks )
680Lock all clients attached to
681.Ar target-session .
682.It Xo Ic new-session
683.Op Fl AdDP
684.Op Fl c Ar start-directory
685.Op Fl F Ar format
686.Op Fl n Ar window-name
687.Op Fl s Ar session-name
688.Op Fl t Ar target-session
689.Op Fl x Ar width
690.Op Fl y Ar height
691.Op Ar shell-command
692.Xc
693.D1 (alias: Ic new )
694Create a new session with name
695.Ar session-name .
696.Pp
697The new session is attached to the current terminal unless
698.Fl d
699is given.
700.Ar window-name
701and
702.Ar shell-command
703are the name of and shell command to execute in the initial window.
704If
705.Fl d
706is used,
707.Fl x
708and
709.Fl y
710specify the size of the initial window (80 by 24 if not given).
711.Pp
712If run from a terminal, any
713.Xr termios 3
714special characters are saved and used for new windows in the new session.
715.Pp
716The
717.Fl A
718flag makes
719.Ic new-session
720behave like
721.Ic attach-session
722if
723.Ar session-name
724already exists; in the case,
725.Fl D
726behaves like
727.Fl d
728to
729.Ic attach-session .
730.Pp
731If
732.Fl t
733is given, the new session is
734.Em grouped
735with
736.Ar target-session .
737This means they share the same set of windows - all windows from
738.Ar target-session
739are linked to the new session and any subsequent new windows or windows being
740closed are applied to both sessions.
741The current and previous window and any session options remain independent and
742either session may be killed without affecting the other.
743Giving
744.Fl n
745or
746.Ar shell-command
747are invalid if
748.Fl t
749is used.
750.Pp
751The
752.Fl P
753option prints information about the new session after it has been created.
754By default, it uses the format
755.Ql #{session_name}:
756but a different format may be specified with
757.Fl F .
758.It Xo Ic refresh-client
759.Op Fl S
760.Op Fl t Ar target-client
761.Xc
762.D1 (alias: Ic refresh )
763Refresh the current client if bound to a key, or a single client if one is given
764with
765.Fl t .
766If
767.Fl S
768is specified, only update the client's status bar.
769.It Xo Ic rename-session
770.Op Fl t Ar target-session
771.Ar new-name
772.Xc
773.D1 (alias: Ic rename )
774Rename the session to
775.Ar new-name .
776.It Xo Ic show-messages
777.Op Fl IJT
778.Op Fl t Ar target-client
779.Xc
780.D1 (alias: Ic showmsgs )
781Show client messages or server information.
782Any messages displayed on the status line are saved in a per-client message
783log, up to a maximum of the limit set by the
784.Ar message-limit
785session option for the session attached to that client.
786With
787.Fl t ,
788display the log for
789.Ar target-client .
790.Fl I ,
791.Fl J
792and
793.Fl T
794show debugging information about the running server, jobs and terminals.
795.It Ic source-file Ar path
796.D1 (alias: Ic source )
797Execute commands from
798.Ar path .
799.It Ic start-server
800.D1 (alias: Ic start )
801Start the
802.Nm
803server, if not already running, without creating any sessions.
804.It Xo Ic suspend-client
805.Op Fl t Ar target-client
806.Xc
807.D1 (alias: Ic suspendc )
808Suspend a client by sending
809.Dv SIGTSTP
810(tty stop).
811.It Xo Ic switch-client
812.Op Fl lnpr
813.Op Fl c Ar target-client
814.Op Fl t Ar target-session
815.Xc
816.D1 (alias: Ic switchc )
817Switch the current session for client
818.Ar target-client
819to
820.Ar target-session .
821If
822.Fl l ,
823.Fl n
824or
825.Fl p
826is used, the client is moved to the last, next or previous session
827respectively.
828.Fl r
829toggles whether a client is read-only (see the
830.Ic attach-session
831command).
832.El
833.Sh WINDOWS AND PANES
834A
835.Nm
836window may be in one of several modes.
837The default permits direct access to the terminal attached to the window.
838The other is copy mode, which permits a section of a window or its
839history to be copied to a
840.Em paste buffer
841for later insertion into another window.
842This mode is entered with the
843.Ic copy-mode
844command, bound to
845.Ql \&[
846by default.
847It is also entered when a command that produces output, such as
848.Ic list-keys ,
849is executed from a key binding.
850.Pp
851The keys available depend on whether emacs or vi mode is selected
852(see the
853.Ic mode-keys
854option).
855The following keys are supported as appropriate for the mode:
856.Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
857.It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
858.It Li "Back to indentation" Ta "^" Ta "M-m"
859.It Li "Bottom of history" Ta "G" Ta "M-<"
860.It Li "Clear selection" Ta "Escape" Ta "C-g"
861.It Li "Copy selection" Ta "Enter" Ta "M-w"
862.It Li "Cursor down" Ta "j" Ta "Down"
863.It Li "Cursor left" Ta "h" Ta "Left"
864.It Li "Cursor right" Ta "l" Ta "Right"
865.It Li "Cursor to bottom line" Ta "L" Ta ""
866.It Li "Cursor to middle line" Ta "M" Ta "M-r"
867.It Li "Cursor to top line" Ta "H" Ta "M-R"
868.It Li "Cursor up" Ta "k" Ta "Up"
869.It Li "Delete entire line" Ta "d" Ta "C-u"
870.It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
871.It Li "End of line" Ta "$" Ta "C-e"
872.It Li "Go to line" Ta ":" Ta "g"
873.It Li "Half page down" Ta "C-d" Ta "M-Down"
874.It Li "Half page up" Ta "C-u" Ta "M-Up"
875.It Li "Jump forward" Ta "f" Ta "f"
876.It Li "Jump to forward" Ta "t" Ta ""
877.It Li "Jump backward" Ta "F" Ta "F"
878.It Li "Jump to backward" Ta "T" Ta ""
879.It Li "Jump again" Ta ";" Ta ";"
880.It Li "Jump again in reverse" Ta "," Ta ","
881.It Li "Next page" Ta "C-f" Ta "Page down"
882.It Li "Next space" Ta "W" Ta ""
883.It Li "Next space, end of word" Ta "E" Ta ""
884.It Li "Next word" Ta "w" Ta ""
885.It Li "Next word end" Ta "e" Ta "M-f"
886.It Li "Other end of selection" Ta "o" Ta ""
887.It Li "Paste buffer" Ta "p" Ta "C-y"
888.It Li "Previous page" Ta "C-b" Ta "Page up"
889.It Li "Previous word" Ta "b" Ta "M-b"
890.It Li "Previous space" Ta "B" Ta ""
891.It Li "Quit mode" Ta "q" Ta "Escape"
892.It Li "Rectangle toggle" Ta "v" Ta "R"
893.It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
894.It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
895.It Li "Search again" Ta "n" Ta "n"
896.It Li "Search again in reverse" Ta "N" Ta "N"
897.It Li "Search backward" Ta "?" Ta "C-r"
898.It Li "Search forward" Ta "/" Ta "C-s"
899.It Li "Start of line" Ta "0" Ta "C-a"
900.It Li "Start selection" Ta "Space" Ta "C-Space"
901.It Li "Top of history" Ta "g" Ta "M->"
902.It Li "Transpose characters" Ta "" Ta "C-t"
903.El
904.Pp
905The next and previous word keys use space and the
906.Ql - ,
907.Ql _
908and
909.Ql @
910characters as word delimiters by default, but this can be adjusted by
911setting the
912.Em word-separators
913session option.
914Next word moves to the start of the next word, next word end to the end of the
915next word and previous word to the start of the previous word.
916The three next and previous space keys work similarly but use a space alone as
917the word separator.
918.Pp
919The jump commands enable quick movement within a line.
920For instance, typing
921.Ql f
922followed by
923.Ql /
924will move the cursor to the next
925.Ql /
926character on the current line.
927A
928.Ql \&;
929will then jump to the next occurrence.
930.Pp
931Commands in copy mode may be prefaced by an optional repeat count.
932With vi key bindings, a prefix is entered using the number keys; with
933emacs, the Alt (meta) key and a number begins prefix entry.
934For example, to move the cursor forward by ten words, use
935.Ql M-1 0 M-f
936in emacs mode, and
937.Ql 10w
938in vi.
939.Pp
940When copying the selection, the repeat count indicates the buffer index to
941replace, if used.
942.Pp
943Mode key bindings are defined in a set of named tables:
944.Em vi-edit
945and
946.Em emacs-edit
947for keys used when line editing at the command prompt;
948.Em vi-choice
949and
950.Em emacs-choice
951for keys used when choosing from lists (such as produced by the
952.Ic choose-window
953command); and
954.Em vi-copy
955and
956.Em emacs-copy
957used in copy mode.
958The tables may be viewed with the
959.Ic list-keys
960command and keys modified or removed with
961.Ic bind-key
962and
963.Ic unbind-key .
964One command accepts an argument,
965.Ic copy-pipe ,
966which copies the selection and pipes it to a command.
967For example the following will bind
968.Ql C-q
969to copy the selection into
970.Pa /tmp
971as well as the paste buffer:
972.Bd -literal -offset indent
973bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out"
974.Ed
975.Pp
976The paste buffer key pastes the first line from the top paste buffer on the
977stack.
978.Pp
979The synopsis for the
980.Ic copy-mode
981command is:
982.Bl -tag -width Ds
983.It Xo Ic copy-mode
984.Op Fl u
985.Op Fl t Ar target-pane
986.Xc
987Enter copy mode.
988The
989.Fl u
990option scrolls one page up.
991.El
992.Pp
993Each window displayed by
994.Nm
995may be split into one or more
996.Em panes ;
997each pane takes up a certain area of the display and is a separate terminal.
998A window may be split into panes using the
999.Ic split-window
1000command.
1001Windows may be split horizontally (with the
1002.Fl h
1003flag) or vertically.
1004Panes may be resized with the
1005.Ic resize-pane
1006command (bound to
1007.Ql C-up ,
1008.Ql C-down
1009.Ql C-left
1010and
1011.Ql C-right
1012by default), the current pane may be changed with the
1013.Ic select-pane
1014command and the
1015.Ic rotate-window
1016and
1017.Ic swap-pane
1018commands may be used to swap panes without changing their position.
1019Panes are numbered beginning from zero in the order they are created.
1020.Pp
1021A number of preset
1022.Em layouts
1023are available.
1024These may be selected with the
1025.Ic select-layout
1026command or cycled with
1027.Ic next-layout
1028(bound to
1029.Ql Space
1030by default); once a layout is chosen, panes within it may be moved and resized
1031as normal.
1032.Pp
1033The following layouts are supported:
1034.Bl -tag -width Ds
1035.It Ic even-horizontal
1036Panes are spread out evenly from left to right across the window.
1037.It Ic even-vertical
1038Panes are spread evenly from top to bottom.
1039.It Ic main-horizontal
1040A large (main) pane is shown at the top of the window and the remaining panes
1041are spread from left to right in the leftover space at the bottom.
1042Use the
1043.Em main-pane-height
1044window option to specify the height of the top pane.
1045.It Ic main-vertical
1046Similar to
1047.Ic main-horizontal
1048but the large pane is placed on the left and the others spread from top to
1049bottom along the right.
1050See the
1051.Em main-pane-width
1052window option.
1053.It Ic tiled
1054Panes are spread out as evenly as possible over the window in both rows and
1055columns.
1056.El
1057.Pp
1058In addition,
1059.Ic select-layout
1060may be used to apply a previously used layout - the
1061.Ic list-windows
1062command displays the layout of each window in a form suitable for use with
1063.Ic select-layout .
1064For example:
1065.Bd -literal -offset indent
1066$ tmux list-windows
10670: ksh [159x48]
1068    layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
1069$ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
1070.Ed
1071.Pp
1072.Nm
1073automatically adjusts the size of the layout for the current window size.
1074Note that a layout cannot be applied to a window with more panes than that
1075from which the layout was originally defined.
1076.Pp
1077Commands related to windows and panes are as follows:
1078.Bl -tag -width Ds
1079.It Xo Ic break-pane
1080.Op Fl dP
1081.Op Fl F Ar format
1082.Op Fl t Ar target-pane
1083.Xc
1084.D1 (alias: Ic breakp )
1085Break
1086.Ar target-pane
1087off from its containing window to make it the only pane in a new window.
1088If
1089.Fl d
1090is given, the new window does not become the current window.
1091The
1092.Fl P
1093option prints information about the new window after it has been created.
1094By default, it uses the format
1095.Ql #{session_name}:#{window_index}
1096but a different format may be specified with
1097.Fl F .
1098.It Xo Ic capture-pane
1099.Op Fl aepPq
1100.Op Fl b Ar buffer-index
1101.Op Fl E Ar end-line
1102.Op Fl S Ar start-line
1103.Op Fl t Ar target-pane
1104.Xc
1105.D1 (alias: Ic capturep )
1106Capture the contents of a pane.
1107If
1108.Fl p
1109is given, the output goes to stdout, otherwise to the buffer specified with
1110.Fl b
1111or a new buffer if omitted.
1112If
1113.Fl a
1114is given, the alternate screen is used, and the history is not accessible.
1115If no alternate screen exists, an error will be returned unless
1116.Fl q
1117is given.
1118If
1119.Fl e
1120is given, the output includes escape sequences for text and background
1121attributes.
1122.Fl C
1123also escapes non-printable characters as octal \exxx.
1124.Fl J
1125joins wrapped lines and preserves trailing spaces at each line's end.
1126.Fl P
1127captures only any output that the pane has received that is the beginning of an
1128as-yet incomplete escape sequence.
1129.Pp
1130.Fl S
1131and
1132.Fl E
1133specify the starting and ending line numbers, zero is the first line of the
1134visible pane and negative numbers are lines in the history.
1135The default is to capture only the visible contents of the pane.
1136.It Xo
1137.Ic choose-client
1138.Op Fl F Ar format
1139.Op Fl t Ar target-window
1140.Op Ar template
1141.Xc
1142Put a window into client choice mode, allowing a client to be selected
1143interactively from a list.
1144After a client is chosen,
1145.Ql %%
1146is replaced by the client
1147.Xr pty 7
1148path in
1149.Ar template
1150and the result executed as a command.
1151If
1152.Ar template
1153is not given, "detach-client -t '%%'" is used.
1154For the meaning of the
1155.Fl F
1156flag, see the
1157.Sx FORMATS
1158section.
1159This command works only if at least one client is attached.
1160.It Xo
1161.Ic choose-list
1162.Op Fl l Ar items
1163.Op Fl t Ar target-window
1164.Op Ar template
1165.Xc
1166Put a window into list choice mode, allowing
1167.Ar items
1168to be selected.
1169.Ar items
1170can be a comma-separated list to display more than one item.
1171If an item has spaces, that entry must be quoted.
1172After an item is chosen,
1173.Ql %%
1174is replaced by the chosen item in the
1175.Ar template
1176and the result is executed as a command.
1177If
1178.Ar template
1179is not given, "run-shell '%%'" is used.
1180.Ar items
1181also accepts format specifiers.
1182For the meaning of this see the
1183.Sx FORMATS
1184section.
1185This command works only if at least one client is attached.
1186.It Xo
1187.Ic choose-session
1188.Op Fl F Ar format
1189.Op Fl t Ar target-window
1190.Op Ar template
1191.Xc
1192Put a window into session choice mode, where a session may be selected
1193interactively from a list.
1194When one is chosen,
1195.Ql %%
1196is replaced by the session name in
1197.Ar template
1198and the result executed as a command.
1199If
1200.Ar template
1201is not given, "switch-client -t '%%'" is used.
1202For the meaning of the
1203.Fl F
1204flag, see the
1205.Sx FORMATS
1206section.
1207This command works only if at least one client is attached.
1208.It Xo
1209.Ic choose-tree
1210.Op Fl suw
1211.Op Fl b Ar session-template
1212.Op Fl c Ar window-template
1213.Op Fl S Ar format
1214.Op Fl W Ar format
1215.Op Fl t Ar target-window
1216.Xc
1217Put a window into tree choice mode, where either sessions or windows may be
1218selected interactively from a list.
1219By default, windows belonging to a session are indented to show their
1220relationship to a session.
1221.Pp
1222Note that the
1223.Ic choose-window
1224and
1225.Ic choose-session
1226commands are wrappers around
1227.Ic choose-tree .
1228.Pp
1229If
1230.Fl s
1231is given, will show sessions.
1232If
1233.Fl w
1234is given, will show windows.
1235.Pp
1236By default, the tree is collapsed and sessions must be expanded to windows
1237with the right arrow key.
1238The
1239.Fl u
1240option will start with all sessions expanded instead.
1241.Pp
1242If
1243.Fl b
1244is given, will override the default session command.
1245Note that
1246.Ql %%
1247can be used and will be replaced with the session name.
1248The default option if not specified is "switch-client -t '%%'".
1249If
1250.Fl c
1251is given, will override the default window command.
1252Like
1253.Fl b ,
1254.Ql %%
1255can be used and will be replaced with the session name and window index.
1256When a window is chosen from the list, the session command is run before the
1257window command.
1258.Pp
1259If
1260.Fl S
1261is given will display the specified format instead of the default session
1262format.
1263If
1264.Fl W
1265is given will display the specified format instead of the default window
1266format.
1267For the meaning of the
1268.Fl s
1269and
1270.Fl w
1271options, see the
1272.Sx FORMATS
1273section.
1274.Pp
1275This command works only if at least one client is attached.
1276.It Xo
1277.Ic choose-window
1278.Op Fl F Ar format
1279.Op Fl t Ar target-window
1280.Op Ar template
1281.Xc
1282Put a window into window choice mode, where a window may be chosen
1283interactively from a list.
1284After a window is selected,
1285.Ql %%
1286is replaced by the session name and window index in
1287.Ar template
1288and the result executed as a command.
1289If
1290.Ar template
1291is not given, "select-window -t '%%'" is used.
1292For the meaning of the
1293.Fl F
1294flag, see the
1295.Sx FORMATS
1296section.
1297This command works only if at least one client is attached.
1298.It Ic display-panes Op Fl t Ar target-client
1299.D1 (alias: Ic displayp)
1300Display a visible indicator of each pane shown by
1301.Ar target-client .
1302See the
1303.Ic display-panes-time ,
1304.Ic display-panes-colour ,
1305and
1306.Ic display-panes-active-colour
1307session options.
1308While the indicator is on screen, a pane may be selected with the
1309.Ql 0
1310to
1311.Ql 9
1312keys.
1313.It Xo Ic find-window
1314.Op Fl CNT
1315.Op Fl F Ar format
1316.Op Fl t Ar target-window
1317.Ar match-string
1318.Xc
1319.D1 (alias: Ic findw )
1320Search for the
1321.Xr fnmatch 3
1322pattern
1323.Ar match-string
1324in window names, titles, and visible content (but not history).
1325The flags control matching behavior:
1326.Fl C
1327matches only visible window contents,
1328.Fl N
1329matches only the window name and
1330.Fl T
1331matches only the window title.
1332The default is
1333.Fl CNT .
1334If only one window is matched, it'll be automatically selected,
1335otherwise a choice list is shown.
1336For the meaning of the
1337.Fl F
1338flag, see the
1339.Sx FORMATS
1340section.
1341This command works only if at least one client is attached.
1342.It Xo Ic join-pane
1343.Op Fl bdhv
1344.Oo Fl l
1345.Ar size |
1346.Fl p Ar percentage Oc
1347.Op Fl s Ar src-pane
1348.Op Fl t Ar dst-pane
1349.Xc
1350.D1 (alias: Ic joinp )
1351Like
1352.Ic split-window ,
1353but instead of splitting
1354.Ar dst-pane
1355and creating a new pane, split it and move
1356.Ar src-pane
1357into the space.
1358This can be used to reverse
1359.Ic break-pane .
1360The
1361.Fl b
1362option causes
1363.Ar src-pane
1364to be joined to left of or above
1365.Ar dst-pane .
1366.It Xo Ic kill-pane
1367.Op Fl a
1368.Op Fl t Ar target-pane
1369.Xc
1370.D1 (alias: Ic killp )
1371Destroy the given pane.
1372If no panes remain in the containing window, it is also destroyed.
1373The
1374.Fl a
1375option kills all but the pane given with
1376.Fl t .
1377.It Xo Ic kill-window
1378.Op Fl a
1379.Op Fl t Ar target-window
1380.Xc
1381.D1 (alias: Ic killw )
1382Kill the current window or the window at
1383.Ar target-window ,
1384removing it from any sessions to which it is linked.
1385The
1386.Fl a
1387option kills all but the window given with
1388.Fl t .
1389.It Ic last-pane Op Fl t Ar target-window
1390.D1 (alias: Ic lastp )
1391Select the last (previously selected) pane.
1392.It Ic last-window Op Fl t Ar target-session
1393.D1 (alias: Ic last )
1394Select the last (previously selected) window.
1395If no
1396.Ar target-session
1397is specified, select the last window of the current session.
1398.It Xo Ic link-window
1399.Op Fl dk
1400.Op Fl s Ar src-window
1401.Op Fl t Ar dst-window
1402.Xc
1403.D1 (alias: Ic linkw )
1404Link the window at
1405.Ar src-window
1406to the specified
1407.Ar dst-window .
1408If
1409.Ar dst-window
1410is specified and no such window exists, the
1411.Ar src-window
1412is linked there.
1413If
1414.Fl k
1415is given and
1416.Ar dst-window
1417exists, it is killed, otherwise an error is generated.
1418If
1419.Fl d
1420is given, the newly linked window is not selected.
1421.It Xo Ic list-panes
1422.Op Fl as
1423.Op Fl F Ar format
1424.Op Fl t Ar target
1425.Xc
1426.D1 (alias: Ic lsp )
1427If
1428.Fl a
1429is given,
1430.Ar target
1431is ignored and all panes on the server are listed.
1432If
1433.Fl s
1434is given,
1435.Ar target
1436is a session (or the current session).
1437If neither is given,
1438.Ar target
1439is a window (or the current window).
1440For the meaning of the
1441.Fl F
1442flag, see the
1443.Sx FORMATS
1444section.
1445.It Xo Ic list-windows
1446.Op Fl a
1447.Op Fl F Ar format
1448.Op Fl t Ar target-session
1449.Xc
1450.D1 (alias: Ic lsw )
1451If
1452.Fl a
1453is given, list all windows on the server.
1454Otherwise, list windows in the current session or in
1455.Ar target-session .
1456For the meaning of the
1457.Fl F
1458flag, see the
1459.Sx FORMATS
1460section.
1461.It Xo Ic move-pane
1462.Op Fl bdhv
1463.Oo Fl l
1464.Ar size |
1465.Fl p Ar percentage Oc
1466.Op Fl s Ar src-pane
1467.Op Fl t Ar dst-pane
1468.Xc
1469.D1 (alias: Ic movep )
1470Like
1471.Ic join-pane ,
1472but
1473.Ar src-pane
1474and
1475.Ar dst-pane
1476may belong to the same window.
1477.It Xo Ic move-window
1478.Op Fl rdk
1479.Op Fl s Ar src-window
1480.Op Fl t Ar dst-window
1481.Xc
1482.D1 (alias: Ic movew )
1483This is similar to
1484.Ic link-window ,
1485except the window at
1486.Ar src-window
1487is moved to
1488.Ar dst-window .
1489With
1490.Fl r ,
1491all windows in the session are renumbered in sequential order, respecting
1492the
1493.Ic base-index
1494option.
1495.It Xo Ic new-window
1496.Op Fl adkP
1497.Op Fl c Ar start-directory
1498.Op Fl F Ar format
1499.Op Fl n Ar window-name
1500.Op Fl t Ar target-window
1501.Op Ar shell-command
1502.Xc
1503.D1 (alias: Ic neww )
1504Create a new window.
1505With
1506.Fl a ,
1507the new window is inserted at the next index up from the specified
1508.Ar target-window ,
1509moving windows up if necessary,
1510otherwise
1511.Ar target-window
1512is the new window location.
1513.Pp
1514If
1515.Fl d
1516is given, the session does not make the new window the current window.
1517.Ar target-window
1518represents the window to be created; if the target already exists an error is
1519shown, unless the
1520.Fl k
1521flag is used, in which case it is destroyed.
1522.Ar shell-command
1523is the command to execute.
1524If
1525.Ar shell-command
1526is not specified, the value of the
1527.Ic default-command
1528option is used.
1529.Fl c
1530specifies the working directory in which the new window is created.
1531.Pp
1532When the shell command completes, the window closes.
1533See the
1534.Ic remain-on-exit
1535option to change this behaviour.
1536.Pp
1537The
1538.Ev TERM
1539environment variable must be set to
1540.Dq screen
1541for all programs running
1542.Em inside
1543.Nm .
1544New windows will automatically have
1545.Dq TERM=screen
1546added to their environment, but care must be taken not to reset this in shell
1547start-up files.
1548.Pp
1549The
1550.Fl P
1551option prints information about the new window after it has been created.
1552By default, it uses the format
1553.Ql #{session_name}:#{window_index}
1554but a different format may be specified with
1555.Fl F .
1556.It Ic next-layout Op Fl t Ar target-window
1557.D1 (alias: Ic nextl )
1558Move a window to the next layout and rearrange the panes to fit.
1559.It Xo Ic next-window
1560.Op Fl a
1561.Op Fl t Ar target-session
1562.Xc
1563.D1 (alias: Ic next )
1564Move to the next window in the session.
1565If
1566.Fl a
1567is used, move to the next window with an alert.
1568.It Xo Ic pipe-pane
1569.Op Fl o
1570.Op Fl t Ar target-pane
1571.Op Ar shell-command
1572.Xc
1573.D1 (alias: Ic pipep )
1574Pipe any output sent by the program in
1575.Ar target-pane
1576to a shell command.
1577A pane may only be piped to one command at a time, any existing pipe is
1578closed before
1579.Ar shell-command
1580is executed.
1581The
1582.Ar shell-command
1583string may contain the special character sequences supported by the
1584.Ic status-left
1585option.
1586If no
1587.Ar shell-command
1588is given, the current pipe (if any) is closed.
1589.Pp
1590The
1591.Fl o
1592option only opens a new pipe if no previous pipe exists, allowing a pipe to
1593be toggled with a single key, for example:
1594.Bd -literal -offset indent
1595bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1596.Ed
1597.It Xo Ic previous-layout
1598.Op Fl t Ar target-window
1599.Xc
1600.D1 (alias: Ic prevl )
1601Move to the previous layout in the session.
1602.It Xo Ic previous-window
1603.Op Fl a
1604.Op Fl t Ar target-session
1605.Xc
1606.D1 (alias: Ic prev )
1607Move to the previous window in the session.
1608With
1609.Fl a ,
1610move to the previous window with an alert.
1611.It Xo Ic rename-window
1612.Op Fl t Ar target-window
1613.Ar new-name
1614.Xc
1615.D1 (alias: Ic renamew )
1616Rename the current window, or the window at
1617.Ar target-window
1618if specified, to
1619.Ar new-name .
1620.It Xo Ic resize-pane
1621.Op Fl DLRUZ
1622.Op Fl t Ar target-pane
1623.Op Fl x Ar width
1624.Op Fl y Ar height
1625.Op Ar adjustment
1626.Xc
1627.D1 (alias: Ic resizep )
1628Resize a pane, up, down, left or right by
1629.Ar adjustment
1630with
1631.Fl U ,
1632.Fl D ,
1633.Fl L
1634or
1635.Fl R ,
1636or
1637to an absolute size
1638with
1639.Fl x
1640or
1641.Fl y .
1642The
1643.Ar adjustment
1644is given in lines or cells (the default is 1).
1645.Pp
1646With
1647.Fl Z ,
1648the active pane is toggled between zoomed (occupying the whole of the window)
1649and unzoomed (its normal position in the layout).
1650.It Xo Ic respawn-pane
1651.Op Fl k
1652.Op Fl t Ar target-pane
1653.Op Ar shell-command
1654.Xc
1655.D1 (alias: Ic respawnp )
1656Reactivate a pane in which the command has exited (see the
1657.Ic remain-on-exit
1658window option).
1659If
1660.Ar shell-command
1661is not given, the command used when the pane was created is executed.
1662The pane must be already inactive, unless
1663.Fl k
1664is given, in which case any existing command is killed.
1665.It Xo Ic respawn-window
1666.Op Fl k
1667.Op Fl t Ar target-window
1668.Op Ar shell-command
1669.Xc
1670.D1 (alias: Ic respawnw )
1671Reactivate a window in which the command has exited (see the
1672.Ic remain-on-exit
1673window option).
1674If
1675.Ar shell-command
1676is not given, the command used when the window was created is executed.
1677The window must be already inactive, unless
1678.Fl k
1679is given, in which case any existing command is killed.
1680.It Xo Ic rotate-window
1681.Op Fl DU
1682.Op Fl t Ar target-window
1683.Xc
1684.D1 (alias: Ic rotatew )
1685Rotate the positions of the panes within a window, either upward (numerically
1686lower) with
1687.Fl U
1688or downward (numerically higher).
1689.It Xo Ic select-layout
1690.Op Fl np
1691.Op Fl t Ar target-window
1692.Op Ar layout-name
1693.Xc
1694.D1 (alias: Ic selectl )
1695Choose a specific layout for a window.
1696If
1697.Ar layout-name
1698is not given, the last preset layout used (if any) is reapplied.
1699.Fl n
1700and
1701.Fl p
1702are equivalent to the
1703.Ic next-layout
1704and
1705.Ic previous-layout
1706commands.
1707.It Xo Ic select-pane
1708.Op Fl lDLRU
1709.Op Fl t Ar target-pane
1710.Xc
1711.D1 (alias: Ic selectp )
1712Make pane
1713.Ar target-pane
1714the active pane in window
1715.Ar target-window .
1716If one of
1717.Fl D ,
1718.Fl L ,
1719.Fl R ,
1720or
1721.Fl U
1722is used, respectively the pane below, to the left, to the right, or above the
1723target pane is used.
1724.Fl l
1725is the same as using the
1726.Ic last-pane
1727command.
1728.It Xo Ic select-window
1729.Op Fl lnpT
1730.Op Fl t Ar target-window
1731.Xc
1732.D1 (alias: Ic selectw )
1733Select the window at
1734.Ar target-window .
1735.Fl l ,
1736.Fl n
1737and
1738.Fl p
1739are equivalent to the
1740.Ic last-window ,
1741.Ic next-window
1742and
1743.Ic previous-window
1744commands.
1745If
1746.Fl T
1747is given and the selected window is already the current window,
1748the command behaves like
1749.Ic last-window .
1750.It Xo Ic split-window
1751.Op Fl dhvP
1752.Op Fl c Ar start-directory
1753.Oo Fl l
1754.Ar size |
1755.Fl p Ar percentage Oc
1756.Op Fl t Ar target-pane
1757.Op Ar shell-command
1758.Op Fl F Ar format
1759.Xc
1760.D1 (alias: Ic splitw )
1761Create a new pane by splitting
1762.Ar target-pane :
1763.Fl h
1764does a horizontal split and
1765.Fl v
1766a vertical split; if neither is specified,
1767.Fl v
1768is assumed.
1769The
1770.Fl l
1771and
1772.Fl p
1773options specify the size of the new pane in lines (for vertical split) or in
1774cells (for horizontal split), or as a percentage, respectively.
1775All other options have the same meaning as for the
1776.Ic new-window
1777command.
1778.It Xo Ic swap-pane
1779.Op Fl dDU
1780.Op Fl s Ar src-pane
1781.Op Fl t Ar dst-pane
1782.Xc
1783.D1 (alias: Ic swapp )
1784Swap two panes.
1785If
1786.Fl U
1787is used and no source pane is specified with
1788.Fl s ,
1789.Ar dst-pane
1790is swapped with the previous pane (before it numerically);
1791.Fl D
1792swaps with the next pane (after it numerically).
1793.Fl d
1794instructs
1795.Nm
1796not to change the active pane.
1797.It Xo Ic swap-window
1798.Op Fl d
1799.Op Fl s Ar src-window
1800.Op Fl t Ar dst-window
1801.Xc
1802.D1 (alias: Ic swapw )
1803This is similar to
1804.Ic link-window ,
1805except the source and destination windows are swapped.
1806It is an error if no window exists at
1807.Ar src-window .
1808.It Xo Ic unlink-window
1809.Op Fl k
1810.Op Fl t Ar target-window
1811.Xc
1812.D1 (alias: Ic unlinkw )
1813Unlink
1814.Ar target-window .
1815Unless
1816.Fl k
1817is given, a window may be unlinked only if it is linked to multiple sessions -
1818windows may not be linked to no sessions;
1819if
1820.Fl k
1821is specified and the window is linked to only one session, it is unlinked and
1822destroyed.
1823.El
1824.Sh KEY BINDINGS
1825.Nm
1826allows a command to be bound to most keys, with or without a prefix key.
1827When specifying keys, most represent themselves (for example
1828.Ql A
1829to
1830.Ql Z ) .
1831Ctrl keys may be prefixed with
1832.Ql C-
1833or
1834.Ql ^ ,
1835and Alt (meta) with
1836.Ql M- .
1837In addition, the following special key names are accepted:
1838.Em Up ,
1839.Em Down ,
1840.Em Left ,
1841.Em Right ,
1842.Em BSpace ,
1843.Em BTab ,
1844.Em DC
1845(Delete),
1846.Em End ,
1847.Em Enter ,
1848.Em Escape ,
1849.Em F1
1850to
1851.Em F20 ,
1852.Em Home ,
1853.Em IC
1854(Insert),
1855.Em NPage/PageDown/PgDn ,
1856.Em PPage/PageUp/PgUp ,
1857.Em Space ,
1858and
1859.Em Tab .
1860Note that to bind the
1861.Ql \&"
1862or
1863.Ql '
1864keys, quotation marks are necessary, for example:
1865.Bd -literal -offset indent
1866bind-key '"' split-window
1867bind-key "'" new-window
1868.Ed
1869.Pp
1870Commands related to key bindings are as follows:
1871.Bl -tag -width Ds
1872.It Xo Ic bind-key
1873.Op Fl cnr
1874.Op Fl t Ar key-table
1875.Ar key Ar command Op Ar arguments
1876.Xc
1877.D1 (alias: Ic bind )
1878Bind key
1879.Ar key
1880to
1881.Ar command .
1882By default (without
1883.Fl t )
1884the primary key bindings are modified (those normally activated with the prefix
1885key); in this case, if
1886.Fl n
1887is specified, it is not necessary to use the prefix key,
1888.Ar command
1889is bound to
1890.Ar key
1891alone.
1892The
1893.Fl r
1894flag indicates this key may repeat, see the
1895.Ic repeat-time
1896option.
1897.Pp
1898If
1899.Fl t
1900is present,
1901.Ar key
1902is bound in
1903.Ar key-table :
1904the binding for command mode with
1905.Fl c
1906or for normal mode without.
1907To view the default bindings and possible commands, see the
1908.Ic list-keys
1909command.
1910.It Ic list-keys Op Fl t Ar key-table
1911.D1 (alias: Ic lsk )
1912List all key bindings.
1913Without
1914.Fl t
1915the primary key bindings - those executed when preceded by the prefix key -
1916are printed.
1917.Pp
1918With
1919.Fl t ,
1920the key bindings in
1921.Ar key-table
1922are listed; this may be one of:
1923.Em vi-edit ,
1924.Em emacs-edit ,
1925.Em vi-choice ,
1926.Em emacs-choice ,
1927.Em vi-copy
1928or
1929.Em emacs-copy .
1930.It Xo Ic send-keys
1931.Op Fl lR
1932.Op Fl t Ar target-pane
1933.Ar key Ar ...
1934.Xc
1935.D1 (alias: Ic send )
1936Send a key or keys to a window.
1937Each argument
1938.Ar key
1939is the name of the key (such as
1940.Ql C-a
1941or
1942.Ql npage
1943) to send; if the string is not recognised as a key, it is sent as a series of
1944characters.
1945The
1946.Fl l
1947flag disables key name lookup and sends the keys literally.
1948All arguments are sent sequentially from first to last.
1949The
1950.Fl R
1951flag causes the terminal state to be reset.
1952.It Xo Ic send-prefix
1953.Op Fl 2
1954.Op Fl t Ar target-pane
1955.Xc
1956Send the prefix key, or with
1957.Fl 2
1958the secondary prefix key, to a window as if it was pressed.
1959.It Xo Ic unbind-key
1960.Op Fl acn
1961.Op Fl t Ar key-table
1962.Ar key
1963.Xc
1964.D1 (alias: Ic unbind )
1965Unbind the command bound to
1966.Ar key .
1967Without
1968.Fl t
1969the primary key bindings are modified; in this case, if
1970.Fl n
1971is specified, the command bound to
1972.Ar key
1973without a prefix (if any) is removed.
1974If
1975.Fl a
1976is present, all key bindings are removed.
1977.Pp
1978If
1979.Fl t
1980is present,
1981.Ar key
1982in
1983.Ar key-table
1984is unbound: the binding for command mode with
1985.Fl c
1986or for normal mode without.
1987.El
1988.Sh OPTIONS
1989The appearance and behaviour of
1990.Nm
1991may be modified by changing the value of various options.
1992There are three types of option:
1993.Em server options ,
1994.Em session options
1995and
1996.Em window options .
1997.Pp
1998The
1999.Nm
2000server has a set of global options which do not apply to any particular
2001window or session.
2002These are altered with the
2003.Ic set-option
2004.Fl s
2005command, or displayed with the
2006.Ic show-options
2007.Fl s
2008command.
2009.Pp
2010In addition, each individual session may have a set of session options, and
2011there is a separate set of global session options.
2012Sessions which do not have a particular option configured inherit the value
2013from the global session options.
2014Session options are set or unset with the
2015.Ic set-option
2016command and may be listed with the
2017.Ic show-options
2018command.
2019The available server and session options are listed under the
2020.Ic set-option
2021command.
2022.Pp
2023Similarly, a set of window options is attached to each window, and there is
2024a set of global window options from which any unset options are inherited.
2025Window options are altered with the
2026.Ic set-window-option
2027command and can be listed with the
2028.Ic show-window-options
2029command.
2030All window options are documented with the
2031.Ic set-window-option
2032command.
2033.Pp
2034.Nm
2035also supports user options which are prefixed with a
2036.Ql \&@ .
2037User options may have any name, so long as they are prefixed with
2038.Ql \&@ ,
2039and be set to any string.
2040For example
2041.Bd -literal -offset indent
2042$ tmux setw -q @foo "abc123"
2043$ tmux showw -v @foo
2044abc123
2045.Ed
2046.Pp
2047Commands which set options are as follows:
2048.Bl -tag -width Ds
2049.It Xo Ic set-option
2050.Op Fl agoqsuw
2051.Op Fl t Ar target-session | Ar target-window
2052.Ar option Ar value
2053.Xc
2054.D1 (alias: Ic set )
2055Set a window option with
2056.Fl w
2057(equivalent to the
2058.Ic set-window-option
2059command),
2060a server option with
2061.Fl s ,
2062otherwise a session option.
2063.Pp
2064If
2065.Fl g
2066is specified, the global session or window option is set.
2067The
2068.Fl u
2069flag unsets an option, so a session inherits the option from the global
2070options.
2071It is not possible to unset a global option.
2072.Pp
2073The
2074.Fl o
2075flag prevents setting an option that is already set.
2076.Pp
2077The
2078.Fl q
2079flag suppresses the informational message (as if the
2080.Ic quiet
2081server option was set).
2082.Pp
2083With
2084.Fl a ,
2085and if the option expects a string or a style,
2086.Ar value
2087is appended to the existing setting.
2088For example:
2089.Bd -literal -offset indent
2090set -g status-left "foo"
2091set -ag status-left "bar"
2092.Ed
2093.Pp
2094Will result in
2095.Ql foobar .
2096And:
2097.Bd -literal -offset indent
2098set -g status-style "bg=red"
2099set -ag status-style "fg=blue"
2100.Ed
2101.Pp
2102Will result in a red background
2103.Em and
2104blue foreground.
2105Without
2106.Fl a ,
2107the result would be the default background and a blue foreground.
2108.Pp
2109Available window options are listed under
2110.Ic set-window-option .
2111.Pp
2112.Ar value
2113depends on the option and may be a number, a string, or a flag (on, off, or
2114omitted to toggle).
2115.Pp
2116Available server options are:
2117.Bl -tag -width Ds
2118.It Ic buffer-limit Ar number
2119Set the number of buffers; as new buffers are added to the top of the stack,
2120old ones are removed from the bottom if necessary to maintain this maximum
2121length.
2122.It Ic escape-time Ar time
2123Set the time in milliseconds for which
2124.Nm
2125waits after an escape is input to determine if it is part of a function or meta
2126key sequences.
2127The default is 500 milliseconds.
2128.It Xo Ic exit-unattached
2129.Op Ic on | off
2130.Xc
2131If enabled, the server will exit when there are no attached clients.
2132.It Xo Ic focus-events
2133.Op Ic on | off
2134.Xc
2135When enabled, focus events are requested from the terminal if supported and
2136passed through to applications running in
2137.Nm .
2138Attached clients should be detached and attached again after changing this
2139option.
2140.It Xo Ic quiet
2141.Op Ic on | off
2142.Xc
2143Enable or disable the display of various informational messages (see also the
2144.Fl q
2145command line flag).
2146.It Xo Ic set-clipboard
2147.Op Ic on | off
2148.Xc
2149Attempt to set the terminal clipboard content using the
2150\ee]52;...\e007
2151.Xr xterm 1
2152escape sequences.
2153This option is on by default if there is an
2154.Em \&Ms
2155entry in the
2156.Xr terminfo 5
2157description for the client terminal.
2158Note that this feature needs to be enabled in
2159.Xr xterm 1
2160by setting the resource:
2161.Bd -literal -offset indent
2162disallowedWindowOps: 20,21,SetXprop
2163.Ed
2164.Pp
2165Or changing this property from the
2166.Xr xterm 1
2167interactive menu when required.
2168.El
2169.Pp
2170Available session options are:
2171.Bl -tag -width Ds
2172.It Ic assume-paste-time Ar milliseconds
2173If keys are entered faster than one in
2174.Ar milliseconds ,
2175they are assumed to have been pasted rather than typed and
2176.Nm
2177key bindings are not processed.
2178The default is one millisecond and zero disables.
2179.It Ic base-index Ar index
2180Set the base index from which an unused index should be searched when a new
2181window is created.
2182The default is zero.
2183.It Xo Ic bell-action
2184.Op Ic any | none | current
2185.Xc
2186Set action on window bell.
2187.Ic any
2188means a bell in any window linked to a session causes a bell in the current
2189window of that session,
2190.Ic none
2191means all bells are ignored and
2192.Ic current
2193means only bells in windows other than the current window are ignored.
2194.It Xo Ic bell-on-alert
2195.Op Ic on | off
2196.Xc
2197If on, ring the terminal bell when an alert
2198occurs.
2199.It Ic default-command Ar shell-command
2200Set the command used for new windows (if not specified when the window is
2201created) to
2202.Ar shell-command ,
2203which may be any
2204.Xr sh 1
2205command.
2206The default is an empty string, which instructs
2207.Nm
2208to create a login shell using the value of the
2209.Ic default-shell
2210option.
2211.It Ic default-shell Ar path
2212Specify the default shell.
2213This is used as the login shell for new windows when the
2214.Ic default-command
2215option is set to empty, and must be the full path of the executable.
2216When started
2217.Nm
2218tries to set a default value from the first suitable of the
2219.Ev SHELL
2220environment variable, the shell returned by
2221.Xr getpwuid 3 ,
2222or
2223.Pa /bin/sh .
2224This option should be configured when
2225.Nm
2226is used as a login shell.
2227.It Ic default-terminal Ar terminal
2228Set the default terminal for new windows created in this session - the
2229default value of the
2230.Ev TERM
2231environment variable.
2232For
2233.Nm
2234to work correctly, this
2235.Em must
2236be set to
2237.Ql screen
2238or a derivative of it.
2239.It Xo Ic destroy-unattached
2240.Op Ic on | off
2241.Xc
2242If enabled and the session is no longer attached to any clients, it is
2243destroyed.
2244.It Xo Ic detach-on-destroy
2245.Op Ic on | off
2246.Xc
2247If on (the default), the client is detached when the session it is attached to
2248is destroyed.
2249If off, the client is switched to the most recently active of the remaining
2250sessions.
2251.It Ic display-panes-active-colour Ar colour
2252Set the colour used by the
2253.Ic display-panes
2254command to show the indicator for the active pane.
2255.It Ic display-panes-colour Ar colour
2256Set the colour used by the
2257.Ic display-panes
2258command to show the indicators for inactive panes.
2259.It Ic display-panes-time Ar time
2260Set the time in milliseconds for which the indicators shown by the
2261.Ic display-panes
2262command appear.
2263.It Ic display-time Ar time
2264Set the amount of time for which status line messages and other on-screen
2265indicators are displayed.
2266.Ar time
2267is in milliseconds.
2268.It Ic history-limit Ar lines
2269Set the maximum number of lines held in window history.
2270This setting applies only to new windows - existing window histories are not
2271resized and retain the limit at the point they were created.
2272.It Ic lock-after-time Ar number
2273Lock the session (like the
2274.Ic lock-session
2275command) after
2276.Ar number
2277seconds of inactivity, or the entire server (all sessions) if the
2278.Ic lock-server
2279option is set.
2280The default is not to lock (set to 0).
2281.It Ic lock-command Ar shell-command
2282Command to run when locking each client.
2283The default is to run
2284.Xr lock 1
2285with
2286.Fl np .
2287.It Xo Ic lock-server
2288.Op Ic on | off
2289.Xc
2290If this option is
2291.Ic on
2292(the default),
2293instead of each session locking individually as each has been
2294idle for
2295.Ic lock-after-time ,
2296the entire server will lock after
2297.Em all
2298sessions would have locked.
2299This has no effect as a session option; it must be set as a global option.
2300.It Ic message-command-style Ar style
2301Set status line message command style, where
2302.Ar style
2303is a comma-separated list of characteristics to be specified.
2304.Pp
2305These may be
2306.Ql bg=colour
2307to set the background colour,
2308.Ql fg=colour
2309to set the foreground colour, and a list of attributes as specified below.
2310.Pp
2311The colour is one of:
2312.Ic black ,
2313.Ic red ,
2314.Ic green ,
2315.Ic yellow ,
2316.Ic blue ,
2317.Ic magenta ,
2318.Ic cyan ,
2319.Ic white ,
2320aixterm bright variants (if supported:
2321.Ic brightred ,
2322.Ic brightgreen ,
2323and so on),
2324.Ic colour0
2325to
2326.Ic colour255
2327from the 256-colour set,
2328.Ic default ,
2329or a hexadecimal RGB string such as
2330.Ql #ffffff ,
2331which chooses the closest match from the default 256-colour set.
2332.Pp
2333The attributes is either
2334.Ic none
2335or a comma-delimited list of one or more of:
2336.Ic bright
2337(or
2338.Ic bold ) ,
2339.Ic dim ,
2340.Ic underscore ,
2341.Ic blink ,
2342.Ic reverse ,
2343.Ic hidden ,
2344or
2345.Ic italics ,
2346to turn an attribute on, or an attribute prefixed with
2347.Ql no
2348to turn one off.
2349.Pp
2350Examples are:
2351.Bd -literal -offset indent
2352fg=yellow,bold,underscore,blink
2353bg=black,fg=default,noreverse
2354.Ed
2355.Pp
2356With the
2357.Fl a
2358flag to the
2359.Ic set-option
2360command the new style is added otherwise the existing style is replaced.
2361.It Ic message-limit Ar number
2362Set the number of error or information messages to save in the message log for
2363each client.
2364The default is 20.
2365.It Ic message-style Ar style
2366Set status line message style.
2367For how to specify
2368.Ar style ,
2369see the
2370.Ic message-command-style
2371option.
2372.It Xo Ic mouse-resize-pane
2373.Op Ic on | off
2374.Xc
2375If on,
2376.Nm
2377captures the mouse and allows panes to be resized by dragging on their borders.
2378.It Xo Ic mouse-select-pane
2379.Op Ic on | off
2380.Xc
2381If on,
2382.Nm
2383captures the mouse and when a window is split into multiple panes the mouse may
2384be used to select the current pane.
2385The mouse click is also passed through to the application as normal.
2386.It Xo Ic mouse-select-window
2387.Op Ic on | off
2388.Xc
2389If on, clicking the mouse on a window name in the status line will select that
2390window.
2391.It Xo Ic mouse-utf8
2392.Op Ic on | off
2393.Xc
2394If enabled, request mouse input as UTF-8 on UTF-8 terminals.
2395.It Ic pane-active-border-style Ar style
2396Set the pane border style for the currently active pane.
2397For how to specify
2398.Ar style ,
2399see the
2400.Ic message-command-style
2401option.
2402Attributes are ignored.
2403.It Ic pane-border-style Ar style
2404Set the pane border style for paneas aside from the active pane.
2405For how to specify
2406.Ar style ,
2407see the
2408.Ic message-command-style
2409option.
2410Attributes are ignored.
2411.It Ic prefix Ar key
2412Set the key accepted as a prefix key.
2413.It Ic prefix2 Ar key
2414Set a secondary key accepted as a prefix key.
2415.It Xo Ic renumber-windows
2416.Op Ic on | off
2417.Xc
2418If on, when a window is closed in a session, automatically renumber the other
2419windows in numerical order.
2420This respects the
2421.Ic base-index
2422option if it has been set.
2423If off, do not renumber the windows.
2424.It Ic repeat-time Ar time
2425Allow multiple commands to be entered without pressing the prefix-key again
2426in the specified
2427.Ar time
2428milliseconds (the default is 500).
2429Whether a key repeats may be set when it is bound using the
2430.Fl r
2431flag to
2432.Ic bind-key .
2433Repeat is enabled for the default keys bound to the
2434.Ic resize-pane
2435command.
2436.It Xo Ic set-remain-on-exit
2437.Op Ic on | off
2438.Xc
2439Set the
2440.Ic remain-on-exit
2441window option for any windows first created in this session.
2442When this option is true, windows in which the running program has
2443exited do not close, instead remaining open but inactivate.
2444Use the
2445.Ic respawn-window
2446command to reactivate such a window, or the
2447.Ic kill-window
2448command to destroy it.
2449.It Xo Ic set-titles
2450.Op Ic on | off
2451.Xc
2452Attempt to set the client terminal title using the
2453.Em tsl
2454and
2455.Em fsl
2456.Xr terminfo 5
2457entries if they exist.
2458.Nm
2459automatically sets these to the \ee]2;...\e007 sequence if
2460the terminal appears to be an xterm.
2461This option is off by default.
2462Note that elinks
2463will only attempt to set the window title if the STY environment
2464variable is set.
2465.It Ic set-titles-string Ar string
2466String used to set the window title if
2467.Ic set-titles
2468is on.
2469Character sequences are replaced as for the
2470.Ic status-left
2471option.
2472.It Xo Ic status
2473.Op Ic on | off
2474.Xc
2475Show or hide the status line.
2476.It Ic status-interval Ar interval
2477Update the status bar every
2478.Ar interval
2479seconds.
2480By default, updates will occur every 15 seconds.
2481A setting of zero disables redrawing at interval.
2482.It Xo Ic status-justify
2483.Op Ic left | centre | right
2484.Xc
2485Set the position of the window list component of the status line: left, centre
2486or right justified.
2487.It Xo Ic status-keys
2488.Op Ic vi | emacs
2489.Xc
2490Use vi or emacs-style
2491key bindings in the status line, for example at the command prompt.
2492The default is emacs, unless the
2493.Ev VISUAL
2494or
2495.Ev EDITOR
2496environment variables are set and contain the string
2497.Ql vi .
2498.It Ic status-left Ar string
2499Display
2500.Ar string
2501(by default the session name) to the left of the status bar.
2502.Ar string
2503will be passed through
2504.Xr strftime 3
2505and formats (see
2506.Sx FORMATS )
2507will be expanded.
2508It may also contain any of the following special character sequences:
2509.Bl -column "Character pair" "Replaced with" -offset indent
2510.It Sy "Character pair" Ta Sy "Replaced with"
2511.It Li "#(shell-command)" Ta "First line of the command's output"
2512.It Li "#[attributes]" Ta "Colour or attribute change"
2513.It Li "##" Ta "A literal" Ql #
2514.El
2515.Pp
2516The #(shell-command) form executes
2517.Ql shell-command
2518and inserts the first line of its output.
2519Note that shell commands are only executed once at the interval specified by
2520the
2521.Ic status-interval
2522option: if the status line is redrawn in the meantime, the previous result is
2523used.
2524Shell commands are executed with the
2525.Nm
2526global environment set (see the
2527.Sx ENVIRONMENT
2528section).
2529.Pp
2530For details on how the names and titles can be set see the
2531.Sx "NAMES AND TITLES"
2532section.
2533For a list of allowed attributes see the
2534.Ic message-command-style
2535option.
2536.Pp
2537Examples are:
2538.Bd -literal -offset indent
2539#(sysctl vm.loadavg)
2540#[fg=yellow,bold]#(apm -l)%%#[default] [#S]
2541.Ed
2542.Pp
2543Where appropriate, special character sequences may be prefixed with a number to
2544specify the maximum length, for example
2545.Ql #24T .
2546.Pp
2547By default, UTF-8 in
2548.Ar string
2549is not interpreted, to enable UTF-8, use the
2550.Ic status-utf8
2551option.
2552.It Ic status-left-length Ar length
2553Set the maximum
2554.Ar length
2555of the left component of the status bar.
2556The default is 10.
2557.It Ic status-left-style Ar style
2558Set the style of the left part of the status line.
2559For how to specify
2560.Ar style ,
2561see the
2562.Ic message-command-style
2563option.
2564.It Xo Ic status-position
2565.Op Ic top | bottom
2566.Xc
2567Set the position of the status line.
2568.It Ic status-right Ar string
2569Display
2570.Ar string
2571to the right of the status bar.
2572By default, the current window title in double quotes, the date and the time
2573are shown.
2574As with
2575.Ic status-left ,
2576.Ar string
2577will be passed to
2578.Xr strftime 3 ,
2579character pairs are replaced, and UTF-8 is dependent on the
2580.Ic status-utf8
2581option.
2582.It Ic status-right-length Ar length
2583Set the maximum
2584.Ar length
2585of the right component of the status bar.
2586The default is 40.
2587.It Ic status-right-style Ar style
2588Set the style of the right part of the status line.
2589For how to specify
2590.Ar style ,
2591see the
2592.Ic message-command-style
2593option.
2594.It Ic status-style Ar style
2595Set status line style.
2596For how to specify
2597.Ar style ,
2598see the
2599.Ic message-command-style
2600option.
2601.It Xo Ic status-utf8
2602.Op Ic on | off
2603.Xc
2604Instruct
2605.Nm
2606to treat top-bit-set characters in the
2607.Ic status-left
2608and
2609.Ic status-right
2610strings as UTF-8; notably, this is important for wide characters.
2611This option defaults to off.
2612.It Ic terminal-overrides Ar string
2613Contains a list of entries which override terminal descriptions read using
2614.Xr terminfo 5 .
2615.Ar string
2616is a comma-separated list of items each a colon-separated string made up of a
2617terminal type pattern (matched using
2618.Xr fnmatch 3 )
2619and a set of
2620.Em name=value
2621entries.
2622.Pp
2623For example, to set the
2624.Ql clear
2625.Xr terminfo 5
2626entry to
2627.Ql \ee[H\ee[2J
2628for all terminal types and the
2629.Ql dch1
2630entry to
2631.Ql \ee[P
2632for the
2633.Ql rxvt
2634terminal type, the option could be set to the string:
2635.Bd -literal -offset indent
2636"*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
2637.Ed
2638.Pp
2639The terminal entry value is passed through
2640.Xr strunvis 3
2641before interpretation.
2642The default value forcibly corrects the
2643.Ql colors
2644entry for terminals which support 256 colours:
2645.Bd -literal -offset indent
2646"*256col*:colors=256,xterm*:XT"
2647.Ed
2648.It Ic update-environment Ar variables
2649Set a space-separated string containing a list of environment variables to be
2650copied into the session environment when a new session is created or an
2651existing session is attached.
2652Any variables that do not exist in the source environment are set to be
2653removed from the session environment (as if
2654.Fl r
2655was given to the
2656.Ic set-environment
2657command).
2658The default is
2659"DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
2660XAUTHORITY".
2661.It Xo Ic visual-activity
2662.Op Ic on | off
2663.Xc
2664If on, display a status line message when activity occurs in a window
2665for which the
2666.Ic monitor-activity
2667window option is enabled.
2668.It Xo Ic visual-bell
2669.Op Ic on | off
2670.Xc
2671If this option is on, a message is shown on a bell instead of it being passed
2672through to the terminal (which normally makes a sound).
2673Also see the
2674.Ic bell-action
2675option.
2676.It Xo Ic visual-content
2677.Op Ic on | off
2678.Xc
2679Like
2680.Ic visual-activity ,
2681display a message when content is present in a window
2682for which the
2683.Ic monitor-content
2684window option is enabled.
2685.It Xo Ic visual-silence
2686.Op Ic on | off
2687.Xc
2688If
2689.Ic monitor-silence
2690is enabled, prints a message after the interval has expired on a given window.
2691.It Ic word-separators Ar string
2692Sets the session's conception of what characters are considered word
2693separators, for the purposes of the next and previous word commands in
2694copy mode.
2695The default is
2696.Ql \ -_@ .
2697.El
2698.It Xo Ic set-window-option
2699.Op Fl agoqu
2700.Op Fl t Ar target-window
2701.Ar option Ar value
2702.Xc
2703.D1 (alias: Ic setw )
2704Set a window option.
2705The
2706.Fl a ,
2707.Fl g ,
2708.Fl o ,
2709.Fl q
2710and
2711.Fl u
2712flags work similarly to the
2713.Ic set-option
2714command.
2715.Pp
2716Supported window options are:
2717.Pp
2718.Bl -tag -width Ds -compact
2719.It Xo Ic aggressive-resize
2720.Op Ic on | off
2721.Xc
2722Aggressively resize the chosen window.
2723This means that
2724.Nm
2725will resize the window to the size of the smallest session for which it is the
2726current window, rather than the smallest session to which it is attached.
2727The window may resize when the current window is changed on another sessions;
2728this option is good for full-screen programs which support
2729.Dv SIGWINCH
2730and poor for interactive programs such as shells.
2731.Pp
2732.It Xo Ic allow-rename
2733.Op Ic on | off
2734.Xc
2735Allow programs to change the window name using a terminal escape
2736sequence (\\033k...\\033\\\\).
2737The default is on.
2738.Pp
2739.It Xo Ic alternate-screen
2740.Op Ic on | off
2741.Xc
2742This option configures whether programs running inside
2743.Nm
2744may use the terminal alternate screen feature, which allows the
2745.Em smcup
2746and
2747.Em rmcup
2748.Xr terminfo 5
2749capabilities.
2750The alternate screen feature preserves the contents of the window when an
2751interactive application starts and restores it on exit, so that any output
2752visible before the application starts reappears unchanged after it exits.
2753The default is on.
2754.Pp
2755.It Xo Ic automatic-rename
2756.Op Ic on | off
2757.Xc
2758Control automatic window renaming.
2759When this setting is enabled,
2760.Nm
2761will rename the window automatically using the format specified by
2762.Ic automatic-rename-format .
2763This flag is automatically disabled for an individual window when a name
2764is specified at creation with
2765.Ic new-window
2766or
2767.Ic new-session ,
2768or later with
2769.Ic rename-window ,
2770or with a terminal escape sequence.
2771It may be switched off globally with:
2772.Bd -literal -offset indent
2773set-window-option -g automatic-rename off
2774.Ed
2775.Pp
2776.It Ic automatic-rename-format Ar format
2777The format (see
2778.Sx FORMATS )
2779used when the
2780.Ic automatic-rename
2781option is enabled.
2782.Pp
2783.It Ic c0-change-interval Ar interval
2784.It Ic c0-change-trigger Ar trigger
2785These two options configure a simple form of rate limiting for a pane.
2786If
2787.Nm
2788sees more than
2789.Ar trigger
2790C0 sequences that modify the screen (for example, carriage returns, linefeeds
2791or backspaces) in one millisecond, it will stop updating the pane immediately and
2792instead redraw it entirely every
2793.Ar interval
2794milliseconds.
2795This helps to prevent fast output (such as
2796.Xr yes 1 )
2797overwhelming the terminal.
2798The default is a trigger of 250 and an interval of 100.
2799A trigger of zero disables the rate limiting.
2800.Pp
2801.It Ic clock-mode-colour Ar colour
2802Set clock colour.
2803.Pp
2804.It Xo Ic clock-mode-style
2805.Op Ic 12 | 24
2806.Xc
2807Set clock hour format.
2808.Pp
2809.It Ic force-height Ar height
2810.It Ic force-width Ar width
2811Prevent
2812.Nm
2813from resizing a window to greater than
2814.Ar width
2815or
2816.Ar height .
2817A value of zero restores the default unlimited setting.
2818.Pp
2819.It Ic main-pane-height Ar height
2820.It Ic main-pane-width Ar width
2821Set the width or height of the main (left or top) pane in the
2822.Ic main-horizontal
2823or
2824.Ic main-vertical
2825layouts.
2826.Pp
2827.It Xo Ic mode-keys
2828.Op Ic vi | emacs
2829.Xc
2830Use vi or emacs-style key bindings in copy and choice modes.
2831As with the
2832.Ic status-keys
2833option, the default is emacs, unless
2834.Ev VISUAL
2835or
2836.Ev EDITOR
2837contains
2838.Ql vi .
2839.Pp
2840.It Xo Ic mode-mouse
2841.Op Ic on | off | copy-mode
2842.Xc
2843Mouse state in modes.
2844If on, the mouse may be used to enter copy mode and copy a selection by
2845dragging, to enter copy mode and scroll with the mouse wheel, or to select an
2846option in choice mode.
2847If set to
2848.Em copy-mode ,
2849the mouse behaves as set to on, but cannot be used to enter copy
2850mode.
2851.Pp
2852.It Ic mode-style Ar style
2853Set window modes style.
2854For how to specify
2855.Ar style ,
2856see the
2857.Ic message-command-style
2858option.
2859.Pp
2860.It Xo Ic monitor-activity
2861.Op Ic on | off
2862.Xc
2863Monitor for activity in the window.
2864Windows with activity are highlighted in the status line.
2865.Pp
2866.It Ic monitor-content Ar match-string
2867Monitor content in the window.
2868When
2869.Xr fnmatch 3
2870pattern
2871.Ar match-string
2872appears in the window, it is highlighted in the status line.
2873.Pp
2874.It Xo Ic monitor-silence
2875.Op Ic interval
2876.Xc
2877Monitor for silence (no activity) in the window within
2878.Ic interval
2879seconds.
2880Windows that have been silent for the interval are highlighted in the
2881status line.
2882An interval of zero disables the monitoring.
2883.Pp
2884.It Ic other-pane-height Ar height
2885Set the height of the other panes (not the main pane) in the
2886.Ic main-horizontal
2887layout.
2888If this option is set to 0 (the default), it will have no effect.
2889If both the
2890.Ic main-pane-height
2891and
2892.Ic other-pane-height
2893options are set, the main pane will grow taller to make the other panes the
2894specified height, but will never shrink to do so.
2895.Pp
2896.It Ic other-pane-width Ar width
2897Like
2898.Ic other-pane-height ,
2899but set the width of other panes in the
2900.Ic main-vertical
2901layout.
2902.Pp
2903.It Ic pane-base-index Ar index
2904Like
2905.Ic base-index ,
2906but set the starting index for pane numbers.
2907.Pp
2908.It Xo Ic remain-on-exit
2909.Op Ic on | off
2910.Xc
2911A window with this flag set is not destroyed when the program running in it
2912exits.
2913The window may be reactivated with the
2914.Ic respawn-window
2915command.
2916.Pp
2917.It Xo Ic synchronize-panes
2918.Op Ic on | off
2919.Xc
2920Duplicate input to any pane to all other panes in the same window (only
2921for panes that are not in any special mode).
2922.Pp
2923.It Xo Ic utf8
2924.Op Ic on | off
2925.Xc
2926Instructs
2927.Nm
2928to expect UTF-8 sequences to appear in this window.
2929.Pp
2930.It Ic window-status-activity-style Ar style
2931Set status line style for windows with an activity alert.
2932For how to specify
2933.Ar style ,
2934see the
2935.Ic message-command-style
2936option.
2937.Pp
2938.It Ic window-status-bell-style Ar style
2939Set status line style for windows with a bell alert.
2940For how to specify
2941.Ar style ,
2942see the
2943.Ic message-command-style
2944option.
2945.Pp
2946.It Ic window-status-content-style Ar style
2947Set status line style for windows with a content alert.
2948For how to specify
2949.Ar style ,
2950see the
2951.Ic message-command-style
2952option.
2953.Pp
2954.It Ic window-status-current-format Ar string
2955Like
2956.Ar window-status-format ,
2957but is the format used when the window is the current window.
2958.Pp
2959.It Ic window-status-current-style Ar style
2960Set status line style for the currently active window.
2961For how to specify
2962.Ar style ,
2963see the
2964.Ic message-command-style
2965option.
2966.Pp
2967.It Ic window-status-format Ar string
2968Set the format in which the window is displayed in the status line window list.
2969See the
2970.Ar status-left
2971option for details of special character sequences available.
2972The default is
2973.Ql #I:#W#F .
2974.Pp
2975.It Ic window-status-last-style Ar style
2976Set status line style for the last active window.
2977For how to specify
2978.Ar style ,
2979see the
2980.Ic message-command-style
2981option.
2982.Pp
2983.It Ic window-status-separator Ar string
2984Sets the separator drawn between windows in the status line.
2985The default is a single space character.
2986.Pp
2987.It Ic window-status-style Ar style
2988Set status line style for a single window.
2989For how to specify
2990.Ar style ,
2991see the
2992.Ic message-command-style
2993option.
2994.Pp
2995.It Xo Ic xterm-keys
2996.Op Ic on | off
2997.Xc
2998If this option is set,
2999.Nm
3000will generate
3001.Xr xterm 1 -style
3002function key sequences; these have a number included to indicate modifiers such
3003as Shift, Alt or Ctrl.
3004The default is off.
3005.Pp
3006.It Xo Ic wrap-search
3007.Op Ic on | off
3008.Xc
3009If this option is set, searches will wrap around the end of the pane contents.
3010The default is on.
3011.El
3012.It Xo Ic show-options
3013.Op Fl gqsvw
3014.Op Fl t Ar target-session | Ar target-window
3015.Op Ar option
3016.Xc
3017.D1 (alias: Ic show )
3018Show the window options (or a single window option if given) with
3019.Fl w
3020(equivalent to
3021.Ic show-window-options ) ,
3022the server options with
3023.Fl s ,
3024otherwise the session options for
3025.Ar target session .
3026Global session or window options are listed if
3027.Fl g
3028is used.
3029.Fl v
3030shows only the option value, not the name.
3031If
3032.Fl q
3033is set, no error will be returned if
3034.Ar option
3035is unset.
3036.It Xo Ic show-window-options
3037.Op Fl gv
3038.Op Fl t Ar target-window
3039.Op Ar option
3040.Xc
3041.D1 (alias: Ic showw )
3042List the window options or a single option for
3043.Ar target-window ,
3044or the global window options if
3045.Fl g
3046is used.
3047.Fl v
3048shows only the option value, not the name.
3049.El
3050.Sh FORMATS
3051Certain commands accept the
3052.Fl F
3053flag with a
3054.Ar format
3055argument.
3056This is a string which controls the output format of the command.
3057Replacement variables are enclosed in
3058.Ql #{
3059and
3060.Ql } ,
3061for example
3062.Ql #{session_name} .
3063Some variables also have an shorter alias such as
3064.Ql #S .
3065.Ql ##
3066is replaced by a single
3067.Ql # .
3068Conditionals are also accepted by prefixing with
3069.Ql \&?
3070and separating two alternatives with a comma;
3071if the specified variable exists and is not zero, the first alternative
3072is chosen, otherwise the second is used.
3073For example
3074.Ql #{?session_attached,attached,not attached}
3075will include the string
3076.Ql attached
3077if the session is attached and the string
3078.Ql not attached
3079if it is unattached.
3080A limit may be placed on the length of the resultant string by prefixing it
3081by an
3082.Ql = ,
3083a number and a colon, so
3084.Ql #{=10:pane_title}
3085will include at most the first 10 characters of the pane title.
3086.Pp
3087The following variables are available, where appropriate:
3088.Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX"
3089.It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with"
3090.It Li "alternate_on" Ta "" Ta "If pane is in alternate screen"
3091.It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen"
3092.It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen"
3093.It Li "buffer_sample" Ta "" Ta "First 50 characters from buffer"
3094.It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes"
3095.It Li "client_activity" Ta "" Ta "Integer time client last had activity"
3096.It Li "client_activity_string" Ta "" Ta "String time client last had activity"
3097.It Li "client_created" Ta "" Ta "Integer time client created"
3098.It Li "client_created_string" Ta "" Ta "String time client created"
3099.It Li "client_height" Ta "" Ta "Height of client"
3100.It Li "client_last_session" Ta "" Ta "Name of the client's last session"
3101.It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed"
3102.It Li "client_readonly" Ta "" Ta "1 if client is readonly"
3103.It Li "client_session" Ta "" Ta "Name of the client's session"
3104.It Li "client_termname" Ta "" Ta "Terminal name of client"
3105.It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
3106.It Li "client_utf8" Ta "" Ta "1 if client supports utf8"
3107.It Li "client_width" Ta "" Ta "Width of client"
3108.It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
3109.It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
3110.It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"
3111.It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
3112.It Li "history_limit" Ta "" Ta "Maximum window history lines"
3113.It Li "history_size" Ta "" Ta "Size of history in bytes"
3114.It Li "host" Ta "#H" Ta "Hostname of local host"
3115.It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)"
3116.It Li "insert_flag" Ta "" Ta "Pane insert flag"
3117.It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag"
3118.It Li "keypad_flag" Ta "" Ta "Pane keypad flag"
3119.It Li "line" Ta "" Ta "Line number in the list"
3120.It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag"
3121.It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag"
3122.It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
3123.It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
3124.It Li "pane_active" Ta "" Ta "1 if active pane"
3125.It Li "pane_current_command" Ta "" Ta "Current command if available"
3126.It Li "pane_current_path" Ta "" Ta "Current path if available"
3127.It Li "pane_dead" Ta "" Ta "1 if pane is dead"
3128.It Li "pane_height" Ta "" Ta "Height of pane"
3129.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
3130.It Li "pane_in_mode" Ta "" Ta "If pane is in a mode"
3131.It Li "pane_synchronized" Ta "" Ta "If pane is synchronized"
3132.It Li "pane_index" Ta "#P" Ta "Index of pane"
3133.It Li "pane_pid" Ta "" Ta "PID of first process in pane"
3134.It Li "pane_start_command" Ta "" Ta "Command pane started with"
3135.It Li "pane_start_path" Ta "" Ta "Path pane started with"
3136.It Li "pane_tabs" Ta "" Ta "Pane tab positions"
3137.It Li "pane_title" Ta "#T" Ta "Title of pane"
3138.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
3139.It Li "pane_width" Ta "" Ta "Width of pane"
3140.It Li "saved_cursor_x" Ta "" Ta "Saved cursor X in pane"
3141.It Li "saved_cursor_y" Ta "" Ta "Saved cursor Y in pane"
3142.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
3143.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
3144.It Li "session_attached" Ta "" Ta "1 if session attached"
3145.It Li "session_created" Ta "" Ta "Integer time session created"
3146.It Li "session_created_string" Ta "" Ta "String time session created"
3147.It Li "session_group" Ta "" Ta "Number of session group"
3148.It Li "session_grouped" Ta "" Ta "1 if session in a group"
3149.It Li "session_height" Ta "" Ta "Height of session"
3150.It Li "session_id" Ta "" Ta "Unique session ID"
3151.It Li "session_name" Ta "#S" Ta "Name of session"
3152.It Li "session_width" Ta "" Ta "Width of session"
3153.It Li "session_windows" Ta "" Ta "Number of windows in session"
3154.It Li "window_active" Ta "" Ta "1 if window active"
3155.It Li "window_activity_flag" Ta "" Ta "1 if window has activity alert"
3156.It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
3157.It Li "window_content_flag" Ta "" Ta "1 if window has content alert"
3158.It Li "window_find_matches" Ta "" Ta "Matched data from the find-window"
3159.It Li "window_flags" Ta "#F" Ta "Window flags"
3160.It Li "window_height" Ta "" Ta "Height of window"
3161.It Li "window_id" Ta "" Ta "Unique window ID"
3162.It Li "window_index" Ta "#I" Ta "Index of window"
3163.It Li "window_layout" Ta "" Ta "Window layout description"
3164.It Li "window_name" Ta "#W" Ta "Name of window"
3165.It Li "window_panes" Ta "" Ta "Number of panes in window"
3166.It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
3167.It Li "window_width" Ta "" Ta "Width of window"
3168.It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
3169.El
3170.Sh NAMES AND TITLES
3171.Nm
3172distinguishes between names and titles.
3173Windows and sessions have names, which may be used to specify them in targets
3174and are displayed in the status line and various lists: the name is the
3175.Nm
3176identifier for a window or session.
3177Only panes have titles.
3178A pane's title is typically set by the program running inside the pane and
3179is not modified by
3180.Nm .
3181It is the same mechanism used to set for example the
3182.Xr xterm 1
3183window title in an
3184.Xr X 7
3185window manager.
3186Windows themselves do not have titles - a window's title is the title of its
3187active pane.
3188.Nm
3189itself may set the title of the terminal in which the client is running, see
3190the
3191.Ic set-titles
3192option.
3193.Pp
3194A session's name is set with the
3195.Ic new-session
3196and
3197.Ic rename-session
3198commands.
3199A window's name is set with one of:
3200.Bl -enum -width Ds
3201.It
3202A command argument (such as
3203.Fl n
3204for
3205.Ic new-window
3206or
3207.Ic new-session ) .
3208.It
3209An escape sequence:
3210.Bd -literal -offset indent
3211$ printf '\e033kWINDOW_NAME\e033\e\e'
3212.Ed
3213.It
3214Automatic renaming, which sets the name to the active command in the window's
3215active pane.
3216See the
3217.Ic automatic-rename
3218option.
3219.El
3220.Pp
3221When a pane is first created, its title is the hostname.
3222A pane's title can be set via the OSC title setting sequence, for example:
3223.Bd -literal -offset indent
3224$ printf '\e033]2;My Title\e033\e\e'
3225.Ed
3226.Sh ENVIRONMENT
3227When the server is started,
3228.Nm
3229copies the environment into the
3230.Em global environment ;
3231in addition, each session has a
3232.Em session environment .
3233When a window is created, the session and global environments are merged.
3234If a variable exists in both, the value from the session environment is used.
3235The result is the initial environment passed to the new process.
3236.Pp
3237The
3238.Ic update-environment
3239session option may be used to update the session environment from the client
3240when a new session is created or an old reattached.
3241.Nm
3242also initialises the
3243.Ev TMUX
3244variable with some internal information to allow commands to be executed
3245from inside, and the
3246.Ev TERM
3247variable with the correct terminal setting of
3248.Ql screen .
3249.Pp
3250Commands to alter and view the environment are:
3251.Bl -tag -width Ds
3252.It Xo Ic set-environment
3253.Op Fl gru
3254.Op Fl t Ar target-session
3255.Ar name Op Ar value
3256.Xc
3257.D1 (alias: Ic setenv )
3258Set or unset an environment variable.
3259If
3260.Fl g
3261is used, the change is made in the global environment; otherwise, it is applied
3262to the session environment for
3263.Ar target-session .
3264The
3265.Fl u
3266flag unsets a variable.
3267.Fl r
3268indicates the variable is to be removed from the environment before starting a
3269new process.
3270.It Xo Ic show-environment
3271.Op Fl g
3272.Op Fl t Ar target-session
3273.Op Ar variable
3274.Xc
3275.D1 (alias: Ic showenv )
3276Display the environment for
3277.Ar target-session
3278or the global environment with
3279.Fl g .
3280If
3281.Ar variable
3282is omitted, all variables are shown.
3283Variables removed from the environment are prefixed with
3284.Ql - .
3285.El
3286.Sh STATUS LINE
3287.Nm
3288includes an optional status line which is displayed in the bottom line of each
3289terminal.
3290By default, the status line is enabled (it may be disabled with the
3291.Ic status
3292session option) and contains, from left-to-right: the name of the current
3293session in square brackets; the window list; the title of the active pane
3294in double quotes; and the time and date.
3295.Pp
3296The status line is made of three parts: configurable left and right sections
3297(which may contain dynamic content such as the time or output from a shell
3298command, see the
3299.Ic status-left ,
3300.Ic status-left-length ,
3301.Ic status-right ,
3302and
3303.Ic status-right-length
3304options below), and a central window list.
3305By default, the window list shows the index, name and (if any) flag of the
3306windows present in the current session in ascending numerical order.
3307It may be customised with the
3308.Ar window-status-format
3309and
3310.Ar window-status-current-format
3311options.
3312The flag is one of the following symbols appended to the window name:
3313.Bl -column "Symbol" "Meaning" -offset indent
3314.It Sy "Symbol" Ta Sy "Meaning"
3315.It Li "*" Ta "Denotes the current window."
3316.It Li "-" Ta "Marks the last window (previously selected)."
3317.It Li "#" Ta "Window is monitored and activity has been detected."
3318.It Li "!" Ta "A bell has occurred in the window."
3319.It Li "+" Ta "Window is monitored for content and it has appeared."
3320.It Li "~" Ta "The window has been silent for the monitor-silence interval."
3321.It Li "Z" Ta "The window's active pane is zoomed."
3322.El
3323.Pp
3324The # symbol relates to the
3325.Ic monitor-activity
3326and + to the
3327.Ic monitor-content
3328window options.
3329The window name is printed in inverted colours if an alert (bell, activity or
3330content) is present.
3331.Pp
3332The colour and attributes of the status line may be configured, the entire
3333status line using the
3334.Ic status-style
3335session option and individual windows using the
3336.Ic window-status-style
3337window option.
3338.Pp
3339The status line is automatically refreshed at interval if it has changed, the
3340interval may be controlled with the
3341.Ic status-interval
3342session option.
3343.Pp
3344Commands related to the status line are as follows:
3345.Bl -tag -width Ds
3346.It Xo Ic command-prompt
3347.Op Fl I Ar inputs
3348.Op Fl p Ar prompts
3349.Op Fl t Ar target-client
3350.Op Ar template
3351.Xc
3352Open the command prompt in a client.
3353This may be used from inside
3354.Nm
3355to execute commands interactively.
3356.Pp
3357If
3358.Ar template
3359is specified, it is used as the command.
3360If present,
3361.Fl I
3362is a comma-separated list of the initial text for each prompt.
3363If
3364.Fl p
3365is given,
3366.Ar prompts
3367is a comma-separated list of prompts which are displayed in order; otherwise
3368a single prompt is displayed, constructed from
3369.Ar template
3370if it is present, or
3371.Ql \&:
3372if not.
3373.Pp
3374Both
3375.Ar inputs
3376and
3377.Ar prompts
3378may contain the special character sequences supported by the
3379.Ic status-left
3380option.
3381.Pp
3382Before the command is executed, the first occurrence of the string
3383.Ql %%
3384and all occurrences of
3385.Ql %1
3386are replaced by the response to the first prompt, the second
3387.Ql %%
3388and all
3389.Ql %2
3390are replaced with the response to the second prompt, and so on for further
3391prompts.
3392Up to nine prompt responses may be replaced
3393.Po
3394.Ql %1
3395to
3396.Ql %9
3397.Pc .
3398.It Xo Ic confirm-before
3399.Op Fl p Ar prompt
3400.Op Fl t Ar target-client
3401.Ar command
3402.Xc
3403.D1 (alias: Ic confirm )
3404Ask for confirmation before executing
3405.Ar command .
3406If
3407.Fl p
3408is given,
3409.Ar prompt
3410is the prompt to display; otherwise a prompt is constructed from
3411.Ar command .
3412It may contain the special character sequences supported by the
3413.Ic status-left
3414option.
3415.Pp
3416This command works only from inside
3417.Nm .
3418.It Xo Ic display-message
3419.Op Fl p
3420.Op Fl c Ar target-client
3421.Op Fl t Ar target-pane
3422.Op Ar message
3423.Xc
3424.D1 (alias: Ic display )
3425Display a message.
3426If
3427.Fl p
3428is given, the output is printed to stdout, otherwise it is displayed in the
3429.Ar target-client
3430status line.
3431The format of
3432.Ar message
3433is described in the
3434.Sx FORMATS
3435section; information is taken from
3436.Ar target-pane
3437if
3438.Fl t
3439is given, otherwise the active pane for the session attached to
3440.Ar target-client .
3441.El
3442.Sh BUFFERS
3443.Nm
3444maintains a stack of
3445.Em paste buffers .
3446Up to the value of the
3447.Ic buffer-limit
3448option are kept; when a new buffer is added, the buffer at the bottom of the
3449stack is removed.
3450Buffers may be added using
3451.Ic copy-mode
3452or the
3453.Ic set-buffer
3454command, and pasted into a window using the
3455.Ic paste-buffer
3456command.
3457.Pp
3458A configurable history buffer is also maintained for each window.
3459By default, up to 2000 lines are kept; this can be altered with the
3460.Ic history-limit
3461option (see the
3462.Ic set-option
3463command above).
3464.Pp
3465The buffer commands are as follows:
3466.Bl -tag -width Ds
3467.It Xo
3468.Ic choose-buffer
3469.Op Fl F Ar format
3470.Op Fl t Ar target-window
3471.Op Ar template
3472.Xc
3473Put a window into buffer choice mode, where a buffer may be chosen
3474interactively from a list.
3475After a buffer is selected,
3476.Ql %%
3477is replaced by the buffer index in
3478.Ar template
3479and the result executed as a command.
3480If
3481.Ar template
3482is not given, "paste-buffer -b '%%'" is used.
3483For the meaning of the
3484.Fl F
3485flag, see the
3486.Sx FORMATS
3487section.
3488This command works only if at least one client is attached.
3489.It Ic clear-history Op Fl t Ar target-pane
3490.D1 (alias: Ic clearhist )
3491Remove and free the history for the specified pane.
3492.It Ic delete-buffer Op Fl b Ar buffer-index
3493.D1 (alias: Ic deleteb )
3494Delete the buffer at
3495.Ar buffer-index ,
3496or the top buffer if not specified.
3497.It Xo Ic list-buffers
3498.Op Fl F Ar format
3499.Xc
3500.D1 (alias: Ic lsb )
3501List the global buffers.
3502For the meaning of the
3503.Fl F
3504flag, see the
3505.Sx FORMATS
3506section.
3507.It Xo Ic load-buffer
3508.Op Fl b Ar buffer-index
3509.Ar path
3510.Xc
3511.D1 (alias: Ic loadb )
3512Load the contents of the specified paste buffer from
3513.Ar path .
3514.It Xo Ic paste-buffer
3515.Op Fl dpr
3516.Op Fl b Ar buffer-index
3517.Op Fl s Ar separator
3518.Op Fl t Ar target-pane
3519.Xc
3520.D1 (alias: Ic pasteb )
3521Insert the contents of a paste buffer into the specified pane.
3522If not specified, paste into the current one.
3523With
3524.Fl d ,
3525also delete the paste buffer from the stack.
3526When output, any linefeed (LF) characters in the paste buffer are replaced with
3527a separator, by default carriage return (CR).
3528A custom separator may be specified using the
3529.Fl s
3530flag.
3531The
3532.Fl r
3533flag means to do no replacement (equivalent to a separator of LF).
3534If
3535.Fl p
3536is specified, paste bracket control codes are inserted around the
3537buffer if the application has requested bracketed paste mode.
3538.It Xo Ic save-buffer
3539.Op Fl a
3540.Op Fl b Ar buffer-index
3541.Ar path
3542.Xc
3543.D1 (alias: Ic saveb )
3544Save the contents of the specified paste buffer to
3545.Ar path .
3546The
3547.Fl a
3548option appends to rather than overwriting the file.
3549.It Xo Ic set-buffer
3550.Op Fl b Ar buffer-index
3551.Ar data
3552.Xc
3553.D1 (alias: Ic setb )
3554Set the contents of the specified buffer to
3555.Ar data .
3556.It Xo Ic show-buffer
3557.Op Fl b Ar buffer-index
3558.Xc
3559.D1 (alias: Ic showb )
3560Display the contents of the specified buffer.
3561.El
3562.Sh MISCELLANEOUS
3563Miscellaneous commands are as follows:
3564.Bl -tag -width Ds
3565.It Ic clock-mode Op Fl t Ar target-pane
3566Display a large clock.
3567.It Xo Ic if-shell
3568.Op Fl b
3569.Op Fl t Ar target-pane
3570.Ar shell-command command
3571.Op Ar command
3572.Xc
3573.D1 (alias: Ic if )
3574Execute the first
3575.Ar command
3576if
3577.Ar shell-command
3578returns success or the second
3579.Ar command
3580otherwise.
3581Before being executed, shell-command is expanded using the rules specified in the
3582.Sx FORMATS
3583section, including those relevant to
3584.Ar target-pane .
3585With
3586.Fl b ,
3587.Ar shell-command
3588is run in the background.
3589.It Ic lock-server
3590.D1 (alias: Ic lock )
3591Lock each client individually by running the command specified by the
3592.Ic lock-command
3593option.
3594.It Xo Ic run-shell
3595.Op Fl b
3596.Op Fl t Ar target-pane
3597.Ar shell-command
3598.Xc
3599.D1 (alias: Ic run )
3600Execute
3601.Ar shell-command
3602in the background without creating a window.
3603Before being executed, shell-command is expanded using the rules specified in
3604the
3605.Sx FORMATS
3606section.
3607With
3608.Fl b ,
3609the command is run in the background.
3610After it finishes, any output to stdout is displayed in copy mode (in the pane
3611specified by
3612.Fl t
3613or the current pane if omitted).
3614If the command doesn't return success, the exit status is also displayed.
3615.It Xo Ic wait-for
3616.Op Fl L | S | U
3617.Ar channel
3618.Xc
3619.D1 (alias: Ic wait )
3620When used without options, prevents the client from exiting until woken using
3621.Ic wait-for
3622.Fl S
3623with the same channel.
3624When
3625.Fl L
3626is used, the channel is locked and any clients that try to lock the same
3627channel are made to wait until the channel is unlocked with
3628.Ic wait-for
3629.Fl U .
3630This command only works from outside
3631.Nm .
3632.El
3633.Sh TERMINFO EXTENSIONS
3634.Nm
3635understands some extensions to
3636.Xr terminfo 5 :
3637.Bl -tag -width Ds
3638.It Em Cs , Cr
3639Set the cursor colour.
3640The first takes a single string argument and is used to set the colour;
3641the second takes no arguments and restores the default cursor colour.
3642If set, a sequence such as this may be used
3643to change the cursor colour from inside
3644.Nm :
3645.Bd -literal -offset indent
3646$ printf '\e033]12;red\e033\e\e'
3647.Ed
3648.It Em \&Ss , Se
3649Change the cursor style.
3650If set, a sequence such as this may be used
3651to change the cursor to an underline:
3652.Bd -literal -offset indent
3653$ printf '\e033[4 q'
3654.Ed
3655.Pp
3656If
3657.Em Csr
3658is set, it will be used to reset the cursor style instead
3659of
3660.Em Cs .
3661.It Em \&Ms
3662This sequence can be used by
3663.Nm
3664to store the current buffer in the host terminal's selection (clipboard).
3665See the
3666.Em set-clipboard
3667option above and the
3668.Xr xterm 1
3669man page.
3670.El
3671.Sh CONTROL MODE
3672.Nm
3673offers a textual interface called
3674.Em control mode .
3675This allows applications to communicate with
3676.Nm
3677using a simple text-only protocol.
3678.Pp
3679In control mode, a client sends
3680.Nm
3681commands or command sequences terminated by newlines on standard input.
3682Each command will produce one block of output on standard output.
3683An output block consists of a
3684.Em %begin
3685line followed by the output (which may be empty).
3686The output block ends with a
3687.Em %end
3688or
3689.Em %error .
3690.Em %begin
3691and matching
3692.Em %end
3693or
3694.Em %error
3695have two arguments: an integer time (as seconds from epoch) and command number.
3696For example:
3697.Bd -literal -offset indent
3698%begin 1363006971 2
36990: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
3700%end 1363006971 2
3701.Ed
3702.Pp
3703In control mode,
3704.Nm
3705outputs notifications.
3706A notification will never occur inside an output block.
3707.Pp
3708The following notifications are defined:
3709.Bl -tag -width Ds
3710.It Ic %exit Op Ar reason
3711The
3712.Nm
3713client is exiting immediately, either because it is not attached to any session
3714or an error occurred.
3715If present,
3716.Ar reason
3717describes why the client exited.
3718.It Ic %layout-change Ar window-id Ar window-layout
3719The layout of a window with ID
3720.Ar window-id
3721changed.
3722The new layout is
3723.Ar window-layout .
3724.It Ic %output Ar pane-id Ar value
3725A window pane produced output.
3726.Ar value
3727escapes non-printable characters and backslash as octal \\xxx.
3728.It Ic %session-changed Ar session-id Ar name
3729The client is now attached to the session with ID
3730.Ar session-id ,
3731which is named
3732.Ar name .
3733.It Ic %session-renamed Ar name
3734The current session was renamed to
3735.Ar name .
3736.It Ic %sessions-changed
3737A session was created or destroyed.
3738.It Ic %unlinked-window-add Ar window-id
3739The window with ID
3740.Ar window-id
3741was created but is not linked to the current session.
3742.It Ic %window-add Ar window-id
3743The window with ID
3744.Ar window-id
3745was linked to the current session.
3746.It Ic %window-close Ar window-id
3747The window with ID
3748.Ar window-id
3749closed.
3750.It Ic %window-renamed Ar window-id Ar name
3751The window with ID
3752.Ar window-id
3753was renamed to
3754.Ar name .
3755.El
3756.Sh FILES
3757.Bl -tag -width "@SYSCONFDIR@/tmux.confXXX" -compact
3758.It Pa ~/.tmux.conf
3759Default
3760.Nm
3761configuration file.
3762.It Pa @SYSCONFDIR@/tmux.conf
3763System-wide configuration file.
3764.El
3765.Sh EXAMPLES
3766To create a new
3767.Nm
3768session running
3769.Xr vi 1 :
3770.Pp
3771.Dl $ tmux new-session vi
3772.Pp
3773Most commands have a shorter form, known as an alias.
3774For new-session, this is
3775.Ic new :
3776.Pp
3777.Dl $ tmux new vi
3778.Pp
3779Alternatively, the shortest unambiguous form of a command is accepted.
3780If there are several options, they are listed:
3781.Bd -literal -offset indent
3782$ tmux n
3783ambiguous command: n, could be: new-session, new-window, next-window
3784.Ed
3785.Pp
3786Within an active session, a new window may be created by typing
3787.Ql C-b c
3788(Ctrl
3789followed by the
3790.Ql b
3791key
3792followed by the
3793.Ql c
3794key).
3795.Pp
3796Windows may be navigated with:
3797.Ql C-b 0
3798(to select window 0),
3799.Ql C-b 1
3800(to select window 1), and so on;
3801.Ql C-b n
3802to select the next window; and
3803.Ql C-b p
3804to select the previous window.
3805.Pp
3806A session may be detached using
3807.Ql C-b d
3808(or by an external event such as
3809.Xr ssh 1
3810disconnection) and reattached with:
3811.Pp
3812.Dl $ tmux attach-session
3813.Pp
3814Typing
3815.Ql C-b \&?
3816lists the current key bindings in the current window; up and down may be used
3817to navigate the list or
3818.Ql q
3819to exit from it.
3820.Pp
3821Commands to be run when the
3822.Nm
3823server is started may be placed in the
3824.Pa ~/.tmux.conf
3825configuration file.
3826Common examples include:
3827.Pp
3828Changing the default prefix key:
3829.Bd -literal -offset indent
3830set-option -g prefix C-a
3831unbind-key C-b
3832bind-key C-a send-prefix
3833.Ed
3834.Pp
3835Turning the status line off, or changing its colour:
3836.Bd -literal -offset indent
3837set-option -g status off
3838set-option -g status-style bg=blue
3839.Ed
3840.Pp
3841Setting other options, such as the default command,
3842or locking after 30 minutes of inactivity:
3843.Bd -literal -offset indent
3844set-option -g default-command "exec /bin/ksh"
3845set-option -g lock-after-time 1800
3846.Ed
3847.Pp
3848Creating new key bindings:
3849.Bd -literal -offset indent
3850bind-key b set-option status
3851bind-key / command-prompt "split-window 'exec man %%'"
3852bind-key S command-prompt "new-window -n %1 'ssh %1'"
3853.Ed
3854.Sh SEE ALSO
3855.Xr pty 7
3856.Sh AUTHORS
3857.An Nicholas Marriott Aq Mt nicm@users.sourceforge.net
3858