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

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