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