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