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

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