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

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