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

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