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

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