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