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