Annotation of src/usr.bin/tmux/tmux.1, Revision 1.153
1.153 ! nicm 1: .\" $OpenBSD: tmux.1,v 1.152 2010/02/11 20:39:40 nicm Exp $
1.1 nicm 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: .\"
1.153 ! nicm 17: .Dd $Mdocdate: February 11 2010 $
1.1 nicm 18: .Dt TMUX 1
19: .Os
20: .Sh NAME
21: .Nm tmux
1.6 jmc 22: .Nd terminal multiplexer
1.1 nicm 23: .Sh SYNOPSIS
24: .Nm tmux
25: .Bk -words
1.114 nicm 26: .Op Fl 28lquv
1.91 nicm 27: .Op Fl c Ar shell-command
1.1 nicm 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
1.59 jmc 35: is a terminal multiplexer:
36: it enables a number of terminals to be created, accessed, and
37: controlled from a single screen.
1.67 jmc 38: .Nm
39: may be detached from a screen
40: and continue running in the background,
41: then later reattached.
1.1 nicm 42: .Pp
1.60 nicm 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
1.64 nicm 74: Each session is persistent and will survive accidental disconnection
1.66 jmc 75: (such as
1.64 nicm 76: .Xr ssh 1
1.67 jmc 77: connection timeout) or intentional detaching (with the
1.64 nicm 78: .Ql C-b d
79: key strokes).
80: .Nm
81: may be reattached using:
82: .Pp
83: .Dl $ tmux attach
1.60 nicm 84: .Pp
1.64 nicm 85: In
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 .
1.65 nicm 94: .Pp
1.1 nicm 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 ,
1.6 jmc 104: but indicates that the terminal supports 88 colours.
1.91 nicm 105: .It Fl c Ar shell-command
106: Execute
107: .Ar shell-command
108: using the default shell.
109: If necessary, the
110: .Nm
111: server will be started to retrieve the
112: .Ic default-shell
113: option.
1.153 ! nicm 114: This option is for compatibility with
! 115: .Xr sh 1
! 116: when
! 117: .Nm
! 118: is used as a login shell.
1.1 nicm 119: .It Fl f Ar file
120: Specify an alternative configuration file.
121: By default,
122: .Nm
1.26 nicm 123: loads the system configuration file from
124: .Pa /etc/tmux.conf ,
125: if present, then looks for a user configuration file at
1.1 nicm 126: .Pa ~/.tmux.conf .
127: The configuration file is a set of
128: .Nm
129: commands which are executed in sequence when the server is first started.
1.61 nicm 130: .Pp
131: If a command in the configuration file fails,
132: .Nm
133: will report an error and exit without executing further commands.
1.82 nicm 134: .It Fl l
135: Behave as a login shell.
136: This flag currently has no effect and is for compatibility with other shells
137: when using tmux as a login shell.
1.1 nicm 138: .It Fl L Ar socket-name
139: .Nm
140: stores the server socket in a directory under
141: .Pa /tmp ;
142: the default socket is named
143: .Em default .
144: This option allows a different socket name to be specified, allowing several
145: independent
146: .Nm
147: servers to be run.
148: Unlike
149: .Fl S
150: a full path is not necessary: the sockets are all created in the same
151: directory.
1.2 nicm 152: .Pp
153: If the socket is accidentally removed, the
1.6 jmc 154: .Dv SIGUSR1
1.2 nicm 155: signal may be sent to the
156: .Nm
157: server process to recreate it.
1.4 sobrado 158: .It Fl q
1.133 nicm 159: Set the
160: .Ic quiet
161: server option to prevent the server sending various informational messages.
1.1 nicm 162: .It Fl S Ar socket-path
163: Specify a full alternative path to the server socket.
164: If
165: .Fl S
166: is specified, the default socket directory is not used and any
167: .Fl L
168: flag is ignored.
169: .It Fl u
170: .Nm
1.14 nicm 171: attempts to guess if the terminal is likely to support UTF-8 by checking the
172: first of the
173: .Ev LC_ALL ,
174: .Ev LC_CTYPE
175: and
1.2 nicm 176: .Ev LANG
1.14 nicm 177: environment variables to be set for the string "UTF-8".
1.5 nicm 178: This is not always correct: the
1.2 nicm 179: .Fl u
180: flag explicitly informs
181: .Nm
1.6 jmc 182: that UTF-8 is supported.
1.33 nicm 183: .Pp
184: If the server is started from a client passed
185: .Fl u
186: or where UTF-8 is detected, the
187: .Ic utf8
188: and
189: .Ic status-utf8
190: options are enabled in the global window and session options respectively.
1.1 nicm 191: .It Fl v
192: Request verbose logging.
193: This option may be specified multiple times for increasing verbosity.
194: Log messages will be saved into
195: .Pa tmux-client-PID.log
196: and
197: .Pa tmux-server-PID.log
198: files in the current directory, where
199: .Em PID
1.6 jmc 200: is the PID of the server or client process.
1.1 nicm 201: .It Ar command Op Ar flags
202: This specifies one of a set of commands used to control
203: .Nm ,
1.6 jmc 204: as described in the following sections.
1.59 jmc 205: If no commands are specified, the
1.1 nicm 206: .Ic new-session
207: command is assumed.
1.57 jmc 208: .El
1.64 nicm 209: .Sh KEY BINDINGS
210: .Nm
211: may be controlled from an attached client by using a key combination of a
212: prefix key,
213: .Ql C-b
214: (Ctrl-b) by default, followed by a command key.
215: .Pp
216: Some of the default key bindings are:
217: .Pp
1.67 jmc 218: .Bl -tag -width Ds -offset indent -compact
1.64 nicm 219: .It c
1.65 nicm 220: Create a new window.
1.64 nicm 221: .It d
1.65 nicm 222: Detach the current client.
1.64 nicm 223: .It l
1.65 nicm 224: Move to the previously selected window.
1.64 nicm 225: .It n
1.65 nicm 226: Change to the next window.
1.64 nicm 227: .It p
1.65 nicm 228: Change to the previous window.
229: .It &
230: Kill the current window.
231: .It ,
232: Rename the current window.
1.64 nicm 233: .It \&?
1.65 nicm 234: List all key bindings.
1.64 nicm 235: .El
236: .Pp
237: A complete list may be obtained with the
238: .Ic list-keys
239: command (bound to
240: .Ql \&?
241: by default).
242: Key bindings may be changed with the
243: .Ic bind-key
244: and
245: .Ic unbind-key
246: commands.
1.57 jmc 247: .Sh COMMANDS
248: This section contains a list of the commands supported by
249: .Nm .
250: Most commands accept the optional
251: .Fl t
252: argument with one of
253: .Ar target-client ,
254: .Ar target-session
255: .Ar target-window ,
256: or
257: .Ar target-pane .
258: These specify the client, session, window or pane which a command should affect.
259: .Ar target-client
260: is the name of the
261: .Xr pty 4
262: file to which the client is connected, for example either of
263: .Pa /dev/ttyp1
264: or
265: .Pa ttyp1
266: for the client attached to
267: .Pa /dev/ttyp1 .
268: If no client is specified, the current client is chosen, if possible, or an
269: error is reported.
270: Clients may be listed with the
271: .Ic list-clients
272: command.
1.1 nicm 273: .Pp
1.57 jmc 274: .Ar target-session
275: is either the name of a session (as listed by the
276: .Ic list-sessions
277: command) or the name of a client with the same syntax as
278: .Ar target-client ,
279: in which case the session attached to the client is used.
280: When looking for the session name,
281: .Nm
282: initially searches for an exact match; if none is found, the session names
283: are checked for any for which
284: .Ar target-session
285: is a prefix or for which it matches as an
286: .Xr fnmatch 3
287: pattern.
288: If a single match is found, it is used as the target session; multiple matches
289: produce an error.
290: If a session is omitted, the current session is used if available; if no
1.117 nicm 291: current session is available, the most recently used is chosen.
1.1 nicm 292: .Pp
1.57 jmc 293: .Ar target-window
294: specifies a window in the form
295: .Em session Ns \&: Ns Em window .
296: .Em session
297: follows the same rules as for
298: .Ar target-session ,
299: and
300: .Em window
301: is looked for in order: as a window index, for example mysession:1; as an exact
302: window name, such as mysession:mywindow; then as an
303: .Xr fnmatch 3
304: pattern or the start of a window name, such as mysession:mywin* or
305: mysession:mywin.
306: An empty window name specifies the next unused index if appropriate (for
307: example the
308: .Ic new-window
309: and
310: .Ic link-window
311: commands)
312: otherwise the current window in
313: .Em session
314: is chosen.
1.140 nicm 315: The special character
316: .Ql \&!
317: uses the last (previously current) window, or
318: .Ql +
319: and
320: .Ql -
321: are the next window or the previous window by number.
1.57 jmc 322: When the argument does not contain a colon,
323: .Nm
324: first attempts to parse it as window; if that fails, an attempt is made to
325: match a session.
1.1 nicm 326: .Pp
1.57 jmc 327: .Ar target-pane
328: takes a similar form to
329: .Ar target-window
330: but with the optional addition of a period followed by a pane index, for
331: example: mysession:mywindow.1.
332: If the pane index is omitted, the currently active pane in the specified
333: window is used.
334: If neither a colon nor period appears,
1.13 nicm 335: .Nm
1.57 jmc 336: first attempts to use the argument as a pane index; if that fails, it is looked
337: up as for
338: .Ar target-window .
1.132 nicm 339: One of the strings
340: .Em top ,
341: .Em bottom ,
342: .Em left ,
343: .Em right ,
344: .Em top-left ,
345: .Em top-right ,
346: .Em bottom-left or
347: .Em bottom-right
348: may be used instead of a pane index.
1.15 jmc 349: .Pp
1.153 ! nicm 350: .Ar shell-command
! 351: arguments are
! 352: .Xr sh 1
! 353: commands.
! 354: These must be passed as a single item, which typically means quoting them, for
! 355: example:
! 356: .Bd -literal -offset indent
! 357: new-window 'vi /etc/passwd'
! 358: .Ed
! 359: .Pp
! 360: .Ar command
! 361: .Op Ar arguments
! 362: refers to a
! 363: .Nm
! 364: command, passed with the command and arguments separately, for example:
! 365: .Bd -literal -offset indent
! 366: bind-key F1 set-window-option force-width 81
! 367: .Ed
! 368: .Pp
! 369: Or if using
! 370: .Xr sh 1 :
! 371: .Pp
! 372: .Bd -literal -offset indent
! 373: $ tmux bind-key F1 set-window-option force-width 81
! 374: .Ed
! 375: .Pp
1.57 jmc 376: Multiple commands may be specified together as part of a
377: .Em command sequence .
378: Each command should be separated by spaces and a semicolon;
379: commands are executed sequentially from left to right.
380: A literal semicolon may be included by escaping it with a backslash (for
381: example, when specifying a command sequence to
382: .Ic bind-key ) .
1.13 nicm 383: .Pp
1.153 ! nicm 384: Example
! 385: .Nm
! 386: commands include:
1.13 nicm 387: .Bd -literal -offset indent
1.57 jmc 388: refresh-client -t/dev/ttyp2
389:
390: rename-session -tfirst newname
391:
392: set-window-option -t:0 monitor-activity on
393:
394: new-window ; split-window -d
1.13 nicm 395: .Ed
1.153 ! nicm 396: .Pp
! 397: Or from
! 398: .Xr sh 1 :
! 399: .Pp
! 400: .Bd -literal -offset indent
! 401: $ tmux kill-window -t :1
! 402:
! 403: $ tmux new-window \\; split-window -d
! 404:
! 405: $ tmux new-session -d 'vi /etc/passwd' \\; split-window -d \\; attach
! 406: .Ed
1.57 jmc 407: .Sh CLIENTS AND SESSIONS
1.153 ! nicm 408: The
! 409: .Nm
! 410: server manages clients, sessions, windows and panes.
! 411: Clients are attached to sessions to interact with them, either
! 412: when they are created with the
! 413: .Ic new-session
! 414: command, or later with the
! 415: .Ic attach-session
! 416: command.
! 417: Each session has one of more windows
! 418: .Em linked
! 419: into it.
! 420: Windows may be linked to multiple sessions and are made up of one or
! 421: more panes,
! 422: each of which contains a pseudo terminal.
! 423: Commands for creating, linking and otherwise manipulating windows
! 424: are covered
! 425: in the
! 426: .Sx WINDOWS AND PANES
! 427: section.
! 428: .Pp
! 429: The following commands are available to manage clients and sessions:
1.57 jmc 430: .Bl -tag -width Ds
431: .It Xo Ic attach-session
1.148 nicm 432: .Op Fl dr
1.57 jmc 433: .Op Fl t Ar target-session
434: .Xc
435: .D1 (alias: Ic attach )
436: If run from outside
437: .Nm ,
438: create a new client in the current terminal and attach it to
439: .Ar target-session .
440: If used from inside, switch the current client.
441: If
442: .Fl d
443: is specified, any other clients attached to the session are detached.
1.148 nicm 444: .Fl r
445: signifies the client is read-only (only keys bound to the
446: .Ic detach-client
447: command have any effect)
1.13 nicm 448: .Pp
1.57 jmc 449: If no server is started,
450: .Ic attach-session
451: will attempt to start it; this will fail unless sessions are created in the
452: configuration file.
453: .It Ic detach-client Op Fl t Ar target-client
454: .D1 (alias: Ic detach )
455: Detach the current client if bound to a key, or the specified client with
456: .Fl t .
457: .It Ic has-session Op Fl t Ar target-session
458: .D1 (alias: Ic has )
459: Report an error and exit with 1 if the specified session does not exist.
460: If it does exist, exit with 0.
461: .It Ic kill-server
462: Kill the
1.1 nicm 463: .Nm
1.57 jmc 464: server and clients and destroy all sessions.
465: .It Ic kill-session Op Fl t Ar target-session
466: Destroy the given session, closing any windows linked to it and no other
467: sessions, and detaching all clients attached to it.
468: .It Ic list-clients
469: .D1 (alias: Ic lsc )
470: List all clients attached to the server.
471: .It Ic list-commands
472: .D1 (alias: Ic lscm )
473: List the syntax of all commands supported by
474: .Nm .
475: .It Ic list-sessions
476: .D1 (alias: Ic ls )
477: List all sessions managed by the server.
1.92 nicm 478: .It Xo Ic lock-client
479: .Op Fl t Ar target-client
480: .Xc
481: Lock
482: .Ar target-client ,
483: see the
484: .Ic lock-server
485: command.
486: .It Xo Ic lock-session
487: .Op Fl t Ar target-session
488: .Xc
489: Lock all clients attached to
490: .Ar target-session .
1.57 jmc 491: .It Xo Ic new-session
492: .Op Fl d
493: .Op Fl n Ar window-name
494: .Op Fl s Ar session-name
1.101 nicm 495: .Op Fl t Ar target-session
1.153 ! nicm 496: .Op Ar shell-command
1.57 jmc 497: .Xc
498: .D1 (alias: Ic new )
499: Create a new session with name
500: .Ar session-name .
1.153 ! nicm 501: .Pp
1.57 jmc 502: The new session is attached to the current terminal unless
503: .Fl d
504: is given.
505: .Ar window-name
1.1 nicm 506: and
1.153 ! nicm 507: .Ar shell-command
! 508: are the name of and shell command to execute in the initial window.
1.68 nicm 509: .Pp
510: If run from a terminal, any
511: .Xr termios 4
512: special characters are saved and used for new windows in the new session.
1.101 nicm 513: .Pp
514: If
515: .Fl t
516: is given, the new session is
517: .Em grouped
518: with
519: .Ar target-session .
520: This means they share the same set of windows - all windows from
521: .Ar target-session
522: are linked to the new session and any subsequent new windows or windows being
523: closed are applied to both sessions.
524: The current and previous window and any session options remain independent and
525: either session may be killed without affecting the other.
526: Giving
527: .Fl n
528: or
1.153 ! nicm 529: .Ar shell-command
1.101 nicm 530: are invalid if
531: .Fl t
532: is used.
1.57 jmc 533: .It Ic refresh-client Op Fl t Ar target-client
534: .D1 (alias: Ic refresh )
535: Refresh the current client if bound to a key, or a single client if one is given
536: with
537: .Fl t .
538: .It Xo Ic rename-session
539: .Op Fl t Ar target-session
540: .Ar new-name
541: .Xc
542: .D1 (alias: Ic rename )
543: Rename the session to
544: .Ar new-name .
1.121 nicm 545: .It Xo Ic show-messages
1.120 nicm 546: .Op Fl t Ar target-client
547: .Xc
548: .D1 (alias: Ic showmsgs )
549: Any messages displayed on the status line are saved in a per-client message
550: log, up to a maximum of the limit set by the
551: .Ar message-limit
552: session option for the session attached to that client.
553: This command displays the log for
554: .Ar target-client .
1.57 jmc 555: .It Ic source-file Ar path
556: .D1 (alias: Ic source )
557: Execute commands from
558: .Ar path .
559: .It Ic start-server
560: .D1 (alias: Ic start )
561: Start the
1.1 nicm 562: .Nm
1.57 jmc 563: server, if not already running, without creating any sessions.
564: .It Xo Ic suspend-client
565: .Op Fl c Ar target-client
566: .Xc
567: .D1 (alias: Ic suspendc )
568: Suspend a client by sending
569: .Dv SIGTSTP
570: (tty stop).
571: .It Xo Ic switch-client
572: .Op Fl c Ar target-client
573: .Op Fl t Ar target-session
574: .Xc
575: .D1 (alias: Ic switchc )
576: Switch the current session for client
577: .Ar target-client
578: to
579: .Ar target-session .
580: .El
581: .Sh WINDOWS AND PANES
1.1 nicm 582: A
583: .Nm
584: window may be in one of several modes.
585: The default permits direct access to the terminal attached to the window.
586: The others are:
587: .Bl -tag -width Ds
588: .It Em output mode
589: This is entered when a command which produces output, such as
590: .Ic list-keys ,
591: is executed from a key binding.
592: .It Em copy mode
593: This permits a section of a window or its history to be copied to a
594: .Em paste buffer
595: for later insertion into another window.
596: This mode is entered with the
597: .Ic copy-mode
598: command, bound to
1.113 nicm 599: .Ql \&[
1.1 nicm 600: by default.
601: .El
602: .Pp
1.6 jmc 603: The keys available depend on whether emacs or vi mode is selected
604: (see the
1.1 nicm 605: .Ic mode-keys
606: option).
607: The following keys are supported as appropriate for the mode:
1.146 nicm 608: .Bl -column "FunctionXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
1.1 nicm 609: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
1.27 nicm 610: .It Li "Back to indentation" Ta "^" Ta "M-m"
1.142 nicm 611: .It Li "Bottom of history" Ta "G" Ta "M-<"
1.1 nicm 612: .It Li "Clear selection" Ta "Escape" Ta "C-g"
613: .It Li "Copy selection" Ta "Enter" Ta "M-w"
614: .It Li "Cursor down" Ta "j" Ta "Down"
1.70 nicm 615: .It Li "Cursor left" Ta "h" Ta "Left"
616: .It Li "Cursor right" Ta "l" Ta "Right"
1.116 nicm 617: .It Li "Cursor to bottom line" Ta "L" Ta ""
618: .It Li "Cursor to middle line" Ta "M" Ta "M-r"
619: .It Li "Cursor to top line" Ta "H" Ta "M-R"
1.70 nicm 620: .It Li "Cursor up" Ta "k" Ta "Up"
1.71 nicm 621: .It Li "Delete entire line" Ta "d" Ta "C-u"
1.70 nicm 622: .It Li "Delete to end of line" Ta "D" Ta "C-k"
1.1 nicm 623: .It Li "End of line" Ta "$" Ta "C-e"
1.142 nicm 624: .It Li "Go to line" Ta ":" Ta "g"
1.116 nicm 625: .It Li "Half page down" Ta "C-d" Ta "M-Down"
626: .It Li "Half page up" Ta "C-u" Ta "M-Up"
1.1 nicm 627: .It Li "Next page" Ta "C-f" Ta "Page down"
1.146 nicm 628: .It Li "Next space" Ta "W" Ta ""
629: .It Li "Next space, end of word" Ta "E" Ta ""
1.143 nicm 630: .It Li "Next word" Ta "w" Ta ""
631: .It Li "Next word end" Ta "e" Ta "M-f"
1.70 nicm 632: .It Li "Paste buffer" Ta "p" Ta "C-y"
1.116 nicm 633: .It Li "Previous page" Ta "C-b" Ta "Page up"
1.1 nicm 634: .It Li "Previous word" Ta "b" Ta "M-b"
1.146 nicm 635: .It Li "Previous space" Ta "B" Ta ""
1.1 nicm 636: .It Li "Quit mode" Ta "q" Ta "Escape"
1.147 nicm 637: .It Li "Rectangle toggle" Ta "v" Ta "R"
1.141 nicm 638: .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
639: .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
1.70 nicm 640: .It Li "Search again" Ta "n" Ta "n"
1.152 nicm 641: .It Li "Search again in reverse" Ta "N" Ta "N"
1.70 nicm 642: .It Li "Search backward" Ta "?" Ta "C-r"
643: .It Li "Search forward" Ta "/" Ta "C-s"
644: .It Li "Start of line" Ta "0" Ta "C-a"
1.1 nicm 645: .It Li "Start selection" Ta "Space" Ta "C-Space"
1.142 nicm 646: .It Li "Top of history" Ta "g" Ta "M->"
1.80 nicm 647: .It Li "Transpose chars" Ta "" Ta "C-t"
1.1 nicm 648: .El
1.146 nicm 649: .Pp
650: The next and previous word keys use space and the
651: .Ql - ,
652: .Ql _ ,
653: .Ql \&"
654: and
655: .Ql @
656: characters as word delimiters.
657: Next word moves to the start of the next word, next word end to the end of the
658: next word and previous word to the start of the previous word.
659: The three next and previous space keys work similarly but use a space alone as
660: the word separator.
1.1 nicm 661: .Pp
1.48 nicm 662: These key bindings are defined in a set of named tables:
663: .Em vi-edit
664: and
665: .Em emacs-edit
666: for keys used when line editing at the command prompt;
667: .Em vi-choice
668: and
669: .Em emacs-choice
670: for keys used when choosing from lists (such as produced by the
1.144 nicm 671: .Ic choose-window
1.48 nicm 672: command) or in output mode; and
673: .Em vi-copy
674: and
675: .Em emacs-copy
1.97 nicm 676: used in copy mode.
1.48 nicm 677: The tables may be viewed with the
678: .Ic list-keys
1.49 nicm 679: command and keys modified or removed with
680: .Ic bind-key
681: and
682: .Ic unbind-key .
1.48 nicm 683: .Pp
1.2 nicm 684: The paste buffer key pastes the first line from the top paste buffer on the
685: stack.
1.57 jmc 686: .Pp
687: The mode commands are as follows:
688: .Bl -tag -width Ds
689: .It Xo Ic copy-mode
690: .Op Fl u
1.72 nicm 691: .Op Fl t Ar target-pane
1.57 jmc 692: .Xc
693: Enter copy mode.
694: The
695: .Fl u
696: option scrolls one page up.
697: .El
1.18 nicm 698: .Pp
1.1 nicm 699: Each window displayed by
700: .Nm
701: may be split into one or more
702: .Em panes ;
703: each pane takes up a certain area of the display and is a separate terminal.
704: A window may be split into panes using the
705: .Ic split-window
706: command.
1.38 nicm 707: Windows may be split horizontally (with the
708: .Fl h
709: flag) or vertically.
710: Panes may be resized with the
711: .Ic resize-pane
1.1 nicm 712: command (bound to
1.38 nicm 713: .Ql C-up ,
714: .Ql C-down
715: .Ql C-left
716: and
717: .Ql C-right
1.1 nicm 718: by default), the current pane may be changed with the
719: .Ic up-pane
720: and
721: .Ic down-pane
722: commands and the
723: .Ic rotate-window
724: and
725: .Ic swap-pane
1.38 nicm 726: commands may be used to swap panes without changing their position.
727: Panes are numbered beginning from zero in the order they are created.
728: .Pp
729: A number of preset
730: .Em layouts
731: are available.
732: These may be selected with the
733: .Ic select-layout
734: command or cycled with
735: .Ic next-layout
736: (bound to
1.149 nicm 737: .Ql Space
1.131 nicm 738: by default); once a layout is chosen, panes within it may be moved and resized
739: as normal.
1.1 nicm 740: .Pp
741: The following layouts are supported:
742: .Bl -tag -width Ds
743: .It Ic even-horizontal
744: Panes are spread out evenly from left to right across the window.
745: .It Ic even-vertical
746: Panes are spread evenly from top to bottom.
1.2 nicm 747: .It Ic main-horizontal
1.131 nicm 748: A large (main) pane is shown at the top of the window and the remaining panes
749: are spread from left to right in the leftover space at the bottom.
1.2 nicm 750: Use the
751: .Em main-pane-height
752: window option to specify the height of the top pane.
1.1 nicm 753: .It Ic main-vertical
1.2 nicm 754: Similar to
755: .Ic main-horizontal
756: but the large pane is placed on the left and the others spread from top to
757: bottom along the right.
758: See the
759: .Em main-pane-width
760: window option.
1.1 nicm 761: .El
1.8 nicm 762: .Pp
1.57 jmc 763: Commands related to windows and panes are as follows:
764: .Bl -tag -width Ds
765: .It Xo Ic break-pane
766: .Op Fl d
767: .Op Fl t Ar target-pane
768: .Xc
769: .D1 (alias: Ic breakp )
770: Break
771: .Ar target-pane
772: off from its containing window to make it the only pane in a new window.
773: If
774: .Fl d
775: is given, the new window does not become the current window.
1.128 nicm 776: .It Xo Ic capture-pane
777: .Op Fl b Ar buffer-index
778: .Op Fl t Ar target-pane
779: .Xc
780: .D1 (alias: Ic capturep )
781: Capture the contents of a pane to the specified buffer, or a new buffer if none
782: is specified.
1.76 nicm 783: .It Xo
784: .Ic choose-client
785: .Op Fl t Ar target-window
786: .Op Ar template
787: .Xc
788: Put a window into client choice mode, allowing a client to be selected
789: interactively from a list.
790: After a client is chosen,
791: .Ql %%
792: is replaced by the client
793: .Xr pty 4
794: path in
795: .Ar template
796: and the result executed as a command.
797: If
798: .Ar template
799: is not given, "detach-client -t '%%'" is used.
1.57 jmc 800: This command works only from inside
801: .Nm .
1.76 nicm 802: .It Xo
803: .Ic choose-session
804: .Op Fl t Ar target-window
805: .Op Ar template
806: .Xc
807: Put a window into session choice mode, where a session may be selected
808: interactively from a list.
809: When one is chosen,
810: .Ql %%
811: is replaced by the session name in
812: .Ar template
813: and the result executed as a command.
814: If
815: .Ar template
816: is not given, "switch-client -t '%%'" is used.
817: This command works only from inside
818: .Nm .
819: .It Xo
820: .Ic choose-window
821: .Op Fl t Ar target-window
822: .Op Ar template
823: .Xc
824: Put a window into window choice mode, where a window may be chosen
825: interactively from a list.
826: After a window is selected,
827: .Ql %%
828: is replaced by the session name and window index in
829: .Ar template
830: and the result executed as a command.
831: If
832: .Ar template
833: is not given, "select-window -t '%%'" is used.
1.57 jmc 834: This command works only from inside
835: .Nm .
1.78 nicm 836: .It Ic display-panes Op Fl t Ar target-client
837: .D1 (alias: Ic displayp)
838: Display a visible indicator of each pane shown by
839: .Ar target-client .
840: See the
1.145 nicm 841: .Ic display-panes-time ,
842: .Ic display-panes-colour ,
1.78 nicm 843: and
1.145 nicm 844: .Ic display-panes-active-colour
1.78 nicm 845: session options.
1.84 nicm 846: While the indicator is on screen, a pane may be selected with the
847: .Ql 0
848: to
849: .Ql 9
850: keys.
1.57 jmc 851: .It Ic down-pane Op Fl t Ar target-pane
852: .D1 (alias: Ic downp )
1.111 nicm 853: Change the active pane to the next pane (higher index).
1.57 jmc 854: .It Xo Ic find-window
855: .Op Fl t Ar target-window
856: .Ar match-string
857: .Xc
858: .D1 (alias: Ic findw )
859: Search for the
860: .Xr fnmatch 3
861: pattern
862: .Ar match-string
863: in window names, titles, and visible content (but not history).
864: If only one window is matched, it'll be automatically selected, otherwise a
865: choice list is shown.
866: This command only works from inside
1.1 nicm 867: .Nm .
1.137 nicm 868: .It Xo Ic join-pane
869: .Op Fl dhv
870: .Oo Fl l
871: .Ar size |
872: .Fl p Ar percentage Oc
873: .Op Fl s Ar src-pane
874: .Op Fl t Ar dst-pane
875: .Xc
876: .D1 (alias: Ic joinp )
877: Like
878: .Ic split-window ,
879: but instead of splitting
880: .Ar dst-pane
881: and creating a new pane, split it and move
882: .Ar src-pane
883: into the space.
884: This can be used to reverse
885: .Ic break-pane .
1.112 nicm 886: .It Xo Ic kill-pane
887: .Op Fl a
888: .Op Fl t Ar target-pane
889: .Xc
1.57 jmc 890: .D1 (alias: Ic killp )
891: Destroy the given pane.
892: If no panes remain in the containing window, it is also destroyed.
1.112 nicm 893: The
894: .Fl a
895: option kills all but the pane given with
896: .Fl t .
1.57 jmc 897: .It Ic kill-window Op Fl t Ar target-window
898: .D1 (alias: Ic killw )
899: Kill the current window or the window at
900: .Ar target-window ,
1.1 nicm 901: removing it from any sessions to which it is linked.
1.56 jmc 902: .It Ic last-window Op Fl t Ar target-session
1.1 nicm 903: .D1 (alias: Ic last )
904: Select the last (previously selected) window.
905: If no
906: .Ar target-session
907: is specified, select the last window of the current session.
908: .It Xo Ic link-window
909: .Op Fl dk
910: .Op Fl s Ar src-window
911: .Op Fl t Ar dst-window
912: .Xc
913: .D1 (alias: Ic linkw )
914: Link the window at
915: .Ar src-window
916: to the specified
917: .Ar dst-window .
918: If
919: .Ar dst-window
920: is specified and no such window exists, the
921: .Ar src-window
922: is linked there.
923: If
924: .Fl k
925: is given and
926: .Ar dst-window
927: exists, it is killed, otherwise an error is generated.
928: If
929: .Fl d
930: is given, the newly linked window is not selected.
1.104 nicm 931: .It Ic list-panes Op Fl t Ar target-window
932: .D1 (alias: Ic lsp )
933: List the panes in the current window or in
934: .Ar target-window .
1.56 jmc 935: .It Ic list-windows Op Fl t Ar target-session
1.1 nicm 936: .D1 (alias: Ic lsw )
937: List windows in the current session or in
938: .Ar target-session .
939: .It Xo Ic move-window
940: .Op Fl d
941: .Op Fl s Ar src-window
942: .Op Fl t Ar dst-window
943: .Xc
944: .D1 (alias: Ic movew )
945: This is similar to
946: .Ic link-window ,
947: except the window at
948: .Ar src-window
949: is moved to
950: .Ar dst-window .
951: .It Xo Ic new-window
1.28 nicm 952: .Op Fl dk
1.1 nicm 953: .Op Fl n Ar window-name
954: .Op Fl t Ar target-window
1.153 ! nicm 955: .Op Ar shell-command
1.1 nicm 956: .Xc
957: .D1 (alias: Ic neww )
958: Create a new window.
959: If
960: .Fl d
961: is given, the session does not make the new window the current window.
962: .Ar target-window
1.28 nicm 963: represents the window to be created; if the target already exists an error is
964: shown, unless the
965: .Fl k
966: flag is used, in which case it is destroyed.
1.153 ! nicm 967: .Ar shell-command
1.1 nicm 968: is the command to execute.
969: If
1.153 ! nicm 970: .Ar shell-command
! 971: is not specified, the value of the
! 972: .Ic default-command
! 973: option is used.
! 974: .Pp
! 975: When the shell command completes, the window closes.
! 976: See the
! 977: .Ic remain-on-exit
! 978: option to change this behaviour.
1.1 nicm 979: .Pp
980: The
981: .Ev TERM
982: environment variable must be set to
983: .Dq screen
984: for all programs running
985: .Em inside
986: .Nm .
987: New windows will automatically have
988: .Dq TERM=screen
989: added to their environment, but care must be taken not to reset this in shell
990: start-up files.
1.56 jmc 991: .It Ic next-layout Op Fl t Ar target-window
1.1 nicm 992: .D1 (alias: Ic nextl )
993: Move a window to the next layout and rearrange the panes to fit.
994: .It Xo Ic next-window
1.9 nicm 995: .Op Fl a
1.1 nicm 996: .Op Fl t Ar target-session
997: .Xc
998: .D1 (alias: Ic next )
999: Move to the next window in the session.
1.9 nicm 1000: If
1.12 jmc 1001: .Fl a
1.9 nicm 1002: is used, move to the next window with a bell, activity or content alert.
1.107 nicm 1003: .It Xo Ic pipe-pane
1004: .Op Fl o
1005: .Op Fl t Ar target-pane
1.153 ! nicm 1006: .Op Ar shell-command
1.107 nicm 1007: .Xc
1008: .D1 (alias: Ic pipep )
1009: Pipe any output sent by the program in
1010: .Ar target-pane
1011: to a shell command.
1012: A pane may only be piped to one command at a time, any existing pipe is
1013: closed before
1.153 ! nicm 1014: .Ar shell-command
1.107 nicm 1015: is executed.
1016: If no
1.153 ! nicm 1017: .Ar shell-command
1.107 nicm 1018: is given, the current pipe (if any) is closed.
1019: .Pp
1020: The
1021: .Fl o
1022: option only opens a new pipe if no previous pipe exists, allowing a pipe to
1023: be toggled with a single key, for example:
1024: .Bd -literal -offset indent
1025: bind-key C-p pipe-pane -o 'cat >>~/output'
1026: .Ed
1.1 nicm 1027: .It Xo Ic previous-window
1.9 nicm 1028: .Op Fl a
1.1 nicm 1029: .Op Fl t Ar target-session
1030: .Xc
1031: .D1 (alias: Ic prev )
1032: Move to the previous window in the session.
1.9 nicm 1033: With
1034: .Fl a ,
1035: move to the previous window with a bell, activity or content alert.
1.1 nicm 1036: .It Xo Ic rename-window
1037: .Op Fl t Ar target-window
1038: .Ar new-name
1039: .Xc
1040: .D1 (alias: Ic renamew )
1041: Rename the current window, or the window at
1042: .Ar target-window
1043: if specified, to
1044: .Ar new-name .
1045: .It Xo Ic resize-pane
1.39 jmc 1046: .Op Fl DLRU
1.52 nicm 1047: .Op Fl t Ar target-pane
1.1 nicm 1048: .Op Ar adjustment
1049: .Xc
1050: .D1 (alias: Ic resizep )
1.57 jmc 1051: Resize a pane, upward with
1052: .Fl U
1053: (the default), downward with
1054: .Fl D ,
1055: to the left with
1056: .Fl L
1057: and to the right with
1058: .Fl R .
1059: The
1060: .Ar adjustment
1061: is given in lines or cells (the default is 1).
1062: .It Xo Ic respawn-window
1063: .Op Fl k
1064: .Op Fl t Ar target-window
1.153 ! nicm 1065: .Op Ar shell-command
1.57 jmc 1066: .Xc
1067: .D1 (alias: Ic respawnw )
1.153 ! nicm 1068: Reactivate a window in which the command has exited (see the
1.57 jmc 1069: .Ic remain-on-exit
1070: window option).
1071: If
1.153 ! nicm 1072: .Ar shell-command
1.57 jmc 1073: is not given, the command used when the window was created is executed.
1074: The window must be already inactive, unless
1075: .Fl k
1076: is given, in which case any existing command is killed.
1077: .It Xo Ic rotate-window
1078: .Op Fl DU
1079: .Op Fl t Ar target-window
1080: .Xc
1081: .D1 (alias: Ic rotatew )
1082: Rotate the positions of the panes within a window, either upward (numerically
1083: lower) with
1084: .Fl U
1085: or downward (numerically higher).
1086: .It Xo Ic select-layout
1087: .Op Fl t Ar target-window
1088: .Op Ar layout-name
1089: .Xc
1090: .D1 (alias: selectl )
1091: Choose a specific layout for a window.
1092: If
1093: .Ar layout-name
1094: is not given, the last layout used (if any) is reapplied.
1095: .It Ic select-pane Op Fl t Ar target-pane
1096: .D1 (alias: Ic selectp )
1097: Make pane
1098: .Ar target-pane
1099: the active pane in window
1100: .Ar target-window .
1101: .It Ic select-window Op Fl t Ar target-window
1102: .D1 (alias: Ic selectw )
1103: Select the window at
1104: .Ar target-window .
1105: .It Xo Ic split-window
1106: .Op Fl dhv
1107: .Oo Fl l
1108: .Ar size |
1109: .Fl p Ar percentage Oc
1.136 nicm 1110: .Op Fl t Ar target-pane
1.153 ! nicm 1111: .Op Ar shell-command
1.57 jmc 1112: .Xc
1113: .D1 (alias: splitw )
1.136 nicm 1114: Create a new pane by splitting
1115: .Ar target-pane :
1.57 jmc 1116: .Fl h
1117: does a horizontal split and
1118: .Fl v
1119: a vertical split; if neither is specified,
1120: .Fl v
1121: is assumed.
1122: The
1123: .Fl l
1124: and
1125: .Fl p
1.136 nicm 1126: options specify the size of the new pane in lines (for vertical split) or in
1.57 jmc 1127: cells (for horizontal split), or as a percentage, respectively.
1.136 nicm 1128: All other options have the same meaning as for the
1.57 jmc 1129: .Ic new-window
1130: command.
1131: .It Xo Ic swap-pane
1132: .Op Fl dDU
1133: .Op Fl s Ar src-pane
1134: .Op Fl t Ar dst-pane
1135: .Xc
1136: .D1 (alias: Ic swapp )
1137: Swap two panes.
1138: If
1139: .Fl U
1140: is used and no source pane is specified with
1141: .Fl s ,
1142: .Ar dst-pane
1143: is swapped with the previous pane (before it numerically);
1144: .Fl D
1145: swaps with the next pane (after it numerically).
1.138 nicm 1146: .Fl d
1147: instructs
1148: .Nm
1149: not to change the active pane.
1.57 jmc 1150: .It Xo Ic swap-window
1151: .Op Fl d
1152: .Op Fl s Ar src-window
1153: .Op Fl t Ar dst-window
1154: .Xc
1155: .D1 (alias: Ic swapw )
1156: This is similar to
1157: .Ic link-window ,
1158: except the source and destination windows are swapped.
1159: It is an error if no window exists at
1160: .Ar src-window .
1161: .It Xo Ic unlink-window
1.1 nicm 1162: .Op Fl k
1163: .Op Fl t Ar target-window
1164: .Xc
1.57 jmc 1165: .D1 (alias: Ic unlinkw )
1166: Unlink
1167: .Ar target-window .
1168: Unless
1169: .Fl k
1170: is given, a window may be unlinked only if it is linked to multiple sessions -
1171: windows may not be linked to no sessions;
1172: if
1.1 nicm 1173: .Fl k
1.57 jmc 1174: is specified and the window is linked to only one session, it is unlinked and
1175: destroyed.
1176: .It Ic up-pane Op Fl t Ar target-pane
1177: .D1 (alias: Ic upp )
1.111 nicm 1178: Change the active pane to the previous pane (lower index).
1.57 jmc 1179: .El
1180: .Sh KEY BINDINGS
1.93 nicm 1181: .Nm
1182: allows a command to be bound to most keys, with or without a prefix key.
1183: When specifying keys, most represent themselves (for example
1184: .Ql A
1185: to
1.95 jmc 1186: .Ql Z ) .
1.93 nicm 1187: Ctrl keys may be prefixed with
1188: .Ql C-
1189: or
1.95 jmc 1190: .Ql ^ ,
1191: and Alt (meta) with
1.93 nicm 1192: .Ql M- .
1193: In addition, the following special key names are accepted:
1.126 nicm 1194: .Em Up ,
1195: .Em Down ,
1196: .Em Left ,
1197: .Em Right ,
1.93 nicm 1198: .Em BSpace ,
1199: .Em BTab ,
1200: .Em DC
1201: (Delete),
1202: .Em End ,
1203: .Em Enter ,
1204: .Em Escape ,
1205: .Em F1
1206: to
1207: .Em F20 ,
1208: .Em Home ,
1209: .Em IC
1210: (Insert),
1211: .Em NPage
1212: (Page Up),
1213: .Em PPage
1214: (Page Down),
1215: .Em Space ,
1216: and
1217: .Em Tab .
1218: Note that to bind the
1219: .Ql \&"
1220: or
1221: .Ql '
1222: keys, quotation marks are necessary, for example:
1223: .Bd -literal -offset indent
1224: bind-key '"' split-window
1225: bind-key "'" select-prompt
1226: .Ed
1227: .Pp
1.57 jmc 1228: Commands related to key bindings are as follows:
1229: .Bl -tag -width Ds
1230: .It Xo Ic bind-key
1231: .Op Fl cnr
1232: .Op Fl t Ar key-table
1233: .Ar key Ar command Op Ar arguments
1.1 nicm 1234: .Xc
1.57 jmc 1235: .D1 (alias: Ic bind )
1236: Bind key
1237: .Ar key
1238: to
1239: .Ar command .
1240: By default (without
1241: .Fl t )
1242: the primary key bindings are modified (those normally activated with the prefix
1243: key); in this case, if
1244: .Fl n
1245: is specified, it is not necessary to use the prefix key,
1246: .Ar command
1247: is bound to
1248: .Ar key
1249: alone.
1.1 nicm 1250: The
1.57 jmc 1251: .Fl r
1252: flag indicates this key may repeat, see the
1253: .Ic repeat-time
1254: option.
1255: .Pp
1256: If
1257: .Fl t
1258: is present,
1259: .Ar key
1260: is bound in
1261: .Ar key-table :
1262: the binding for command mode with
1263: .Fl c
1264: or for normal mode without.
1265: To view the default bindings and possible commands, see the
1266: .Ic list-keys
1267: command.
1268: .It Ic list-keys Op Fl t Ar key-table
1269: .D1 (alias: Ic lsk )
1270: List all key bindings.
1271: Without
1272: .Fl t
1273: the primary key bindings - those executed when preceded by the prefix key -
1274: are printed.
1275: Keys bound without the prefix key (see
1276: .Ic bind-key
1277: .Fl n )
1.119 nicm 1278: are marked with
1279: .Ql (no prefix) .
1.57 jmc 1280: .Pp
1281: With
1282: .Fl t ,
1283: the key bindings in
1284: .Ar key-table
1285: are listed; this may be one of:
1286: .Em vi-edit ,
1287: .Em emacs-edit ,
1288: .Em vi-choice ,
1289: .Em emacs-choice ,
1290: .Em vi-copy
1291: or
1292: .Em emacs-copy .
1293: .It Xo Ic send-keys
1.72 nicm 1294: .Op Fl t Ar target-pane
1.57 jmc 1295: .Ar key Ar ...
1.1 nicm 1296: .Xc
1.57 jmc 1297: .D1 (alias: Ic send )
1298: Send a key or keys to a window.
1299: Each argument
1300: .Ar key
1301: is the name of the key (such as
1302: .Ql C-a
1303: or
1304: .Ql npage
1305: ) to send; if the string is not recognised as a key, it is sent as a series of
1306: characters.
1307: All arguments are sent sequentially from first to last.
1.72 nicm 1308: .It Ic send-prefix Op Fl t Ar target-pane
1.57 jmc 1309: Send the prefix key to a window as if it was pressed.
1.89 nicm 1310: If multiple prefix keys are configured, only the first is sent.
1.57 jmc 1311: .It Xo Ic unbind-key
1312: .Op Fl cn
1313: .Op Fl t Ar key-table
1314: .Ar key
1.2 nicm 1315: .Xc
1.57 jmc 1316: .D1 (alias: Ic unbind )
1317: Unbind the command bound to
1318: .Ar key .
1319: Without
1320: .Fl t
1321: the primary key bindings are modified; in this case, if
1322: .Fl n
1323: is specified, the command bound to
1324: .Ar key
1325: without a prefix (if any) is removed.
1326: .Pp
1.47 nicm 1327: If
1.57 jmc 1328: .Fl t
1329: is present,
1330: .Ar key
1331: in
1332: .Ar key-table
1333: is unbound: the binding for command mode with
1334: .Fl c
1335: or for normal mode without.
1336: .El
1337: .Sh OPTIONS
1338: The appearance and behaviour of
1339: .Nm
1340: may be modified by changing the value of various options.
1.133 nicm 1341: There are three types of option:
1342: .Em server options ,
1.57 jmc 1343: .Em session options
1344: and
1345: .Em window options .
1346: .Pp
1.133 nicm 1347: The
1348: .Nm
1349: server has a set of global options which do not apply to any particular
1350: window or session.
1351: These are altered with the
1352: .Ic set-option
1353: .Fl s
1354: command, or displayed with the
1355: .Ic show-options
1356: .Fl s
1357: command.
1358: .Pp
1359: In addition, each individual session may have a set of session options, and
1360: there is a separate set of global session options.
1.57 jmc 1361: Sessions which do not have a particular option configured inherit the value
1362: from the global session options.
1363: Session options are set or unset with the
1364: .Ic set-option
1365: command and may be listed with the
1366: .Ic show-options
1367: command.
1.133 nicm 1368: The available server and session options are listed under the
1.57 jmc 1369: .Ic set-option
1370: command.
1371: .Pp
1372: Similarly, a set of window options is attached to each window, and there is
1373: a set of global window options from which any unset options are inherited.
1374: Window options are altered with the
1375: .Ic set-window-option
1376: command and can be listed with the
1377: .Ic show-window-options
1378: command.
1379: All window options are documented with the
1380: .Ic set-window-option
1381: command.
1382: .Pp
1383: Commands which set options are as follows:
1384: .Bl -tag -width Ds
1.1 nicm 1385: .It Xo Ic set-option
1.133 nicm 1386: .Op Fl agsuw
1.129 nicm 1387: .Op Fl t Ar target-session | Ar target-window
1.1 nicm 1388: .Ar option Ar value
1389: .Xc
1390: .D1 (alias: Ic set )
1.133 nicm 1391: Set a window option with
1392: .Fl w
1393: (equivalent to the
1394: .Ic set-window-option
1395: command),
1396: a server option with
1397: .Fl s ,
1398: otherwise a session option.
1399: .Pp
1400: If
1401: .Fl g
1402: is specified, the global session or window option is set.
1.58 nicm 1403: With
1404: .Fl a ,
1405: and if the option expects a string,
1406: .Ar value
1407: is appended to the existing setting.
1.1 nicm 1408: The
1409: .Fl u
1410: flag unsets an option, so a session inherits the option from the global
1.133 nicm 1411: options.
1412: It is not possible to unset a global option.
1.1 nicm 1413: .Pp
1.133 nicm 1414: Available window options are listed under
1415: .Ic set-window-option .
1416: .Pp
1417: Available server options are:
1418: .Bl -tag -width Ds
1.134 nicm 1419: .It Ic escape-time
1420: Set the time in milliseconds for which
1421: .Nm
1422: waits after an escape is input to determine if it is part of a function or meta
1423: key sequences.
1424: The default is 500 milliseconds.
1.133 nicm 1425: .It Ic quiet
1.134 nicm 1426: Enable or disable the display of various informational messages (see also the
1.133 nicm 1427: .Fl q
1428: command line flag).
1429: .El
1.129 nicm 1430: .Pp
1.18 nicm 1431: Available session options are:
1.1 nicm 1432: .Bl -tag -width Ds
1.69 nicm 1433: .It Ic base-index Ar index
1434: Set the base index from which an unused index should be searched when a new
1435: window is created.
1436: The default is zero.
1.1 nicm 1437: .It Xo Ic bell-action
1.56 jmc 1438: .Op Ic any | none | current
1.1 nicm 1439: .Xc
1440: Set action on window bell.
1441: .Ic any
1442: means a bell in any window linked to a session causes a bell in the current
1443: window of that session,
1444: .Ic none
1445: means all bells are ignored and
1446: .Ic current
1447: means only bell in windows other than the current window are ignored.
1448: .It Ic buffer-limit Ar number
1449: Set the number of buffers kept for each session; as new buffers are added to
1450: the top of the stack, old ones are removed from the bottom if necessary to
1451: maintain this maximum length.
1.153 ! nicm 1452: .It Ic default-command Ar shell-command
1.1 nicm 1453: Set the command used for new windows (if not specified when the window is
1454: created) to
1.153 ! nicm 1455: .Ar shell-command ,
1.79 nicm 1456: which may be any
1457: .Xr sh 1
1458: command.
1.19 nicm 1459: The default is an empty string, which instructs
1460: .Nm
1.79 nicm 1461: to create a login shell using the value of the
1462: .Ic default-shell
1463: option.
1464: .It Ic default-shell Ar path
1465: Specify the default shell.
1466: This is used as the login shell for new windows when the
1467: .Ic default-command
1468: option is set to empty, and must be the full path of the executable.
1469: When started
1470: .Nm
1471: tries to set a default value from the first suitable of the
1.19 nicm 1472: .Ev SHELL
1.79 nicm 1473: environment variable, the shell returned by
1474: .Xr getpwuid 3 ,
1475: or
1476: .Pa /bin/sh .
1477: This option should be configured when
1478: .Nm
1479: is used as a login shell.
1.1 nicm 1480: .It Ic default-path Ar path
1481: Set the default working directory for processes created from keys, or
1482: interactively from the prompt.
1483: The default is the current working directory when the server is started.
1.22 nicm 1484: .It Ic default-terminal Ar terminal
1485: Set the default terminal for new windows created in this session - the
1486: default value of the
1487: .Ev TERM
1488: environment variable.
1489: For
1490: .Nm
1491: to work correctly, this
1492: .Em must
1493: be set to
1494: .Ql screen
1495: or a derivative of it.
1.145 nicm 1496: .It Ic display-panes-active-colour Ar colour
1497: Set the colour used by the
1498: .Ic display-panes
1499: command to show the indicator for the active pane.
1.78 nicm 1500: .It Ic display-panes-colour Ar colour
1.145 nicm 1501: Set the colour used by the
1.78 nicm 1502: .Ic display-panes
1.145 nicm 1503: command to show the indicators for inactive panes.
1.78 nicm 1504: .It Ic display-panes-time Ar time
1505: Set the time in milliseconds for which the indicators shown by the
1506: .Ic display-panes
1507: command appear.
1.21 nicm 1508: .It Ic display-time Ar time
1.78 nicm 1509: Set the amount of time for which status line messages and other on-screen
1510: indicators are displayed.
1.21 nicm 1511: .Ar time
1512: is in milliseconds.
1.1 nicm 1513: .It Ic history-limit Ar lines
1514: Set the maximum number of lines held in window history.
1515: This setting applies only to new windows - existing window histories are not
1516: resized and retain the limit at the point they were created.
1517: .It Ic lock-after-time Ar number
1.100 nicm 1518: Lock the session (like the
1519: .Ic lock-session
1.90 nicm 1520: command) after
1.1 nicm 1521: .Ar number
1.100 nicm 1522: seconds of inactivity, or the entire server (all sessions) if the
1523: .Ic lock-server
1524: option is set.
1525: The default is not to lock (set to 0).
1.153 ! nicm 1526: .It Ic lock-command Ar shell-command
1.90 nicm 1527: Command to run when locking each client.
1528: The default is to run
1529: .Xr lock 1
1530: with
1531: .Fl np .
1.100 nicm 1532: .It Xo Ic lock-server
1533: .Op Ic on | off
1534: .Xc
1535: If this option is
1.102 nicm 1536: .Ic on
1.100 nicm 1537: (the default),
1538: instead of each session locking individually as each has been
1539: idle for
1.108 jmc 1540: .Ic lock-after-time ,
1541: the entire server will lock after
1.100 nicm 1542: .Em all
1543: sessions would have locked.
1544: This has no effect as a session option; it must be set as a global option.
1.1 nicm 1545: .It Ic message-attr Ar attributes
1546: Set status line message attributes, where
1547: .Ar attributes
1548: is either
1549: .Ic default
1550: or a comma-delimited list of one or more of:
1551: .Ic bright
1552: (or
1553: .Ic bold ) ,
1554: .Ic dim ,
1555: .Ic underscore ,
1556: .Ic blink ,
1557: .Ic reverse ,
1558: .Ic hidden ,
1559: or
1560: .Ic italics .
1561: .It Ic message-bg Ar colour
1562: Set status line message background colour, where
1563: .Ar colour
1564: is one of:
1565: .Ic black ,
1566: .Ic red ,
1567: .Ic green ,
1568: .Ic yellow ,
1569: .Ic blue ,
1570: .Ic magenta ,
1571: .Ic cyan ,
1.85 nicm 1572: .Ic white ,
1573: .Ic colour0
1574: to
1575: .Ic colour255
1576: from the 256-colour palette, or
1.1 nicm 1577: .Ic default .
1578: .It Ic message-fg Ar colour
1579: Set status line message foreground colour.
1.120 nicm 1580: .It Ic message-limit Ar number
1581: Set the number of error or information messages to save in the message log for
1582: each client.
1583: The default is 20.
1.102 nicm 1584: .It Xo Ic mouse-select-pane
1585: .Op Ic on | off
1586: .Xc
1587: If on,
1588: .Nm
1589: captures the mouse and when a window is split into multiple panes the mouse may
1590: be used to select the current pane.
1591: The mouse click is also passed through to the application as normal.
1.135 nicm 1592: .It Ic pane-border-fg Ar colour
1593: .It Ic pane-border-bg Ar colour
1594: Set the pane border colour for panes aside from the active pane.
1595: .It Ic pane-active-border-fg Ar colour
1596: .It Ic pane-active-border-bg Ar colour
1597: Set the pane border colour for the currently active pane.
1.89 nicm 1598: .It Ic prefix Ar keys
1599: Set the keys accepted as a prefix key.
1600: .Ar keys
1601: is a comma-separated list of key names, each of which individually behave as
1602: the prefix key.
1.21 nicm 1603: .It Ic repeat-time Ar time
1.1 nicm 1604: Allow multiple commands to be entered without pressing the prefix-key again
1605: in the specified
1.21 nicm 1606: .Ar time
1.1 nicm 1607: milliseconds (the default is 500).
1608: Whether a key repeats may be set when it is bound using the
1609: .Fl r
1610: flag to
1611: .Ic bind-key .
1.52 nicm 1612: Repeat is enabled for the default keys bound to the
1613: .Ic resize-pane
1614: command.
1.1 nicm 1615: .It Xo Ic set-remain-on-exit
1.56 jmc 1616: .Op Ic on | off
1.1 nicm 1617: .Xc
1618: Set the
1619: .Ic remain-on-exit
1620: window option for any windows first created in this session.
1.153 ! nicm 1621: When this option is true, windows in which the running program has
! 1622: exited do not close, instead remaining open but inactivate.
! 1623: Use the
! 1624: .Ic respawn-window
! 1625: command to reactivate such a window, or the
! 1626: .Ic kill-window
! 1627: command to destroy it.
1.1 nicm 1628: .It Xo Ic set-titles
1.56 jmc 1629: .Op Ic on | off
1.1 nicm 1630: .Xc
1.77 stsp 1631: Attempt to set the window title using the \ee]2;...\e007 xterm code if
1.1 nicm 1632: the terminal appears to be an xterm.
1.11 nicm 1633: This option is off by default.
1.6 jmc 1634: Note that elinks
1.1 nicm 1635: will only attempt to set the window title if the STY environment
1636: variable is set.
1.86 nicm 1637: .It Ic set-titles-string Ar string
1638: String used to set the window title if
1639: .Ic set-titles
1640: is on.
1641: Character sequences are replaced as for the
1642: .Ic status-left
1643: option.
1.1 nicm 1644: .It Xo Ic status
1.56 jmc 1645: .Op Ic on | off
1.1 nicm 1646: .Xc
1647: Show or hide the status line.
1648: .It Ic status-attr Ar attributes
1649: Set status line attributes.
1650: .It Ic status-bg Ar colour
1651: Set status line background colour.
1652: .It Ic status-fg Ar colour
1653: Set status line foreground colour.
1654: .It Ic status-interval Ar interval
1655: Update the status bar every
1656: .Ar interval
1657: seconds.
1658: By default, updates will occur every 15 seconds.
1659: A setting of zero disables redrawing at interval.
1.41 nicm 1660: .It Xo Ic status-justify
1.56 jmc 1661: .Op Ic left | centre | right
1.41 nicm 1662: .Xc
1663: Set the position of the window list component of the status line: left, centre
1664: or right justified.
1.1 nicm 1665: .It Xo Ic status-keys
1.56 jmc 1666: .Op Ic vi | emacs
1.1 nicm 1667: .Xc
1.6 jmc 1668: Use vi or emacs-style
1.1 nicm 1669: key bindings in the status line, for example at the command prompt.
1670: Defaults to emacs.
1671: .It Ic status-left Ar string
1672: Display
1673: .Ar string
1674: to the left of the status bar.
1675: .Ar string
1676: will be passed through
1677: .Xr strftime 3
1678: before being used.
1679: By default, the session name is shown.
1680: .Ar string
1.83 nicm 1681: may contain any of the following special character sequences:
1.1 nicm 1682: .Bl -column "Character pair" "Replaced with" -offset indent
1683: .It Sy "Character pair" Ta Sy "Replaced with"
1.153 ! nicm 1684: .It Li "#(shell-command)" Ta "First line of the command's output"
1.83 nicm 1685: .It Li "#[attributes]" Ta "Colour or attribute change"
1.1 nicm 1686: .It Li "#H" Ta "Hostname of local host"
1.125 nicm 1687: .It Li "#F" Ta "Current window flag"
1.35 nicm 1688: .It Li "#I" Ta "Current window index"
1689: .It Li "#P" Ta "Current pane index"
1.1 nicm 1690: .It Li "#S" Ta "Session name"
1691: .It Li "#T" Ta "Current window title"
1.35 nicm 1692: .It Li "#W" Ta "Current window name"
1.1 nicm 1693: .It Li "##" Ta "A literal" Ql #
1694: .El
1.83 nicm 1695: .Pp
1.153 ! nicm 1696: The #(shell-command) form executes
! 1697: .Ql shell-command
! 1698: and inserts the first line of its output.
1.103 nicm 1699: Note that shell commands are only executed once at the interval specified by
1700: the
1701: .Ic status-interval
1702: option: if the status line is redrawn in the meantime, the previous result is
1703: used.
1.109 nicm 1704: .Pp
1.83 nicm 1705: #[attributes] allows a comma-separated list of attributes to be specified,
1706: these may be
1707: .Ql fg=colour
1708: to set the foreground colour,
1709: .Ql bg=colour
1.131 nicm 1710: to set the background colour, the name of one of the attributes (listed under
1711: the
1.83 nicm 1712: .Ic message-attr
1.109 nicm 1713: option) to turn an attribute on, or an attribute prefixed with
1714: .Ql no
1715: to turn one off, for example
1716: .Ic nobright .
1.83 nicm 1717: Examples are:
1718: .Bd -literal -offset indent
1719: #(sysctl vm.loadavg)
1720: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
1721: .Ed
1.1 nicm 1722: .Pp
1.109 nicm 1723: Where appropriate, special character sequences may be prefixed with a number to
1724: specify the maximum length, for example
1.1 nicm 1725: .Ql #24T .
1.10 nicm 1726: .Pp
1.12 jmc 1727: By default, UTF-8 in
1.10 nicm 1728: .Ar string
1729: is not interpreted, to enable UTF-8, use the
1730: .Ic status-utf8
1731: option.
1.62 nicm 1732: .It Ic status-left-attr Ar attributes
1.66 jmc 1733: Set the attribute of the left part of the status line.
1.62 nicm 1734: .It Ic status-left-fg Ar colour
1735: Set the foreground colour of the left part of the status line.
1736: .It Ic status-left-bg Ar colour
1737: Set the background colour of the left part of the status line.
1.1 nicm 1738: .It Ic status-left-length Ar length
1739: Set the maximum
1740: .Ar length
1741: of the left component of the status bar.
1742: The default is 10.
1743: .It Ic status-right Ar string
1744: Display
1745: .Ar string
1746: to the right of the status bar.
1.151 nicm 1747: By default, the current window title in double quotes, the date and the time
1748: are shown.
1.1 nicm 1749: As with
1750: .Ic status-left ,
1751: .Ar string
1752: will be passed to
1.10 nicm 1753: .Xr strftime 3 ,
1754: character pairs are replaced, and UTF-8 is dependent on the
1755: .Ic status-utf8
1756: option.
1.62 nicm 1757: .It Ic status-right-attr Ar attributes
1.66 jmc 1758: Set the attribute of the right part of the status line.
1.62 nicm 1759: .It Ic status-right-fg Ar colour
1760: Set the foreground colour of the right part of the status line.
1761: .It Ic status-right-bg Ar colour
1762: Set the background colour of the right part of the status line.
1.1 nicm 1763: .It Ic status-right-length Ar length
1764: Set the maximum
1765: .Ar length
1766: of the right component of the status bar.
1767: The default is 40.
1.10 nicm 1768: .Pp
1769: .It Xo Ic status-utf8
1.56 jmc 1770: .Op Ic on | off
1.10 nicm 1771: .Xc
1772: Instruct
1773: .Nm
1774: to treat top-bit-set characters in the
1775: .Ic status-left
1776: and
1777: .Ic status-right
1778: strings as UTF-8; notably, this is important for wide characters.
1779: This option defaults to off.
1.55 jmc 1780: .It Ic terminal-overrides Ar string
1.54 nicm 1781: Contains a list of entries which override terminal descriptions read using
1782: .Xr terminfo 5 .
1783: .Ar string
1784: is a comma-separated list of items each a colon-separated string made up of a
1785: terminal type pattern (matched using
1786: .Xr fnmatch 3 )
1787: and a set of
1788: .Em name=value
1789: entries.
1790: .Pp
1791: For example, to set the
1792: .Ql clear
1793: .Xr terminfo 5
1794: entry to
1795: .Ql \ee[H\ee[2J
1796: for all terminal types and the
1797: .Ql dch1
1798: entry to
1799: .Ql \ee[P
1.55 jmc 1800: for the
1.54 nicm 1801: .Ql rxvt
1802: terminal type, the option could be set to the string:
1803: .Bd -literal -offset indent
1804: "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
1805: .Ed
1806: .Pp
1807: The terminal entry value is passed through
1808: .Xr strunvis 3
1809: before interpretation.
1810: The default value forcibly corrects the
1811: .Ql colors
1812: entry for terminals which support 88 or 256 colours:
1813: .Bd -literal -offset indent
1814: "*88col*:colors=88,*256col*:colors=256"
1815: .Ed
1.63 nicm 1816: .It Ic update-environment Ar variables
1817: Set a space-separated string containing a list of environment variables to be
1818: copied into the session environment when a new session is created or an
1819: existing session is attached.
1820: Any variables that do not exist in the source environment are set to be
1821: removed from the session environment (as if
1822: .Fl r
1823: was given to the
1824: .Ic set-environment
1825: command).
1826: The default is
1.75 nicm 1827: "DISPLAY WINDOWID SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION".
1.37 nicm 1828: .It Xo Ic visual-activity
1.56 jmc 1829: .Op Ic on | off
1.37 nicm 1830: .Xc
1831: If on, display a status line message when activity occurs in a window
1.39 jmc 1832: for which the
1.37 nicm 1833: .Ic monitor-activity
1834: window option is enabled.
1835: .It Xo Ic visual-bell
1.56 jmc 1836: .Op Ic on | off
1.37 nicm 1837: .Xc
1838: If this option is on, a message is shown on a bell instead of it being passed
1839: through to the terminal (which normally makes a sound).
1840: Also see the
1841: .Ic bell-action
1842: option.
1843: .It Xo Ic visual-content
1.56 jmc 1844: .Op Ic on | off
1.37 nicm 1845: .Xc
1846: Like
1847: .Ic visual-activity ,
1848: display a message when content is present in a window
1.39 jmc 1849: for which the
1.37 nicm 1850: .Ic monitor-content
1851: window option is enabled.
1.1 nicm 1852: .El
1853: .It Xo Ic set-window-option
1.58 nicm 1854: .Op Fl agu
1.1 nicm 1855: .Op Fl t Ar target-window
1856: .Ar option Ar value
1857: .Xc
1858: .D1 (alias: Ic setw )
1.18 nicm 1859: Set a window option.
1.1 nicm 1860: The
1.58 nicm 1861: .Fl a ,
1.1 nicm 1862: .Fl g
1863: and
1864: .Fl u
1865: flags work similarly to the
1866: .Ic set-option
1867: command.
1868: .Pp
1.18 nicm 1869: Supported window options are:
1.56 jmc 1870: .Pp
1871: .Bl -tag -width Ds -compact
1.1 nicm 1872: .It Xo Ic aggressive-resize
1.56 jmc 1873: .Op Ic on | off
1.1 nicm 1874: .Xc
1875: Aggressively resize the chosen window.
1876: This means that
1877: .Nm
1878: will resize the window to the size of the smallest session for which it is the
1879: current window, rather than the smallest session to which it is attached.
1880: The window may resize when the current window is changed on another sessions;
1.6 jmc 1881: this option is good for full-screen programs which support
1882: .Dv SIGWINCH
1883: and poor for interactive programs such as shells.
1.56 jmc 1884: .Pp
1.1 nicm 1885: .It Xo Ic automatic-rename
1.56 jmc 1886: .Op Ic on | off
1.1 nicm 1887: .Xc
1888: Control automatic window renaming.
1889: When this setting is enabled,
1890: .Nm
1891: will attempt - on supported platforms - to rename the window to reflect the
1892: command currently running in it.
1893: This flag is automatically disabled for an individual window when a name
1894: is specified at creation with
1895: .Ic new-window or
1896: .Ic new-session ,
1897: or later with
1898: .Ic rename-window .
1899: It may be switched off globally with:
1900: .Bd -literal -offset indent
1901: set-window-option -g automatic-rename off
1902: .Ed
1.56 jmc 1903: .Pp
1.1 nicm 1904: .It Ic clock-mode-colour Ar colour
1905: Set clock colour.
1.56 jmc 1906: .Pp
1.1 nicm 1907: .It Xo Ic clock-mode-style
1.56 jmc 1908: .Op Ic 12 | 24
1.1 nicm 1909: .Xc
1910: Set clock hour format.
1.56 jmc 1911: .Pp
1.1 nicm 1912: .It Ic force-height Ar height
1913: .It Ic force-width Ar width
1914: Prevent
1915: .Nm
1916: from resizing a window to greater than
1917: .Ar width
1918: or
1919: .Ar height .
1920: A value of zero restores the default unlimited setting.
1.56 jmc 1921: .Pp
1.2 nicm 1922: .It Ic main-pane-width Ar width
1923: .It Ic main-pane-height Ar height
1924: Set the width or height of the main (left or top) pane in the
1925: .Ic main-horizontal
1926: or
1927: .Ic main-vertical
1928: layouts.
1.56 jmc 1929: .Pp
1.1 nicm 1930: .It Ic mode-attr Ar attributes
1931: Set window modes attributes.
1.56 jmc 1932: .Pp
1.1 nicm 1933: .It Ic mode-bg Ar colour
1934: Set window modes background colour.
1.56 jmc 1935: .Pp
1.1 nicm 1936: .It Ic mode-fg Ar colour
1937: Set window modes foreground colour.
1.56 jmc 1938: .Pp
1.1 nicm 1939: .It Xo Ic mode-keys
1.56 jmc 1940: .Op Ic vi | emacs
1.1 nicm 1941: .Xc
1.105 nicm 1942: Use vi or emacs-style key bindings in copy and choice modes.
1.1 nicm 1943: Key bindings default to emacs.
1.56 jmc 1944: .Pp
1.50 nicm 1945: .It Xo Ic mode-mouse
1.56 jmc 1946: .Op Ic on | off
1.50 nicm 1947: .Xc
1.51 jmc 1948: Mouse state in modes.
1949: If on,
1.50 nicm 1950: .Nm
1951: will respond to mouse clicks by moving the cursor in copy mode or selecting an
1952: option in choice mode.
1.56 jmc 1953: .Pp
1.1 nicm 1954: .It Xo Ic monitor-activity
1.56 jmc 1955: .Op Ic on | off
1.1 nicm 1956: .Xc
1957: Monitor for activity in the window.
1958: Windows with activity are highlighted in the status line.
1.56 jmc 1959: .Pp
1960: .It Ic monitor-content Ar match-string
1.6 jmc 1961: Monitor content in the window.
1962: When
1.16 nicm 1963: .Xr fnmatch 3
1964: pattern
1.1 nicm 1965: .Ar match-string
1966: appears in the window, it is highlighted in the status line.
1.56 jmc 1967: .Pp
1.1 nicm 1968: .It Xo Ic remain-on-exit
1.56 jmc 1969: .Op Ic on | off
1.1 nicm 1970: .Xc
1971: A window with this flag set is not destroyed when the program running in it
1972: exits.
1973: The window may be reactivated with the
1974: .Ic respawn-window
1975: command.
1.56 jmc 1976: .Pp
1.99 nicm 1977: .It Xo Ic synchronize-panes
1978: .Op Ic on | off
1979: .Xc
1980: Duplicate input to any pane to all other panes in the same window, except
1981: for panes that are not in output mode.
1.150 nicm 1982: .Pp
1983: .It Xo Ic alternate-screen
1984: .Op Ic on | off
1985: .Xc
1986: This option configures whether programs running inside
1987: .Nm
1988: may use the terminal alternate screen feature, which allows the
1989: .Em smcup
1990: and
1991: .Em rmcup
1992: .Xr terminfo 5
1993: capabilities to be issued to preserve the existing window content on start and
1994: restore it on exit.
1.139 nicm 1995: .Pp
1.1 nicm 1996: .It Xo Ic utf8
1.56 jmc 1997: .Op Ic on | off
1.1 nicm 1998: .Xc
1999: Instructs
2000: .Nm
2001: to expect UTF-8 sequences to appear in this window.
1.56 jmc 2002: .Pp
1.1 nicm 2003: .It Ic window-status-attr Ar attributes
2004: Set status line attributes for a single window.
1.56 jmc 2005: .Pp
1.1 nicm 2006: .It Ic window-status-bg Ar colour
2007: Set status line background colour for a single window.
1.56 jmc 2008: .Pp
1.1 nicm 2009: .It Ic window-status-fg Ar colour
2010: Set status line foreground colour for a single window.
1.56 jmc 2011: .Pp
1.125 nicm 2012: .It Ic window-status-format Ar string
2013: Set the format in which the window is displayed in the status line window list.
2014: See the
2015: .Ar status-left
2016: option for details of special character sequences available.
2017: The default is
2018: .Ql #I:#W#F .
2019: .Pp
1.40 nicm 2020: .It Ic window-status-current-attr Ar attributes
2021: Set status line attributes for the currently active window.
1.56 jmc 2022: .Pp
1.40 nicm 2023: .It Ic window-status-current-bg Ar colour
2024: Set status line background colour for the currently active window.
1.56 jmc 2025: .Pp
1.40 nicm 2026: .It Ic window-status-current-fg Ar colour
2027: Set status line foreground colour for the currently active window.
1.56 jmc 2028: .Pp
1.125 nicm 2029: .It Ic window-status-current-format Ar string
2030: Like
2031: .Ar window-status-format ,
2032: but is the format used when the window is the current window.
2033: .Pp
1.1 nicm 2034: .It Xo Ic xterm-keys
1.56 jmc 2035: .Op Ic on | off
1.1 nicm 2036: .Xc
2037: If this option is set,
2038: .Nm
2039: will generate
1.57 jmc 2040: .Xr xterm 1 -style
2041: function key sequences; these have a number included to indicate modifiers such
2042: as Shift, Alt or Ctrl.
1.123 nicm 2043: The default is off.
1.57 jmc 2044: .El
2045: .It Xo Ic show-options
1.133 nicm 2046: .Op Fl gsw
1.129 nicm 2047: .Op Fl t Ar target-session | Ar target-window
1.57 jmc 2048: .Xc
2049: .D1 (alias: Ic show )
1.133 nicm 2050: Show the window options with
1.129 nicm 2051: .Fl w
1.133 nicm 2052: (equivalent to
1.134 nicm 2053: .Ic show-window-options ) ,
1.133 nicm 2054: the server options with
2055: .Fl s ,
2056: otherwise the session options for
2057: .Ar target session .
2058: Global session or window options are listed if
2059: .Fl g
2060: is used.
1.57 jmc 2061: .It Xo Ic show-window-options
2062: .Op Fl g
2063: .Op Fl t Ar target-window
2064: .Xc
2065: .D1 (alias: Ic showw )
2066: List the window options for
2067: .Ar target-window ,
2068: or the global window options if
2069: .Fl g
2070: is used.
1.63 nicm 2071: .El
2072: .Sh ENVIRONMENT
2073: When the server is started,
2074: .Nm
2075: copies the environment into the
2076: .Em global environment ;
2077: in addition, each session has a
2078: .Em session environment .
2079: When a window is created, the session and global environments are merged with
2080: the session environment overriding any variable present in both.
2081: This is the initial environment passed to the new process.
2082: .Pp
2083: The
2084: .Ic update-environment
2085: session option may be used to update the session environment from the client
2086: when a new session is created or an old reattached.
2087: .Nm
2088: also initialises the
2089: .Ev TMUX
2090: variable with some internal information to allow commands to be executed
2091: from inside, and the
2092: .Ev TERM
2093: variable with the correct terminal setting of
2094: .Ql screen .
2095: .Pp
2096: Commands to alter and view the environment are:
2097: .Bl -tag -width Ds
2098: .It Xo Ic set-environment
2099: .Op Fl gru
2100: .Op Fl t Ar target-session
2101: .Ar name Op Ar value
2102: .Xc
1.115 nicm 2103: .D1 (alias: Ic setenv )
1.63 nicm 2104: Set or unset an environment variable.
2105: If
2106: .Fl g
2107: is used, the change is made in the global environment; otherwise, it is applied
2108: to the session environment for
2109: .Ar target-session .
2110: The
2111: .Fl u
2112: flag unsets a variable.
2113: .Fl r
2114: indicates the variable is to be removed from the environment before starting a
2115: new process.
2116: .It Xo Ic show-environment
2117: .Op Fl g
2118: .Op Fl t Ar target-session
2119: .Xc
1.115 nicm 2120: .D1 (alias: Ic showenv )
1.63 nicm 2121: Display the environment for
2122: .Ar target-session
2123: or the global environment with
2124: .Fl g .
2125: Variables removed from the environment are prefixed with
2126: .Ql - .
1.57 jmc 2127: .El
2128: .Sh STATUS LINE
2129: .Nm
2130: includes an optional status line which is displayed in the bottom line of each
2131: terminal.
2132: By default, the status line is enabled (it may be disabled with the
2133: .Ic status
2134: session option) and contains, from left-to-right: the name of the current
2135: session in square brackets; the window list; the current window title in double
2136: quotes; and the time and date.
2137: .Pp
2138: The status line is made of three parts: configurable left and right sections
2139: (which may contain dynamic content such as the time or output from a shell
2140: command, see the
2141: .Ic status-left ,
2142: .Ic status-left-length ,
2143: .Ic status-right ,
2144: and
2145: .Ic status-right-length
2146: options below), and a central window list.
1.125 nicm 2147: By default, the window list shows the index, name and (if any) flag of the
2148: windows present in the current session in ascending numerical order.
2149: It may be customised with the
2150: .Ar window-status-format
2151: and
2152: .Ar window-status-current-format
2153: options.
1.57 jmc 2154: The flag is one of the following symbols appended to the window name:
2155: .Bl -column "Symbol" "Meaning" -offset indent
2156: .It Sy "Symbol" Ta Sy "Meaning"
2157: .It Li "*" Ta "Denotes the current window."
2158: .It Li "-" Ta "Marks the last window (previously selected)."
2159: .It Li "#" Ta "Window is monitored and activity has been detected."
2160: .It Li "!" Ta "A bell has occurred in the window."
2161: .It Li "+" Ta "Window is monitored for content and it has appeared."
2162: .El
2163: .Pp
2164: The # symbol relates to the
2165: .Ic monitor-activity
2166: and + to the
2167: .Ic monitor-content
2168: window options.
2169: The window name is printed in inverted colours if an alert (bell, activity or
2170: content) is present.
2171: .Pp
1.131 nicm 2172: The colour and attributes of the status line may be configured, the entire
2173: status line using the
1.57 jmc 2174: .Ic status-attr ,
2175: .Ic status-fg
2176: and
2177: .Ic status-bg
2178: session options and individual windows using the
2179: .Ic window-status-attr ,
2180: .Ic window-status-fg
2181: and
2182: .Ic window-status-bg
2183: window options.
2184: .Pp
1.131 nicm 2185: The status line is automatically refreshed at interval if it has changed, the
2186: interval may be controlled with the
1.57 jmc 2187: .Ic status-interval
2188: session option.
2189: .Pp
2190: Commands related to the status line are as follows:
2191: .Bl -tag -width Ds
2192: .It Xo Ic command-prompt
1.73 nicm 2193: .Op Fl p Ar prompts
1.57 jmc 2194: .Op Fl t Ar target-client
2195: .Op Ar template
2196: .Xc
2197: Open the command prompt in a client.
2198: This may be used from inside
2199: .Nm
2200: to execute commands interactively.
2201: If
2202: .Ar template
1.73 nicm 2203: is specified, it is used as the command.
2204: If
2205: .Fl p
2206: is given,
2207: .Ar prompts
2208: is a comma-separated list of prompts which are displayed in order; otherwise
2209: a single prompt is displayed, constructed from
2210: .Ar template
2211: if it is present, or
2212: .Ql \&:
2213: if not.
2214: Before the command is executed, the first occurrence of the string
2215: .Ql %%
1.74 jmc 2216: and all occurrences of
1.73 nicm 2217: .Ql %1
2218: are replaced by the response to the first prompt, the second
2219: .Ql %%
2220: and all
2221: .Ql %2
2222: are replaced with the response to the second prompt, and so on for further
1.74 jmc 2223: prompts.
2224: Up to nine prompt responses may be replaced
2225: .Po
2226: .Ql %1
1.73 nicm 2227: to
1.74 jmc 2228: .Ql %9
2229: .Pc .
1.57 jmc 2230: .It Xo Ic confirm-before
2231: .Op Fl t Ar target-client
2232: .Ar command
2233: .Xc
2234: .D1 (alias: Ic confirm )
2235: Ask for confirmation before executing
2236: .Ar command .
2237: This command works only from inside
2238: .Nm .
2239: .It Xo Ic display-message
1.127 nicm 2240: .Op Fl p
1.57 jmc 2241: .Op Fl t Ar target-client
2242: .Op Ar message
2243: .Xc
2244: .D1 (alias: Ic display )
1.127 nicm 2245: Display a message.
2246: If
2247: .Fl p
2248: is given, the output is printed to stdout, otherwise it is displayed in the
2249: .Ar target-client
2250: status line.
1.122 nicm 2251: The format of
1.124 jmc 2252: .Ar message
2253: is as for
1.122 nicm 2254: .Ic status-left ,
2255: with the exception that #() are not handled.
1.57 jmc 2256: .It Ic select-prompt Op Fl t Ar target-client
2257: Open a prompt inside
2258: .Ar target-client
2259: allowing a window index to be entered interactively.
2260: .El
2261: .Sh BUFFERS
2262: .Nm
2263: maintains a stack of
2264: .Em paste buffers
2265: for each session.
2266: Up to the value of the
2267: .Ic buffer-limit
2268: option are kept; when a new buffer is added, the buffer at the bottom of the
2269: stack is removed.
2270: Buffers may be added using
2271: .Ic copy-mode
2272: or the
2273: .Ic set-buffer
2274: command, and pasted into a window using the
2275: .Ic paste-buffer
2276: command.
2277: .Pp
2278: A configurable history buffer is also maintained for each window.
2279: By default, up to 2000 lines are kept; this can be altered with the
2280: .Ic history-limit
2281: option (see the
2282: .Ic set-option
2283: command above).
2284: .Pp
2285: The buffer commands are as follows:
2286: .Bl -tag -width Ds
2287: .It Ic clear-history Op Fl t Ar target-pane
2288: .D1 (alias: Ic clearhist )
2289: Remove and free the history for the specified pane.
2290: .It Xo Ic copy-buffer
2291: .Op Fl a Ar src-index
2292: .Op Fl b Ar dst-index
2293: .Op Fl s Ar src-session
2294: .Op Fl t Ar dst-session
2295: .Xc
2296: .D1 (alias: Ic copyb )
2297: Copy a session paste buffer to another session.
2298: If no sessions are specified, the current one is used instead.
2299: .It Xo Ic delete-buffer
2300: .Op Fl b Ar buffer-index
2301: .Op Fl t Ar target-session
2302: .Xc
2303: .D1 (alias: Ic deleteb )
2304: Delete the buffer at
2305: .Ar buffer-index ,
2306: or the top buffer if not specified.
2307: .It Ic list-buffers Op Fl t Ar target-session
2308: .D1 (alias: Ic lsb )
2309: List the buffers in the given session.
2310: .It Xo Ic load-buffer
2311: .Op Fl b Ar buffer-index
2312: .Op Fl t Ar target-session
2313: .Ar path
2314: .Xc
2315: .D1 (alias: Ic loadb )
2316: Load the contents of the specified paste buffer from
2317: .Ar path .
2318: .It Xo Ic paste-buffer
2319: .Op Fl dr
2320: .Op Fl b Ar buffer-index
2321: .Op Fl t Ar target-window
2322: .Xc
2323: .D1 (alias: Ic pasteb )
2324: Insert the contents of a paste buffer into the current window.
2325: With
2326: .Fl d ,
2327: also delete the paste buffer from the stack.
2328: When output, any linefeed (LF) characters in the paste buffer are replaced with
2329: carriage returns (CR).
2330: This translation may be disabled with the
2331: .Fl r
2332: flag.
2333: .It Xo Ic save-buffer
2334: .Op Fl a
2335: .Op Fl b Ar buffer-index
2336: .Op Fl t Ar target-session
2337: .Ar path
2338: .Xc
2339: .D1 (alias: Ic saveb )
2340: Save the contents of the specified paste buffer to
2341: .Ar path .
2342: The
2343: .Fl a
2344: option appends to rather than overwriting the file.
2345: .It Xo Ic set-buffer
2346: .Op Fl b Ar buffer-index
2347: .Op Fl t Ar target-session
2348: .Ar data
2349: .Xc
2350: .D1 (alias: Ic setb )
2351: Set the contents of the specified buffer to
2352: .Ar data .
1.1 nicm 2353: .It Xo Ic show-buffer
2354: .Op Fl b Ar buffer-index
2355: .Op Fl t Ar target-session
2356: .Xc
2357: .D1 (alias: Ic showb )
2358: Display the contents of the specified buffer.
1.57 jmc 2359: .El
2360: .Sh MISCELLANEOUS
2361: .Pp
2362: Miscellaneous commands are as follows:
2363: .Bl -tag -width Ds
1.72 nicm 2364: .It Ic clock-mode Op Fl t Ar target-pane
1.57 jmc 2365: Display a large clock.
2366: .It Ic if-shell Ar shell-command command
2367: .D1 (alias: Ic if )
2368: Execute
2369: .Ar command
2370: if
2371: .Ar shell-command
2372: returns success.
2373: .It Ic lock-server
2374: .D1 (alias: Ic lock )
1.90 nicm 2375: Lock each client individually by running the command specified by the
2376: .Ic lock-command
2377: option.
1.153 ! nicm 2378: .It Ic run-shell Ar shell-command
1.87 nicm 2379: .D1 (alias: Ic run )
2380: Execute
1.153 ! nicm 2381: .Ar shell-command
1.106 nicm 2382: in the background without creating a window.
1.153 ! nicm 2383: After it finishes, any output to stdout is displayed in output mode.
! 2384: If the command doesn't return success, the exit status is also displayed.
1.57 jmc 2385: .It Ic server-info
2386: .D1 (alias: Ic info )
2387: Show server information and terminal details.
1.1 nicm 2388: .El
2389: .Sh FILES
1.26 nicm 2390: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1 nicm 2391: .It Pa ~/.tmux.conf
1.6 jmc 2392: Default
1.1 nicm 2393: .Nm
1.6 jmc 2394: configuration file.
1.26 nicm 2395: .It Pa /etc/tmux.conf
2396: System-wide configuration file.
1.1 nicm 2397: .El
1.57 jmc 2398: .Sh EXAMPLES
2399: To create a new
2400: .Nm
2401: session running
2402: .Xr vi 1 :
2403: .Pp
2404: .Dl $ tmux new-session vi
2405: .Pp
2406: Most commands have a shorter form, known as an alias.
2407: For new-session, this is
2408: .Ic new :
2409: .Pp
2410: .Dl $ tmux new vi
2411: .Pp
2412: Alternatively, the shortest unambiguous form of a command is accepted.
2413: If there are several options, they are listed:
2414: .Bd -literal -offset indent
2415: $ tmux n
2416: ambiguous command: n, could be: new-session, new-window, next-window
2417: .Ed
2418: .Pp
2419: Within an active session, a new window may be created by typing
2420: .Ql C-b c
2421: (Ctrl
2422: followed by the
2423: .Ql b
2424: key
2425: followed by the
2426: .Ql c
2427: key).
2428: .Pp
2429: Windows may be navigated with:
2430: .Ql C-b 0
2431: (to select window 0),
2432: .Ql C-b 1
2433: (to select window 1), and so on;
2434: .Ql C-b n
2435: to select the next window; and
2436: .Ql C-b p
2437: to select the previous window.
2438: .Pp
2439: A session may be detached using
2440: .Ql C-b d
1.64 nicm 2441: (or by an external event such as
2442: .Xr ssh 1
2443: disconnection) and reattached with:
1.57 jmc 2444: .Pp
2445: .Dl $ tmux attach-session
2446: .Pp
2447: Typing
2448: .Ql C-b \&?
2449: lists the current key bindings in the current window; up and down may be used
2450: to navigate the list or
2451: .Ql q
2452: to exit from it.
2453: .Pp
2454: Commands to be run when the
2455: .Nm
2456: server is started may be placed in the
2457: .Pa ~/.tmux.conf
2458: configuration file.
2459: Common examples include:
2460: .Pp
2461: Changing the default prefix key:
2462: .Bd -literal -offset indent
2463: set-option -g prefix C-a
2464: unbind-key C-b
2465: bind-key C-a send-prefix
2466: .Ed
2467: .Pp
2468: Turning the status line off, or changing its colour:
2469: .Bd -literal -offset indent
2470: set-option -g status off
2471: set-option -g status-bg blue
2472: .Ed
2473: .Pp
2474: Setting other options, such as the default command,
2475: or locking after 30 minutes of inactivity:
2476: .Bd -literal -offset indent
2477: set-option -g default-command "exec /bin/ksh"
2478: set-option -g lock-after-time 1800
2479: .Ed
2480: .Pp
2481: Creating new key bindings:
2482: .Bd -literal -offset indent
2483: bind-key b set-option status
2484: bind-key / command-prompt "split-window 'exec man %%'"
1.73 nicm 2485: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57 jmc 2486: .Ed
1.1 nicm 2487: .Sh SEE ALSO
2488: .Xr pty 4
2489: .Sh AUTHORS
2490: .An Nicholas Marriott Aq nicm@users.sourceforge.net