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

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