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