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

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