[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.150

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