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