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

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