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

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