[BACK]Return to tmux.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Annotation of src/usr.bin/tmux/tmux.1, Revision 1.152

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