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