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

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