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

1.393   ! nicm        1: .\" $OpenBSD: tmux.1,v 1.392 2014/05/13 07:34:35 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.393   ! nicm       17: .Dd $Mdocdate: May 13 2014 $
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.390     nicm       26: .Op Fl 2lCuv
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.
1.345     nicm      101: .It Fl C
1.369     nicm      102: Start in control mode (see the
                    103: .Sx CONTROL MODE
                    104: section).
1.345     nicm      105: Given twice
                    106: .Xo ( Fl CC ) Xc
                    107: disables echo.
1.91      nicm      108: .It Fl c Ar shell-command
                    109: Execute
                    110: .Ar shell-command
                    111: using the default shell.
                    112: If necessary, the
                    113: .Nm
                    114: server will be started to retrieve the
                    115: .Ic default-shell
                    116: option.
1.153     nicm      117: This option is for compatibility with
                    118: .Xr sh 1
                    119: when
                    120: .Nm
                    121: is used as a login shell.
1.1       nicm      122: .It Fl f Ar file
                    123: Specify an alternative configuration file.
                    124: By default,
                    125: .Nm
1.26      nicm      126: loads the system configuration file from
                    127: .Pa /etc/tmux.conf ,
                    128: if present, then looks for a user configuration file at
1.1       nicm      129: .Pa ~/.tmux.conf .
1.306     nicm      130: .Pp
1.1       nicm      131: The configuration file is a set of
                    132: .Nm
                    133: commands which are executed in sequence when the server is first started.
1.306     nicm      134: .Nm
                    135: loads configuration files once when the server process has started.
                    136: The
                    137: .Ic source-file
                    138: command may be used to load a file later.
1.61      nicm      139: .Pp
                    140: .Nm
1.306     nicm      141: shows any error messages from commands in configuration files in the first
                    142: session created, and continues to process the rest of the configuration file.
1.1       nicm      143: .It Fl L Ar socket-name
                    144: .Nm
                    145: stores the server socket in a directory under
1.355     nicm      146: .Ev TMUX_TMPDIR ,
                    147: .Ev TMPDIR
                    148: if it is unset, or
1.208     nicm      149: .Pa /tmp
1.355     nicm      150: if both are unset.
                    151: The default socket is named
1.1       nicm      152: .Em default .
                    153: This option allows a different socket name to be specified, allowing several
                    154: independent
                    155: .Nm
                    156: servers to be run.
                    157: Unlike
                    158: .Fl S
                    159: a full path is not necessary: the sockets are all created in the same
                    160: directory.
1.2       nicm      161: .Pp
                    162: If the socket is accidentally removed, the
1.6       jmc       163: .Dv SIGUSR1
1.2       nicm      164: signal may be sent to the
                    165: .Nm
                    166: server process to recreate it.
1.166     sobrado   167: .It Fl l
                    168: Behave as a login shell.
                    169: This flag currently has no effect and is for compatibility with other shells
                    170: when using tmux as a login shell.
1.1       nicm      171: .It Fl S Ar socket-path
                    172: Specify a full alternative path to the server socket.
                    173: If
                    174: .Fl S
                    175: is specified, the default socket directory is not used and any
                    176: .Fl L
                    177: flag is ignored.
                    178: .It Fl u
                    179: .Nm
1.14      nicm      180: attempts to guess if the terminal is likely to support UTF-8 by checking the
                    181: first of the
                    182: .Ev LC_ALL ,
                    183: .Ev LC_CTYPE
                    184: and
1.2       nicm      185: .Ev LANG
1.14      nicm      186: environment variables to be set for the string "UTF-8".
1.5       nicm      187: This is not always correct: the
1.2       nicm      188: .Fl u
                    189: flag explicitly informs
                    190: .Nm
1.6       jmc       191: that UTF-8 is supported.
1.33      nicm      192: .Pp
                    193: If the server is started from a client passed
                    194: .Fl u
                    195: or where UTF-8 is detected, the
                    196: .Ic utf8
                    197: and
                    198: .Ic status-utf8
                    199: options are enabled in the global window and session options respectively.
1.1       nicm      200: .It Fl v
                    201: Request verbose logging.
                    202: This option may be specified multiple times for increasing verbosity.
                    203: Log messages will be saved into
                    204: .Pa tmux-client-PID.log
                    205: and
                    206: .Pa tmux-server-PID.log
                    207: files in the current directory, where
                    208: .Em PID
1.6       jmc       209: is the PID of the server or client process.
1.1       nicm      210: .It Ar command Op Ar flags
                    211: This specifies one of a set of commands used to control
                    212: .Nm ,
1.6       jmc       213: as described in the following sections.
1.59      jmc       214: If no commands are specified, the
1.1       nicm      215: .Ic new-session
                    216: command is assumed.
1.57      jmc       217: .El
1.64      nicm      218: .Sh KEY BINDINGS
                    219: .Nm
                    220: may be controlled from an attached client by using a key combination of a
                    221: prefix key,
                    222: .Ql C-b
                    223: (Ctrl-b) by default, followed by a command key.
                    224: .Pp
1.172     nicm      225: The default command key bindings are:
1.64      nicm      226: .Pp
1.171     nicm      227: .Bl -tag -width "XXXXXXXXXX" -offset indent -compact
                    228: .It C-b
                    229: Send the prefix key (C-b) through to the application.
                    230: .It C-o
                    231: Rotate the panes in the current window forwards.
                    232: .It C-z
                    233: Suspend the
                    234: .Nm
                    235: client.
                    236: .It !
                    237: Break the current pane out of the window.
                    238: .It \&"
                    239: Split the current pane into two, top and bottom.
                    240: .It #
                    241: List all paste buffers.
1.236     nicm      242: .It $
                    243: Rename the current session.
1.171     nicm      244: .It %
                    245: Split the current pane into two, left and right.
                    246: .It &
                    247: Kill the current window.
                    248: .It '
                    249: Prompt for a window index to select.
                    250: .It ,
                    251: Rename the current window.
                    252: .It -
                    253: Delete the most recently copied buffer of text.
                    254: .It .
                    255: Prompt for an index to move the current window.
                    256: .It 0 to 9
                    257: Select windows 0 to 9.
                    258: .It :
                    259: Enter the
                    260: .Nm
                    261: command prompt.
1.187     nicm      262: .It ;
                    263: Move to the previously active pane.
1.178     nicm      264: .It =
                    265: Choose which buffer to paste interactively from a list.
1.171     nicm      266: .It \&?
                    267: List all key bindings.
                    268: .It D
                    269: Choose a client to detach.
1.182     jmc       270: .It \&[
1.171     nicm      271: Enter copy mode to copy text or view the history.
1.182     jmc       272: .It \&]
1.171     nicm      273: Paste the most recently copied buffer of text.
1.64      nicm      274: .It c
1.65      nicm      275: Create a new window.
1.64      nicm      276: .It d
1.65      nicm      277: Detach the current client.
1.171     nicm      278: .It f
                    279: Prompt to search for text in open windows.
                    280: .It i
                    281: Display some information about the current window.
1.64      nicm      282: .It l
1.65      nicm      283: Move to the previously selected window.
1.64      nicm      284: .It n
1.65      nicm      285: Change to the next window.
1.171     nicm      286: .It o
                    287: Select the next pane in the current window.
1.64      nicm      288: .It p
1.65      nicm      289: Change to the previous window.
1.171     nicm      290: .It q
                    291: Briefly display pane indexes.
                    292: .It r
                    293: Force redraw of the attached client.
                    294: .It s
                    295: Select a new session for the attached client interactively.
1.194     nicm      296: .It L
                    297: Switch the attached client back to the last session.
1.171     nicm      298: .It t
                    299: Show the time.
                    300: .It w
                    301: Choose the current window interactively.
                    302: .It x
                    303: Kill the current pane.
                    304: .It {
                    305: Swap the current pane with the previous pane.
                    306: .It }
                    307: Swap the current pane with the next pane.
                    308: .It ~
                    309: Show previous messages from
                    310: .Nm ,
                    311: if any.
                    312: .It Page Up
                    313: Enter copy mode and scroll one page up.
                    314: .It Up, Down
                    315: .It Left, Right
                    316: Change to the pane above, below, to the left, or to the right of the current
                    317: pane.
                    318: .It M-1 to M-5
                    319: Arrange panes in one of the five preset layouts: even-horizontal,
                    320: even-vertical, main-horizontal, main-vertical, or tiled.
                    321: .It M-n
                    322: Move to the next window with a bell or activity marker.
                    323: .It M-o
                    324: Rotate the panes in the current window backwards.
                    325: .It M-p
                    326: Move to the previous window with a bell or activity marker.
                    327: .It C-Up, C-Down
                    328: .It C-Left, C-Right
                    329: Resize the current pane in steps of one cell.
                    330: .It M-Up, M-Down
                    331: .It M-Left, M-Right
                    332: Resize the current pane in steps of five cells.
1.64      nicm      333: .El
                    334: .Pp
                    335: Key bindings may be changed with the
                    336: .Ic bind-key
                    337: and
                    338: .Ic unbind-key
                    339: commands.
1.57      jmc       340: .Sh COMMANDS
                    341: This section contains a list of the commands supported by
                    342: .Nm .
                    343: Most commands accept the optional
                    344: .Fl t
                    345: argument with one of
                    346: .Ar target-client ,
                    347: .Ar target-session
                    348: .Ar target-window ,
                    349: or
                    350: .Ar target-pane .
                    351: These specify the client, session, window or pane which a command should affect.
                    352: .Ar target-client
                    353: is the name of the
                    354: .Xr pty 4
                    355: file to which the client is connected, for example either of
                    356: .Pa /dev/ttyp1
                    357: or
                    358: .Pa ttyp1
                    359: for the client attached to
                    360: .Pa /dev/ttyp1 .
                    361: If no client is specified, the current client is chosen, if possible, or an
                    362: error is reported.
                    363: Clients may be listed with the
                    364: .Ic list-clients
                    365: command.
1.1       nicm      366: .Pp
1.57      jmc       367: .Ar target-session
1.344     nicm      368: is the session id prefixed with a $, the name of a session (as listed by the
1.57      jmc       369: .Ic list-sessions
1.344     nicm      370: command), or the name of a client with the same syntax as
1.57      jmc       371: .Ar target-client ,
                    372: in which case the session attached to the client is used.
                    373: When looking for the session name,
                    374: .Nm
                    375: initially searches for an exact match; if none is found, the session names
                    376: are checked for any for which
                    377: .Ar target-session
                    378: is a prefix or for which it matches as an
                    379: .Xr fnmatch 3
                    380: pattern.
                    381: If a single match is found, it is used as the target session; multiple matches
                    382: produce an error.
                    383: If a session is omitted, the current session is used if available; if no
1.117     nicm      384: current session is available, the most recently used is chosen.
1.1       nicm      385: .Pp
1.57      jmc       386: .Ar target-window
                    387: specifies a window in the form
                    388: .Em session Ns \&: Ns Em window .
                    389: .Em session
                    390: follows the same rules as for
                    391: .Ar target-session ,
                    392: and
                    393: .Em window
1.270     nicm      394: is looked for in order: as a window index, for example mysession:1;
1.271     jmc       395: as a window ID, such as @1;
1.270     nicm      396: as an exact window name, such as mysession:mywindow; then as an
1.57      jmc       397: .Xr fnmatch 3
                    398: pattern or the start of a window name, such as mysession:mywin* or
                    399: mysession:mywin.
                    400: An empty window name specifies the next unused index if appropriate (for
                    401: example the
                    402: .Ic new-window
                    403: and
                    404: .Ic link-window
                    405: commands)
                    406: otherwise the current window in
                    407: .Em session
                    408: is chosen.
1.140     nicm      409: The special character
                    410: .Ql \&!
1.311     nicm      411: uses the last (previously current) window,
                    412: .Ql ^
                    413: selects the highest numbered window,
                    414: .Ql $
                    415: selects the lowest numbered window, and
1.140     nicm      416: .Ql +
                    417: and
                    418: .Ql -
1.311     nicm      419: select the next window or the previous window by number.
1.57      jmc       420: When the argument does not contain a colon,
                    421: .Nm
                    422: first attempts to parse it as window; if that fails, an attempt is made to
                    423: match a session.
1.1       nicm      424: .Pp
1.57      jmc       425: .Ar target-pane
                    426: takes a similar form to
                    427: .Ar target-window
                    428: but with the optional addition of a period followed by a pane index, for
                    429: example: mysession:mywindow.1.
                    430: If the pane index is omitted, the currently active pane in the specified
                    431: window is used.
                    432: If neither a colon nor period appears,
1.13      nicm      433: .Nm
1.57      jmc       434: first attempts to use the argument as a pane index; if that fails, it is looked
                    435: up as for
                    436: .Ar target-window .
1.156     nicm      437: A
                    438: .Ql +
                    439: or
                    440: .Ql -
                    441: indicate the next or previous pane index, respectively.
1.132     nicm      442: One of the strings
                    443: .Em top ,
                    444: .Em bottom ,
                    445: .Em left ,
                    446: .Em right ,
                    447: .Em top-left ,
                    448: .Em top-right ,
1.216     nicm      449: .Em bottom-left
                    450: or
1.132     nicm      451: .Em bottom-right
                    452: may be used instead of a pane index.
1.177     nicm      453: .Pp
                    454: The special characters
                    455: .Ql +
                    456: and
                    457: .Ql -
                    458: may be followed by an offset, for example:
                    459: .Bd -literal -offset indent
                    460: select-window -t:+2
                    461: .Ed
                    462: .Pp
                    463: When dealing with a session that doesn't contain sequential window indexes,
                    464: they will be correctly skipped.
1.212     nicm      465: .Pp
                    466: .Nm
                    467: also gives each pane created in a server an identifier consisting of a
                    468: .Ql %
                    469: and a number, starting from zero.
                    470: A pane's identifier is unique for the life of the
                    471: .Nm
                    472: server and is passed to the child process of the pane in the
                    473: .Ev TMUX_PANE
                    474: environment variable.
                    475: It may be used alone to target a pane or the window containing it.
1.15      jmc       476: .Pp
1.153     nicm      477: .Ar shell-command
                    478: arguments are
                    479: .Xr sh 1
                    480: commands.
                    481: These must be passed as a single item, which typically means quoting them, for
                    482: example:
                    483: .Bd -literal -offset indent
                    484: new-window 'vi /etc/passwd'
                    485: .Ed
                    486: .Pp
                    487: .Ar command
                    488: .Op Ar arguments
                    489: refers to a
                    490: .Nm
                    491: command, passed with the command and arguments separately, for example:
                    492: .Bd -literal -offset indent
                    493: bind-key F1 set-window-option force-width 81
                    494: .Ed
                    495: .Pp
                    496: Or if using
                    497: .Xr sh 1 :
                    498: .Bd -literal -offset indent
                    499: $ tmux bind-key F1 set-window-option force-width 81
                    500: .Ed
                    501: .Pp
1.57      jmc       502: Multiple commands may be specified together as part of a
                    503: .Em command sequence .
                    504: Each command should be separated by spaces and a semicolon;
1.244     nicm      505: commands are executed sequentially from left to right and
1.293     nicm      506: lines ending with a backslash continue on to the next line,
                    507: except when escaped by another backslash.
1.57      jmc       508: A literal semicolon may be included by escaping it with a backslash (for
                    509: example, when specifying a command sequence to
                    510: .Ic bind-key ) .
1.13      nicm      511: .Pp
1.153     nicm      512: Example
                    513: .Nm
                    514: commands include:
1.13      nicm      515: .Bd -literal -offset indent
1.57      jmc       516: refresh-client -t/dev/ttyp2
                    517:
                    518: rename-session -tfirst newname
                    519:
                    520: set-window-option -t:0 monitor-activity on
                    521:
                    522: new-window ; split-window -d
1.244     nicm      523:
                    524: bind-key R source-file ~/.tmux.conf \e; \e
                    525:        display-message "source-file done"
1.13      nicm      526: .Ed
1.153     nicm      527: .Pp
                    528: Or from
                    529: .Xr sh 1 :
                    530: .Bd -literal -offset indent
                    531: $ tmux kill-window -t :1
                    532:
1.159     jmc       533: $ tmux new-window \e; split-window -d
1.153     nicm      534:
1.159     jmc       535: $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
1.153     nicm      536: .Ed
1.57      jmc       537: .Sh CLIENTS AND SESSIONS
1.153     nicm      538: The
                    539: .Nm
                    540: server manages clients, sessions, windows and panes.
                    541: Clients are attached to sessions to interact with them, either
                    542: when they are created with the
                    543: .Ic new-session
                    544: command, or later with the
                    545: .Ic attach-session
                    546: command.
1.188     nicm      547: Each session has one or more windows
1.153     nicm      548: .Em linked
                    549: into it.
                    550: Windows may be linked to multiple sessions and are made up of one or
                    551: more panes,
                    552: each of which contains a pseudo terminal.
                    553: Commands for creating, linking and otherwise manipulating windows
                    554: are covered
                    555: in the
                    556: .Sx WINDOWS AND PANES
                    557: section.
                    558: .Pp
                    559: The following commands are available to manage clients and sessions:
1.57      jmc       560: .Bl -tag -width Ds
                    561: .It Xo Ic attach-session
1.148     nicm      562: .Op Fl dr
1.372     nicm      563: .Op Fl c Ar working-directory
1.57      jmc       564: .Op Fl t Ar target-session
                    565: .Xc
                    566: .D1 (alias: Ic attach )
                    567: If run from outside
                    568: .Nm ,
                    569: create a new client in the current terminal and attach it to
                    570: .Ar target-session .
                    571: If used from inside, switch the current client.
                    572: If
                    573: .Fl d
                    574: is specified, any other clients attached to the session are detached.
1.148     nicm      575: .Fl r
                    576: signifies the client is read-only (only keys bound to the
                    577: .Ic detach-client
1.242     nicm      578: or
                    579: .Ic switch-client
                    580: commands have any effect)
1.13      nicm      581: .Pp
1.57      jmc       582: If no server is started,
                    583: .Ic attach-session
                    584: will attempt to start it; this will fail unless sessions are created in the
                    585: configuration file.
1.217     nicm      586: .Pp
                    587: The
                    588: .Ar target-session
                    589: rules for
                    590: .Ic attach-session
                    591: are slightly adjusted: if
                    592: .Nm
                    593: needs to select the most recently used session, it will prefer the most
                    594: recently used
                    595: .Em unattached
                    596: session.
1.372     nicm      597: .Pp
                    598: .Fl c
                    599: will set the session working directory (used for new windows) to
                    600: .Ar working-directory .
1.211     nicm      601: .It Xo Ic detach-client
                    602: .Op Fl P
1.296     nicm      603: .Op Fl a
1.219     nicm      604: .Op Fl s Ar target-session
1.211     nicm      605: .Op Fl t Ar target-client
                    606: .Xc
1.57      jmc       607: .D1 (alias: Ic detach )
1.218     nicm      608: Detach the current client if bound to a key, the client specified with
                    609: .Fl t ,
1.258     jmc       610: or all clients currently attached to the session specified by
1.218     nicm      611: .Fl s .
1.296     nicm      612: The
                    613: .Fl a
                    614: option kills all but the client given with
                    615: .Fl t .
1.211     nicm      616: If
                    617: .Fl P
                    618: is given, send SIGHUP to the parent process of the client, typically causing it
                    619: to exit.
1.57      jmc       620: .It Ic has-session Op Fl t Ar target-session
                    621: .D1 (alias: Ic has )
                    622: Report an error and exit with 1 if the specified session does not exist.
                    623: If it does exist, exit with 0.
                    624: .It Ic kill-server
                    625: Kill the
1.1       nicm      626: .Nm
1.57      jmc       627: server and clients and destroy all sessions.
1.369     nicm      628: .It Xo Ic kill-session
1.297     nicm      629: .Op Fl a
                    630: .Op Fl t Ar target-session
1.369     nicm      631: .Xc
1.57      jmc       632: Destroy the given session, closing any windows linked to it and no other
                    633: sessions, and detaching all clients attached to it.
1.297     nicm      634: If
                    635: .Fl a
                    636: is given, all sessions but the specified one is killed.
1.250     nicm      637: .It Xo Ic list-clients
                    638: .Op Fl F Ar format
                    639: .Op Fl t Ar target-session
                    640: .Xc
1.57      jmc       641: .D1 (alias: Ic lsc )
1.221     jmc       642: List all clients attached to the server.
1.250     nicm      643: For the meaning of the
                    644: .Fl F
                    645: flag, see the
1.252     jmc       646: .Sx FORMATS
                    647: section.
1.221     jmc       648: If
1.220     nicm      649: .Ar target-session
                    650: is specified, list only clients connected to that session.
1.57      jmc       651: .It Ic list-commands
                    652: .D1 (alias: Ic lscm )
                    653: List the syntax of all commands supported by
                    654: .Nm .
1.247     nicm      655: .It Ic list-sessions Op Fl F Ar format
1.57      jmc       656: .D1 (alias: Ic ls )
                    657: List all sessions managed by the server.
1.247     nicm      658: For the meaning of the
                    659: .Fl F
                    660: flag, see the
                    661: .Sx FORMATS
                    662: section.
1.175     nicm      663: .It Ic lock-client Op Fl t Ar target-client
                    664: .D1 (alias: Ic lockc )
1.92      nicm      665: Lock
                    666: .Ar target-client ,
                    667: see the
                    668: .Ic lock-server
                    669: command.
1.175     nicm      670: .It Ic lock-session Op Fl t Ar target-session
                    671: .D1 (alias: Ic locks )
1.92      nicm      672: Lock all clients attached to
                    673: .Ar target-session .
1.57      jmc       674: .It Xo Ic new-session
1.351     nicm      675: .Op Fl AdDP
1.371     nicm      676: .Op Fl c Ar start-directory
1.351     nicm      677: .Op Fl F Ar format
1.57      jmc       678: .Op Fl n Ar window-name
                    679: .Op Fl s Ar session-name
1.101     nicm      680: .Op Fl t Ar target-session
1.210     nicm      681: .Op Fl x Ar width
                    682: .Op Fl y Ar height
1.153     nicm      683: .Op Ar shell-command
1.57      jmc       684: .Xc
                    685: .D1 (alias: Ic new )
                    686: Create a new session with name
                    687: .Ar session-name .
1.153     nicm      688: .Pp
1.57      jmc       689: The new session is attached to the current terminal unless
                    690: .Fl d
                    691: is given.
                    692: .Ar window-name
1.1       nicm      693: and
1.153     nicm      694: .Ar shell-command
                    695: are the name of and shell command to execute in the initial window.
1.210     nicm      696: If
                    697: .Fl d
                    698: is used,
                    699: .Fl x
                    700: and
                    701: .Fl y
                    702: specify the size of the initial window (80 by 24 if not given).
1.68      nicm      703: .Pp
                    704: If run from a terminal, any
                    705: .Xr termios 4
                    706: special characters are saved and used for new windows in the new session.
1.338     nicm      707: .Pp
                    708: The
                    709: .Fl A
                    710: flag makes
                    711: .Ic new-session
                    712: behave like
                    713: .Ic attach-session
                    714: if
                    715: .Ar session-name
                    716: already exists; in the case,
                    717: .Fl D
                    718: behaves like
                    719: .Fl d
                    720: to
                    721: .Ic attach-session .
1.101     nicm      722: .Pp
                    723: If
                    724: .Fl t
                    725: is given, the new session is
                    726: .Em grouped
                    727: with
                    728: .Ar target-session .
                    729: This means they share the same set of windows - all windows from
                    730: .Ar target-session
                    731: are linked to the new session and any subsequent new windows or windows being
                    732: closed are applied to both sessions.
                    733: The current and previous window and any session options remain independent and
                    734: either session may be killed without affecting the other.
                    735: Giving
                    736: .Fl n
                    737: or
1.153     nicm      738: .Ar shell-command
1.101     nicm      739: are invalid if
                    740: .Fl t
                    741: is used.
1.351     nicm      742: .Pp
                    743: The
                    744: .Fl P
                    745: option prints information about the new session after it has been created.
                    746: By default, it uses the format
                    747: .Ql #{session_name}:
                    748: but a different format may be specified with
                    749: .Fl F .
1.248     nicm      750: .It Xo Ic refresh-client
                    751: .Op Fl S
                    752: .Op Fl t Ar target-client
                    753: .Xc
1.57      jmc       754: .D1 (alias: Ic refresh )
                    755: Refresh the current client if bound to a key, or a single client if one is given
                    756: with
                    757: .Fl t .
1.248     nicm      758: If
                    759: .Fl S
                    760: is specified, only update the client's status bar.
1.57      jmc       761: .It Xo Ic rename-session
                    762: .Op Fl t Ar target-session
                    763: .Ar new-name
                    764: .Xc
                    765: .D1 (alias: Ic rename )
                    766: Rename the session to
                    767: .Ar new-name .
1.121     nicm      768: .It Xo Ic show-messages
1.377     nicm      769: .Op Fl IJT
1.120     nicm      770: .Op Fl t Ar target-client
                    771: .Xc
                    772: .D1 (alias: Ic showmsgs )
1.377     nicm      773: Show client messages or server information.
1.120     nicm      774: Any messages displayed on the status line are saved in a per-client message
                    775: log, up to a maximum of the limit set by the
                    776: .Ar message-limit
1.384     nicm      777: server option.
1.377     nicm      778: With
                    779: .Fl t ,
                    780: display the log for
1.120     nicm      781: .Ar target-client .
1.379     jmc       782: .Fl I ,
1.377     nicm      783: .Fl J
                    784: and
                    785: .Fl T
                    786: show debugging information about the running server, jobs and terminals.
1.57      jmc       787: .It Ic source-file Ar path
                    788: .D1 (alias: Ic source )
                    789: Execute commands from
                    790: .Ar path .
                    791: .It Ic start-server
                    792: .D1 (alias: Ic start )
                    793: Start the
1.1       nicm      794: .Nm
1.57      jmc       795: server, if not already running, without creating any sessions.
                    796: .It Xo Ic suspend-client
1.202     nicm      797: .Op Fl t Ar target-client
1.57      jmc       798: .Xc
                    799: .D1 (alias: Ic suspendc )
                    800: Suspend a client by sending
                    801: .Dv SIGTSTP
                    802: (tty stop).
                    803: .It Xo Ic switch-client
1.242     nicm      804: .Op Fl lnpr
1.57      jmc       805: .Op Fl c Ar target-client
                    806: .Op Fl t Ar target-session
                    807: .Xc
                    808: .D1 (alias: Ic switchc )
                    809: Switch the current session for client
                    810: .Ar target-client
                    811: to
                    812: .Ar target-session .
1.183     nicm      813: If
1.197     jmc       814: .Fl l ,
1.183     nicm      815: .Fl n
                    816: or
                    817: .Fl p
1.194     nicm      818: is used, the client is moved to the last, next or previous session
                    819: respectively.
1.242     nicm      820: .Fl r
                    821: toggles whether a client is read-only (see the
                    822: .Ic attach-session
                    823: command).
1.57      jmc       824: .El
                    825: .Sh WINDOWS AND PANES
1.1       nicm      826: A
                    827: .Nm
                    828: window may be in one of several modes.
                    829: The default permits direct access to the terminal attached to the window.
1.164     nicm      830: The other is copy mode, which permits a section of a window or its
                    831: history to be copied to a
1.1       nicm      832: .Em paste buffer
                    833: for later insertion into another window.
                    834: This mode is entered with the
                    835: .Ic copy-mode
                    836: command, bound to
1.113     nicm      837: .Ql \&[
1.1       nicm      838: by default.
1.164     nicm      839: It is also entered when a command that produces output, such as
                    840: .Ic list-keys ,
                    841: is executed from a key binding.
1.1       nicm      842: .Pp
1.6       jmc       843: The keys available depend on whether emacs or vi mode is selected
                    844: (see the
1.1       nicm      845: .Ic mode-keys
                    846: option).
                    847: The following keys are supported as appropriate for the mode:
1.157     nicm      848: .Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
1.1       nicm      849: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
1.383     nicm      850: .It Li "Append selection" Ta "A" Ta ""
1.27      nicm      851: .It Li "Back to indentation" Ta "^" Ta "M-m"
1.393   ! nicm      852: .It Li "Copy to named buffer" Ta \&" Ta ""
1.142     nicm      853: .It Li "Bottom of history" Ta "G" Ta "M-<"
1.1       nicm      854: .It Li "Clear selection" Ta "Escape" Ta "C-g"
                    855: .It Li "Copy selection" Ta "Enter" Ta "M-w"
                    856: .It Li "Cursor down" Ta "j" Ta "Down"
1.70      nicm      857: .It Li "Cursor left" Ta "h" Ta "Left"
                    858: .It Li "Cursor right" Ta "l" Ta "Right"
1.116     nicm      859: .It Li "Cursor to bottom line" Ta "L" Ta ""
                    860: .It Li "Cursor to middle line" Ta "M" Ta "M-r"
                    861: .It Li "Cursor to top line" Ta "H" Ta "M-R"
1.70      nicm      862: .It Li "Cursor up" Ta "k" Ta "Up"
1.71      nicm      863: .It Li "Delete entire line" Ta "d" Ta "C-u"
1.227     nicm      864: .It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
1.1       nicm      865: .It Li "End of line" Ta "$" Ta "C-e"
1.142     nicm      866: .It Li "Go to line" Ta ":" Ta "g"
1.116     nicm      867: .It Li "Half page down" Ta "C-d" Ta "M-Down"
                    868: .It Li "Half page up" Ta "C-u" Ta "M-Up"
1.157     nicm      869: .It Li "Jump forward" Ta "f" Ta "f"
1.256     nicm      870: .It Li "Jump to forward" Ta "t" Ta ""
1.157     nicm      871: .It Li "Jump backward" Ta "F" Ta "F"
1.256     nicm      872: .It Li "Jump to backward" Ta "T" Ta ""
1.157     nicm      873: .It Li "Jump again" Ta ";" Ta ";"
                    874: .It Li "Jump again in reverse" Ta "," Ta ","
1.1       nicm      875: .It Li "Next page" Ta "C-f" Ta "Page down"
1.146     nicm      876: .It Li "Next space" Ta "W" Ta ""
                    877: .It Li "Next space, end of word" Ta "E" Ta ""
1.143     nicm      878: .It Li "Next word" Ta "w" Ta ""
                    879: .It Li "Next word end" Ta "e" Ta "M-f"
1.375     nicm      880: .It Li "Other end of selection" Ta "o" Ta ""
1.70      nicm      881: .It Li "Paste buffer" Ta "p" Ta "C-y"
1.116     nicm      882: .It Li "Previous page" Ta "C-b" Ta "Page up"
1.1       nicm      883: .It Li "Previous word" Ta "b" Ta "M-b"
1.146     nicm      884: .It Li "Previous space" Ta "B" Ta ""
1.1       nicm      885: .It Li "Quit mode" Ta "q" Ta "Escape"
1.147     nicm      886: .It Li "Rectangle toggle" Ta "v" Ta "R"
1.141     nicm      887: .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
                    888: .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
1.70      nicm      889: .It Li "Search again" Ta "n" Ta "n"
1.152     nicm      890: .It Li "Search again in reverse" Ta "N" Ta "N"
1.70      nicm      891: .It Li "Search backward" Ta "?" Ta "C-r"
                    892: .It Li "Search forward" Ta "/" Ta "C-s"
                    893: .It Li "Start of line" Ta "0" Ta "C-a"
1.1       nicm      894: .It Li "Start selection" Ta "Space" Ta "C-Space"
1.142     nicm      895: .It Li "Top of history" Ta "g" Ta "M->"
1.327     nicm      896: .It Li "Transpose characters" Ta "" Ta "C-t"
1.1       nicm      897: .El
1.146     nicm      898: .Pp
                    899: The next and previous word keys use space and the
                    900: .Ql - ,
1.154     nicm      901: .Ql _
1.146     nicm      902: and
                    903: .Ql @
1.154     nicm      904: characters as word delimiters by default, but this can be adjusted by
                    905: setting the
                    906: .Em word-separators
1.255     nicm      907: session option.
1.146     nicm      908: Next word moves to the start of the next word, next word end to the end of the
                    909: next word and previous word to the start of the previous word.
                    910: The three next and previous space keys work similarly but use a space alone as
                    911: the word separator.
1.157     nicm      912: .Pp
                    913: The jump commands enable quick movement within a line.
                    914: For instance, typing
                    915: .Ql f
                    916: followed by
                    917: .Ql /
                    918: will move the cursor to the next
                    919: .Ql /
                    920: character on the current line.
                    921: A
                    922: .Ql \&;
                    923: will then jump to the next occurrence.
1.1       nicm      924: .Pp
1.155     nicm      925: Commands in copy mode may be prefaced by an optional repeat count.
                    926: With vi key bindings, a prefix is entered using the number keys; with
                    927: emacs, the Alt (meta) key and a number begins prefix entry.
                    928: For example, to move the cursor forward by ten words, use
                    929: .Ql M-1 0 M-f
                    930: in emacs mode, and
                    931: .Ql 10w
                    932: in vi.
                    933: .Pp
                    934: Mode key bindings are defined in a set of named tables:
1.48      nicm      935: .Em vi-edit
                    936: and
                    937: .Em emacs-edit
                    938: for keys used when line editing at the command prompt;
                    939: .Em vi-choice
                    940: and
                    941: .Em emacs-choice
                    942: for keys used when choosing from lists (such as produced by the
1.144     nicm      943: .Ic choose-window
1.164     nicm      944: command); and
1.48      nicm      945: .Em vi-copy
                    946: and
                    947: .Em emacs-copy
1.97      nicm      948: used in copy mode.
1.48      nicm      949: The tables may be viewed with the
                    950: .Ic list-keys
1.49      nicm      951: command and keys modified or removed with
                    952: .Ic bind-key
                    953: and
                    954: .Ic unbind-key .
1.330     nicm      955: One command accepts an argument,
1.327     nicm      956: .Ic copy-pipe ,
                    957: which copies the selection and pipes it to a command.
                    958: For example the following will bind
                    959: .Ql C-q
                    960: to copy the selection into
                    961: .Pa /tmp
                    962: as well as the paste buffer:
                    963: .Bd -literal -offset indent
                    964: bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out"
                    965: .Ed
1.48      nicm      966: .Pp
1.2       nicm      967: The paste buffer key pastes the first line from the top paste buffer on the
                    968: stack.
1.57      jmc       969: .Pp
1.164     nicm      970: The synopsis for the
                    971: .Ic copy-mode
                    972: command is:
1.57      jmc       973: .Bl -tag -width Ds
                    974: .It Xo Ic copy-mode
                    975: .Op Fl u
1.72      nicm      976: .Op Fl t Ar target-pane
1.57      jmc       977: .Xc
                    978: Enter copy mode.
                    979: The
                    980: .Fl u
                    981: option scrolls one page up.
                    982: .El
1.18      nicm      983: .Pp
1.1       nicm      984: Each window displayed by
                    985: .Nm
                    986: may be split into one or more
                    987: .Em panes ;
                    988: each pane takes up a certain area of the display and is a separate terminal.
                    989: A window may be split into panes using the
                    990: .Ic split-window
                    991: command.
1.38      nicm      992: Windows may be split horizontally (with the
                    993: .Fl h
                    994: flag) or vertically.
                    995: Panes may be resized with the
                    996: .Ic resize-pane
1.1       nicm      997: command (bound to
1.38      nicm      998: .Ql C-up ,
                    999: .Ql C-down
                   1000: .Ql C-left
                   1001: and
                   1002: .Ql C-right
1.1       nicm     1003: by default), the current pane may be changed with the
1.156     nicm     1004: .Ic select-pane
                   1005: command and the
1.1       nicm     1006: .Ic rotate-window
                   1007: and
                   1008: .Ic swap-pane
1.38      nicm     1009: commands may be used to swap panes without changing their position.
                   1010: Panes are numbered beginning from zero in the order they are created.
                   1011: .Pp
                   1012: A number of preset
                   1013: .Em layouts
                   1014: are available.
                   1015: These may be selected with the
                   1016: .Ic select-layout
                   1017: command or cycled with
                   1018: .Ic next-layout
                   1019: (bound to
1.149     nicm     1020: .Ql Space
1.131     nicm     1021: by default); once a layout is chosen, panes within it may be moved and resized
                   1022: as normal.
1.1       nicm     1023: .Pp
                   1024: The following layouts are supported:
                   1025: .Bl -tag -width Ds
                   1026: .It Ic even-horizontal
                   1027: Panes are spread out evenly from left to right across the window.
                   1028: .It Ic even-vertical
                   1029: Panes are spread evenly from top to bottom.
1.2       nicm     1030: .It Ic main-horizontal
1.131     nicm     1031: A large (main) pane is shown at the top of the window and the remaining panes
                   1032: are spread from left to right in the leftover space at the bottom.
1.2       nicm     1033: Use the
                   1034: .Em main-pane-height
                   1035: window option to specify the height of the top pane.
1.1       nicm     1036: .It Ic main-vertical
1.2       nicm     1037: Similar to
                   1038: .Ic main-horizontal
                   1039: but the large pane is placed on the left and the others spread from top to
                   1040: bottom along the right.
                   1041: See the
                   1042: .Em main-pane-width
                   1043: window option.
1.165     nicm     1044: .It Ic tiled
                   1045: Panes are spread out as evenly as possible over the window in both rows and
                   1046: columns.
1.1       nicm     1047: .El
1.8       nicm     1048: .Pp
1.181     nicm     1049: In addition,
                   1050: .Ic select-layout
                   1051: may be used to apply a previously used layout - the
                   1052: .Ic list-windows
                   1053: command displays the layout of each window in a form suitable for use with
                   1054: .Ic select-layout .
                   1055: For example:
                   1056: .Bd -literal -offset indent
                   1057: $ tmux list-windows
                   1058: 0: ksh [159x48]
                   1059:     layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
                   1060: $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
                   1061: .Ed
1.196     nicm     1062: .Pp
1.181     nicm     1063: .Nm
                   1064: automatically adjusts the size of the layout for the current window size.
                   1065: Note that a layout cannot be applied to a window with more panes than that
                   1066: from which the layout was originally defined.
                   1067: .Pp
1.57      jmc      1068: Commands related to windows and panes are as follows:
                   1069: .Bl -tag -width Ds
                   1070: .It Xo Ic break-pane
1.280     nicm     1071: .Op Fl dP
                   1072: .Op Fl F Ar format
1.57      jmc      1073: .Op Fl t Ar target-pane
                   1074: .Xc
                   1075: .D1 (alias: Ic breakp )
                   1076: Break
                   1077: .Ar target-pane
                   1078: off from its containing window to make it the only pane in a new window.
                   1079: If
                   1080: .Fl d
                   1081: is given, the new window does not become the current window.
1.280     nicm     1082: The
                   1083: .Fl P
                   1084: option prints information about the new window after it has been created.
                   1085: By default, it uses the format
                   1086: .Ql #{session_name}:#{window_index}
                   1087: but a different format may be specified with
                   1088: .Fl F .
1.128     nicm     1089: .It Xo Ic capture-pane
1.346     nicm     1090: .Op Fl aepPq
1.392     nicm     1091: .Op Fl b Ar buffer-name
1.213     nicm     1092: .Op Fl E Ar end-line
                   1093: .Op Fl S Ar start-line
1.128     nicm     1094: .Op Fl t Ar target-pane
                   1095: .Xc
                   1096: .D1 (alias: Ic capturep )
1.322     nicm     1097: Capture the contents of a pane.
                   1098: If
                   1099: .Fl p
1.325     nicm     1100: is given, the output goes to stdout, otherwise to the buffer specified with
1.322     nicm     1101: .Fl b
                   1102: or a new buffer if omitted.
1.339     nicm     1103: If
                   1104: .Fl a
                   1105: is given, the alternate screen is used, and the history is not accessible.
1.340     nicm     1106: If no alternate screen exists, an error will be returned unless
                   1107: .Fl q
                   1108: is given.
1.326     nicm     1109: If
                   1110: .Fl e
1.328     nicm     1111: is given, the output includes escape sequences for text and background
                   1112: attributes.
                   1113: .Fl C
1.330     nicm     1114: also escapes non-printable characters as octal \exxx.
1.328     nicm     1115: .Fl J
1.341     nicm     1116: joins wrapped lines and preserves trailing spaces at each line's end.
1.346     nicm     1117: .Fl P
                   1118: captures only any output that the pane has received that is the beginning of an
                   1119: as-yet incomplete escape sequence.
1.213     nicm     1120: .Pp
                   1121: .Fl S
                   1122: and
                   1123: .Fl E
                   1124: specify the starting and ending line numbers, zero is the first line of the
                   1125: visible pane and negative numbers are lines in the history.
                   1126: The default is to capture only the visible contents of the pane.
1.76      nicm     1127: .It Xo
                   1128: .Ic choose-client
1.294     nicm     1129: .Op Fl F Ar format
1.76      nicm     1130: .Op Fl t Ar target-window
                   1131: .Op Ar template
                   1132: .Xc
                   1133: Put a window into client choice mode, allowing a client to be selected
                   1134: interactively from a list.
                   1135: After a client is chosen,
                   1136: .Ql %%
                   1137: is replaced by the client
                   1138: .Xr pty 4
                   1139: path in
                   1140: .Ar template
                   1141: and the result executed as a command.
                   1142: If
                   1143: .Ar template
                   1144: is not given, "detach-client -t '%%'" is used.
1.294     nicm     1145: For the meaning of the
                   1146: .Fl F
                   1147: flag, see the
                   1148: .Sx FORMATS
                   1149: section.
1.314     nicm     1150: This command works only if at least one client is attached.
1.76      nicm     1151: .It Xo
                   1152: .Ic choose-session
1.294     nicm     1153: .Op Fl F Ar format
1.76      nicm     1154: .Op Fl t Ar target-window
                   1155: .Op Ar template
                   1156: .Xc
                   1157: Put a window into session choice mode, where a session may be selected
                   1158: interactively from a list.
                   1159: When one is chosen,
                   1160: .Ql %%
                   1161: is replaced by the session name in
                   1162: .Ar template
                   1163: and the result executed as a command.
                   1164: If
                   1165: .Ar template
                   1166: is not given, "switch-client -t '%%'" is used.
1.294     nicm     1167: For the meaning of the
                   1168: .Fl F
                   1169: flag, see the
                   1170: .Sx FORMATS
                   1171: section.
1.314     nicm     1172: This command works only if at least one client is attached.
1.298     nicm     1173: .It Xo
                   1174: .Ic choose-tree
1.319     nicm     1175: .Op Fl suw
1.298     nicm     1176: .Op Fl b Ar session-template
                   1177: .Op Fl c Ar window-template
                   1178: .Op Fl S Ar format
                   1179: .Op Fl W Ar format
                   1180: .Op Fl t Ar target-window
                   1181: .Xc
                   1182: Put a window into tree choice mode, where either sessions or windows may be
                   1183: selected interactively from a list.
                   1184: By default, windows belonging to a session are indented to show their
                   1185: relationship to a session.
                   1186: .Pp
                   1187: Note that the
                   1188: .Ic choose-window
                   1189: and
                   1190: .Ic choose-session
                   1191: commands are wrappers around
                   1192: .Ic choose-tree .
                   1193: .Pp
                   1194: If
                   1195: .Fl s
                   1196: is given, will show sessions.
                   1197: If
                   1198: .Fl w
                   1199: is given, will show windows.
1.320     nicm     1200: .Pp
                   1201: By default, the tree is collapsed and sessions must be expanded to windows
                   1202: with the right arrow key.
                   1203: The
1.309     nicm     1204: .Fl u
1.321     jmc      1205: option will start with all sessions expanded instead.
1.320     nicm     1206: .Pp
1.298     nicm     1207: If
                   1208: .Fl b
                   1209: is given, will override the default session command.
                   1210: Note that
                   1211: .Ql %%
1.320     nicm     1212: can be used and will be replaced with the session name.
1.298     nicm     1213: The default option if not specified is "switch-client -t '%%'".
                   1214: If
                   1215: .Fl c
                   1216: is given, will override the default window command.
1.320     nicm     1217: Like
                   1218: .Fl b ,
1.298     nicm     1219: .Ql %%
1.320     nicm     1220: can be used and will be replaced with the session name and window index.
                   1221: When a window is chosen from the list, the session command is run before the
                   1222: window command.
                   1223: .Pp
1.298     nicm     1224: If
                   1225: .Fl S
                   1226: is given will display the specified format instead of the default session
                   1227: format.
                   1228: If
                   1229: .Fl W
                   1230: is given will display the specified format instead of the default window
                   1231: format.
                   1232: For the meaning of the
                   1233: .Fl s
                   1234: and
                   1235: .Fl w
                   1236: options, see the
                   1237: .Sx FORMATS
                   1238: section.
1.320     nicm     1239: .Pp
1.314     nicm     1240: This command works only if at least one client is attached.
1.76      nicm     1241: .It Xo
                   1242: .Ic choose-window
1.294     nicm     1243: .Op Fl F Ar format
1.76      nicm     1244: .Op Fl t Ar target-window
                   1245: .Op Ar template
                   1246: .Xc
                   1247: Put a window into window choice mode, where a window may be chosen
                   1248: interactively from a list.
                   1249: After a window is selected,
                   1250: .Ql %%
                   1251: is replaced by the session name and window index in
                   1252: .Ar template
                   1253: and the result executed as a command.
                   1254: If
                   1255: .Ar template
                   1256: is not given, "select-window -t '%%'" is used.
1.294     nicm     1257: For the meaning of the
                   1258: .Fl F
                   1259: flag, see the
                   1260: .Sx FORMATS
                   1261: section.
1.314     nicm     1262: This command works only if at least one client is attached.
1.78      nicm     1263: .It Ic display-panes Op Fl t Ar target-client
                   1264: .D1 (alias: Ic displayp)
                   1265: Display a visible indicator of each pane shown by
                   1266: .Ar target-client .
                   1267: See the
1.145     nicm     1268: .Ic display-panes-time ,
                   1269: .Ic display-panes-colour ,
1.78      nicm     1270: and
1.145     nicm     1271: .Ic display-panes-active-colour
1.78      nicm     1272: session options.
1.84      nicm     1273: While the indicator is on screen, a pane may be selected with the
                   1274: .Ql 0
                   1275: to
                   1276: .Ql 9
                   1277: keys.
1.57      jmc      1278: .It Xo Ic find-window
1.285     nicm     1279: .Op Fl CNT
1.294     nicm     1280: .Op Fl F Ar format
1.57      jmc      1281: .Op Fl t Ar target-window
                   1282: .Ar match-string
                   1283: .Xc
                   1284: .D1 (alias: Ic findw )
                   1285: Search for the
                   1286: .Xr fnmatch 3
                   1287: pattern
                   1288: .Ar match-string
                   1289: in window names, titles, and visible content (but not history).
1.285     nicm     1290: The flags control matching behavior:
                   1291: .Fl C
                   1292: matches only visible window contents,
                   1293: .Fl N
                   1294: matches only the window name and
                   1295: .Fl T
                   1296: matches only the window title.
                   1297: The default is
                   1298: .Fl CNT .
                   1299: If only one window is matched, it'll be automatically selected,
                   1300: otherwise a choice list is shown.
1.294     nicm     1301: For the meaning of the
                   1302: .Fl F
                   1303: flag, see the
                   1304: .Sx FORMATS
                   1305: section.
1.314     nicm     1306: This command works only if at least one client is attached.
1.137     nicm     1307: .It Xo Ic join-pane
1.277     nicm     1308: .Op Fl bdhv
1.137     nicm     1309: .Oo Fl l
                   1310: .Ar size |
                   1311: .Fl p Ar percentage Oc
                   1312: .Op Fl s Ar src-pane
                   1313: .Op Fl t Ar dst-pane
                   1314: .Xc
                   1315: .D1 (alias: Ic joinp )
                   1316: Like
                   1317: .Ic split-window ,
                   1318: but instead of splitting
                   1319: .Ar dst-pane
                   1320: and creating a new pane, split it and move
                   1321: .Ar src-pane
                   1322: into the space.
                   1323: This can be used to reverse
                   1324: .Ic break-pane .
1.277     nicm     1325: The
                   1326: .Fl b
                   1327: option causes
                   1328: .Ar src-pane
                   1329: to be joined to left of or above
                   1330: .Ar dst-pane .
1.112     nicm     1331: .It Xo Ic kill-pane
                   1332: .Op Fl a
                   1333: .Op Fl t Ar target-pane
                   1334: .Xc
1.57      jmc      1335: .D1 (alias: Ic killp )
                   1336: Destroy the given pane.
                   1337: If no panes remain in the containing window, it is also destroyed.
1.112     nicm     1338: The
                   1339: .Fl a
                   1340: option kills all but the pane given with
                   1341: .Fl t .
1.289     nicm     1342: .It Xo Ic kill-window
                   1343: .Op Fl a
                   1344: .Op Fl t Ar target-window
                   1345: .Xc
1.57      jmc      1346: .D1 (alias: Ic killw )
                   1347: Kill the current window or the window at
                   1348: .Ar target-window ,
1.1       nicm     1349: removing it from any sessions to which it is linked.
1.289     nicm     1350: The
                   1351: .Fl a
                   1352: option kills all but the window given with
                   1353: .Fl t .
1.187     nicm     1354: .It Ic last-pane Op Fl t Ar target-window
                   1355: .D1 (alias: Ic lastp )
                   1356: Select the last (previously selected) pane.
1.56      jmc      1357: .It Ic last-window Op Fl t Ar target-session
1.1       nicm     1358: .D1 (alias: Ic last )
                   1359: Select the last (previously selected) window.
                   1360: If no
                   1361: .Ar target-session
                   1362: is specified, select the last window of the current session.
                   1363: .It Xo Ic link-window
                   1364: .Op Fl dk
                   1365: .Op Fl s Ar src-window
                   1366: .Op Fl t Ar dst-window
                   1367: .Xc
                   1368: .D1 (alias: Ic linkw )
                   1369: Link the window at
                   1370: .Ar src-window
                   1371: to the specified
                   1372: .Ar dst-window .
                   1373: If
                   1374: .Ar dst-window
                   1375: is specified and no such window exists, the
                   1376: .Ar src-window
                   1377: is linked there.
                   1378: If
                   1379: .Fl k
                   1380: is given and
                   1381: .Ar dst-window
                   1382: exists, it is killed, otherwise an error is generated.
                   1383: If
                   1384: .Fl d
                   1385: is given, the newly linked window is not selected.
1.214     nicm     1386: .It Xo Ic list-panes
                   1387: .Op Fl as
1.245     nicm     1388: .Op Fl F Ar format
1.214     nicm     1389: .Op Fl t Ar target
                   1390: .Xc
1.104     nicm     1391: .D1 (alias: Ic lsp )
1.214     nicm     1392: If
                   1393: .Fl a
                   1394: is given,
                   1395: .Ar target
                   1396: is ignored and all panes on the server are listed.
                   1397: If
                   1398: .Fl s
                   1399: is given,
                   1400: .Ar target
                   1401: is a session (or the current session).
                   1402: If neither is given,
                   1403: .Ar target
                   1404: is a window (or the current window).
1.247     nicm     1405: For the meaning of the
                   1406: .Fl F
                   1407: flag, see the
                   1408: .Sx FORMATS
                   1409: section.
1.214     nicm     1410: .It Xo Ic list-windows
                   1411: .Op Fl a
1.245     nicm     1412: .Op Fl F Ar format
1.214     nicm     1413: .Op Fl t Ar target-session
                   1414: .Xc
1.1       nicm     1415: .D1 (alias: Ic lsw )
1.214     nicm     1416: If
                   1417: .Fl a
                   1418: is given, list all windows on the server.
                   1419: Otherwise, list windows in the current session or in
1.1       nicm     1420: .Ar target-session .
1.245     nicm     1421: For the meaning of the
                   1422: .Fl F
                   1423: flag, see the
                   1424: .Sx FORMATS
                   1425: section.
1.277     nicm     1426: .It Xo Ic move-pane
                   1427: .Op Fl bdhv
                   1428: .Oo Fl l
                   1429: .Ar size |
                   1430: .Fl p Ar percentage Oc
                   1431: .Op Fl s Ar src-pane
                   1432: .Op Fl t Ar dst-pane
                   1433: .Xc
                   1434: .D1 (alias: Ic movep )
                   1435: Like
                   1436: .Ic join-pane ,
                   1437: but
                   1438: .Ar src-pane
                   1439: and
                   1440: .Ar dst-pane
                   1441: may belong to the same window.
1.1       nicm     1442: .It Xo Ic move-window
1.291     nicm     1443: .Op Fl rdk
1.1       nicm     1444: .Op Fl s Ar src-window
                   1445: .Op Fl t Ar dst-window
                   1446: .Xc
                   1447: .D1 (alias: Ic movew )
                   1448: This is similar to
                   1449: .Ic link-window ,
                   1450: except the window at
                   1451: .Ar src-window
                   1452: is moved to
                   1453: .Ar dst-window .
1.291     nicm     1454: With
                   1455: .Fl r ,
                   1456: all windows in the session are renumbered in sequential order, respecting
                   1457: the
                   1458: .Ic base-index
                   1459: option.
1.1       nicm     1460: .It Xo Ic new-window
1.201     nicm     1461: .Op Fl adkP
1.272     nicm     1462: .Op Fl c Ar start-directory
1.351     nicm     1463: .Op Fl F Ar format
1.1       nicm     1464: .Op Fl n Ar window-name
                   1465: .Op Fl t Ar target-window
1.153     nicm     1466: .Op Ar shell-command
1.1       nicm     1467: .Xc
                   1468: .D1 (alias: Ic neww )
                   1469: Create a new window.
1.160     nicm     1470: With
                   1471: .Fl a ,
                   1472: the new window is inserted at the next index up from the specified
                   1473: .Ar target-window ,
                   1474: moving windows up if necessary,
                   1475: otherwise
                   1476: .Ar target-window
                   1477: is the new window location.
                   1478: .Pp
1.1       nicm     1479: If
                   1480: .Fl d
                   1481: is given, the session does not make the new window the current window.
                   1482: .Ar target-window
1.28      nicm     1483: represents the window to be created; if the target already exists an error is
                   1484: shown, unless the
                   1485: .Fl k
                   1486: flag is used, in which case it is destroyed.
1.153     nicm     1487: .Ar shell-command
1.1       nicm     1488: is the command to execute.
                   1489: If
1.153     nicm     1490: .Ar shell-command
                   1491: is not specified, the value of the
                   1492: .Ic default-command
                   1493: option is used.
1.272     nicm     1494: .Fl c
                   1495: specifies the working directory in which the new window is created.
1.153     nicm     1496: .Pp
                   1497: When the shell command completes, the window closes.
                   1498: See the
                   1499: .Ic remain-on-exit
                   1500: option to change this behaviour.
1.1       nicm     1501: .Pp
                   1502: The
                   1503: .Ev TERM
                   1504: environment variable must be set to
                   1505: .Dq screen
                   1506: for all programs running
                   1507: .Em inside
                   1508: .Nm .
                   1509: New windows will automatically have
                   1510: .Dq TERM=screen
                   1511: added to their environment, but care must be taken not to reset this in shell
                   1512: start-up files.
1.201     nicm     1513: .Pp
                   1514: The
                   1515: .Fl P
1.279     nicm     1516: option prints information about the new window after it has been created.
                   1517: By default, it uses the format
                   1518: .Ql #{session_name}:#{window_index}
                   1519: but a different format may be specified with
                   1520: .Fl F .
1.56      jmc      1521: .It Ic next-layout Op Fl t Ar target-window
1.1       nicm     1522: .D1 (alias: Ic nextl )
                   1523: Move a window to the next layout and rearrange the panes to fit.
                   1524: .It Xo Ic next-window
1.9       nicm     1525: .Op Fl a
1.1       nicm     1526: .Op Fl t Ar target-session
                   1527: .Xc
                   1528: .D1 (alias: Ic next )
                   1529: Move to the next window in the session.
1.9       nicm     1530: If
1.12      jmc      1531: .Fl a
1.295     nicm     1532: is used, move to the next window with an alert.
1.107     nicm     1533: .It Xo Ic pipe-pane
                   1534: .Op Fl o
                   1535: .Op Fl t Ar target-pane
1.153     nicm     1536: .Op Ar shell-command
1.107     nicm     1537: .Xc
                   1538: .D1 (alias: Ic pipep )
                   1539: Pipe any output sent by the program in
                   1540: .Ar target-pane
                   1541: to a shell command.
                   1542: A pane may only be piped to one command at a time, any existing pipe is
                   1543: closed before
1.153     nicm     1544: .Ar shell-command
1.107     nicm     1545: is executed.
1.174     nicm     1546: The
                   1547: .Ar shell-command
                   1548: string may contain the special character sequences supported by the
                   1549: .Ic status-left
1.231     nicm     1550: option.
1.107     nicm     1551: If no
1.153     nicm     1552: .Ar shell-command
1.107     nicm     1553: is given, the current pipe (if any) is closed.
                   1554: .Pp
                   1555: The
                   1556: .Fl o
                   1557: option only opens a new pipe if no previous pipe exists, allowing a pipe to
                   1558: be toggled with a single key, for example:
                   1559: .Bd -literal -offset indent
1.174     nicm     1560: bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1.107     nicm     1561: .Ed
1.176     nicm     1562: .It Xo Ic previous-layout
                   1563: .Op Fl t Ar target-window
                   1564: .Xc
                   1565: .D1 (alias: Ic prevl )
                   1566: Move to the previous layout in the session.
1.1       nicm     1567: .It Xo Ic previous-window
1.9       nicm     1568: .Op Fl a
1.1       nicm     1569: .Op Fl t Ar target-session
                   1570: .Xc
                   1571: .D1 (alias: Ic prev )
                   1572: Move to the previous window in the session.
1.9       nicm     1573: With
                   1574: .Fl a ,
1.295     nicm     1575: move to the previous window with an alert.
1.1       nicm     1576: .It Xo Ic rename-window
                   1577: .Op Fl t Ar target-window
                   1578: .Ar new-name
                   1579: .Xc
                   1580: .D1 (alias: Ic renamew )
                   1581: Rename the current window, or the window at
                   1582: .Ar target-window
                   1583: if specified, to
                   1584: .Ar new-name .
                   1585: .It Xo Ic resize-pane
1.337     nicm     1586: .Op Fl DLRUZ
1.52      nicm     1587: .Op Fl t Ar target-pane
1.324     nicm     1588: .Op Fl x Ar width
                   1589: .Op Fl y Ar height
1.1       nicm     1590: .Op Ar adjustment
                   1591: .Xc
                   1592: .D1 (alias: Ic resizep )
1.324     nicm     1593: Resize a pane, up, down, left or right by
                   1594: .Ar adjustment
                   1595: with
                   1596: .Fl U ,
1.57      jmc      1597: .Fl D ,
                   1598: .Fl L
1.324     nicm     1599: or
                   1600: .Fl R ,
                   1601: or
                   1602: to an absolute size
                   1603: with
                   1604: .Fl x
                   1605: or
                   1606: .Fl y .
1.57      jmc      1607: The
                   1608: .Ar adjustment
                   1609: is given in lines or cells (the default is 1).
1.337     nicm     1610: .Pp
                   1611: With
                   1612: .Fl Z ,
1.349     nicm     1613: the active pane is toggled between zoomed (occupying the whole of the window)
                   1614: and unzoomed (its normal position in the layout).
1.234     nicm     1615: .It Xo Ic respawn-pane
                   1616: .Op Fl k
                   1617: .Op Fl t Ar target-pane
                   1618: .Op Ar shell-command
                   1619: .Xc
                   1620: .D1 (alias: Ic respawnp )
                   1621: Reactivate a pane in which the command has exited (see the
                   1622: .Ic remain-on-exit
                   1623: window option).
                   1624: If
                   1625: .Ar shell-command
                   1626: is not given, the command used when the pane was created is executed.
                   1627: The pane must be already inactive, unless
                   1628: .Fl k
                   1629: is given, in which case any existing command is killed.
1.57      jmc      1630: .It Xo Ic respawn-window
                   1631: .Op Fl k
                   1632: .Op Fl t Ar target-window
1.153     nicm     1633: .Op Ar shell-command
1.57      jmc      1634: .Xc
                   1635: .D1 (alias: Ic respawnw )
1.153     nicm     1636: Reactivate a window in which the command has exited (see the
1.57      jmc      1637: .Ic remain-on-exit
                   1638: window option).
                   1639: If
1.153     nicm     1640: .Ar shell-command
1.57      jmc      1641: is not given, the command used when the window was created is executed.
                   1642: The window must be already inactive, unless
                   1643: .Fl k
                   1644: is given, in which case any existing command is killed.
                   1645: .It Xo Ic rotate-window
                   1646: .Op Fl DU
                   1647: .Op Fl t Ar target-window
                   1648: .Xc
                   1649: .D1 (alias: Ic rotatew )
                   1650: Rotate the positions of the panes within a window, either upward (numerically
                   1651: lower) with
                   1652: .Fl U
                   1653: or downward (numerically higher).
                   1654: .It Xo Ic select-layout
1.313     nicm     1655: .Op Fl np
1.57      jmc      1656: .Op Fl t Ar target-window
                   1657: .Op Ar layout-name
                   1658: .Xc
1.176     nicm     1659: .D1 (alias: Ic selectl )
1.57      jmc      1660: Choose a specific layout for a window.
                   1661: If
                   1662: .Ar layout-name
1.181     nicm     1663: is not given, the last preset layout used (if any) is reapplied.
1.204     nicm     1664: .Fl n
                   1665: and
                   1666: .Fl p
                   1667: are equivalent to the
                   1668: .Ic next-layout
                   1669: and
                   1670: .Ic previous-layout
                   1671: commands.
1.156     nicm     1672: .It Xo Ic select-pane
1.204     nicm     1673: .Op Fl lDLRU
1.156     nicm     1674: .Op Fl t Ar target-pane
                   1675: .Xc
1.57      jmc      1676: .D1 (alias: Ic selectp )
                   1677: Make pane
                   1678: .Ar target-pane
                   1679: the active pane in window
                   1680: .Ar target-window .
1.156     nicm     1681: If one of
                   1682: .Fl D ,
                   1683: .Fl L ,
                   1684: .Fl R ,
                   1685: or
                   1686: .Fl U
                   1687: is used, respectively the pane below, to the left, to the right, or above the
                   1688: target pane is used.
1.204     nicm     1689: .Fl l
                   1690: is the same as using the
                   1691: .Ic last-pane
                   1692: command.
                   1693: .It Xo Ic select-window
1.310     nicm     1694: .Op Fl lnpT
1.204     nicm     1695: .Op Fl t Ar target-window
                   1696: .Xc
1.57      jmc      1697: .D1 (alias: Ic selectw )
                   1698: Select the window at
                   1699: .Ar target-window .
1.204     nicm     1700: .Fl l ,
                   1701: .Fl n
                   1702: and
                   1703: .Fl p
                   1704: are equivalent to the
                   1705: .Ic last-window ,
                   1706: .Ic next-window
                   1707: and
                   1708: .Ic previous-window
                   1709: commands.
1.310     nicm     1710: If
                   1711: .Fl T
                   1712: is given and the selected window is already the current window,
                   1713: the command behaves like
                   1714: .Ic last-window .
1.57      jmc      1715: .It Xo Ic split-window
1.201     nicm     1716: .Op Fl dhvP
1.272     nicm     1717: .Op Fl c Ar start-directory
1.57      jmc      1718: .Oo Fl l
                   1719: .Ar size |
                   1720: .Fl p Ar percentage Oc
1.136     nicm     1721: .Op Fl t Ar target-pane
1.153     nicm     1722: .Op Ar shell-command
1.279     nicm     1723: .Op Fl F Ar format
1.57      jmc      1724: .Xc
1.176     nicm     1725: .D1 (alias: Ic splitw )
1.136     nicm     1726: Create a new pane by splitting
                   1727: .Ar target-pane :
1.57      jmc      1728: .Fl h
                   1729: does a horizontal split and
                   1730: .Fl v
                   1731: a vertical split; if neither is specified,
                   1732: .Fl v
                   1733: is assumed.
                   1734: The
                   1735: .Fl l
                   1736: and
                   1737: .Fl p
1.136     nicm     1738: options specify the size of the new pane in lines (for vertical split) or in
1.57      jmc      1739: cells (for horizontal split), or as a percentage, respectively.
1.136     nicm     1740: All other options have the same meaning as for the
1.57      jmc      1741: .Ic new-window
                   1742: command.
                   1743: .It Xo Ic swap-pane
                   1744: .Op Fl dDU
                   1745: .Op Fl s Ar src-pane
                   1746: .Op Fl t Ar dst-pane
                   1747: .Xc
                   1748: .D1 (alias: Ic swapp )
                   1749: Swap two panes.
                   1750: If
                   1751: .Fl U
                   1752: is used and no source pane is specified with
                   1753: .Fl s ,
                   1754: .Ar dst-pane
                   1755: is swapped with the previous pane (before it numerically);
                   1756: .Fl D
                   1757: swaps with the next pane (after it numerically).
1.138     nicm     1758: .Fl d
                   1759: instructs
                   1760: .Nm
                   1761: not to change the active pane.
1.57      jmc      1762: .It Xo Ic swap-window
                   1763: .Op Fl d
                   1764: .Op Fl s Ar src-window
                   1765: .Op Fl t Ar dst-window
                   1766: .Xc
                   1767: .D1 (alias: Ic swapw )
                   1768: This is similar to
                   1769: .Ic link-window ,
                   1770: except the source and destination windows are swapped.
                   1771: It is an error if no window exists at
                   1772: .Ar src-window .
                   1773: .It Xo Ic unlink-window
1.1       nicm     1774: .Op Fl k
                   1775: .Op Fl t Ar target-window
                   1776: .Xc
1.57      jmc      1777: .D1 (alias: Ic unlinkw )
                   1778: Unlink
                   1779: .Ar target-window .
                   1780: Unless
                   1781: .Fl k
                   1782: is given, a window may be unlinked only if it is linked to multiple sessions -
                   1783: windows may not be linked to no sessions;
                   1784: if
1.1       nicm     1785: .Fl k
1.57      jmc      1786: is specified and the window is linked to only one session, it is unlinked and
                   1787: destroyed.
                   1788: .El
                   1789: .Sh KEY BINDINGS
1.93      nicm     1790: .Nm
                   1791: allows a command to be bound to most keys, with or without a prefix key.
                   1792: When specifying keys, most represent themselves (for example
                   1793: .Ql A
                   1794: to
1.95      jmc      1795: .Ql Z ) .
1.93      nicm     1796: Ctrl keys may be prefixed with
                   1797: .Ql C-
                   1798: or
1.95      jmc      1799: .Ql ^ ,
                   1800: and Alt (meta) with
1.93      nicm     1801: .Ql M- .
                   1802: In addition, the following special key names are accepted:
1.126     nicm     1803: .Em Up ,
                   1804: .Em Down ,
                   1805: .Em Left ,
                   1806: .Em Right ,
1.93      nicm     1807: .Em BSpace ,
                   1808: .Em BTab ,
                   1809: .Em DC
                   1810: (Delete),
                   1811: .Em End ,
                   1812: .Em Enter ,
                   1813: .Em Escape ,
                   1814: .Em F1
                   1815: to
                   1816: .Em F20 ,
                   1817: .Em Home ,
                   1818: .Em IC
                   1819: (Insert),
1.254     nicm     1820: .Em NPage/PageDown/PgDn ,
                   1821: .Em PPage/PageUp/PgUp ,
1.93      nicm     1822: .Em Space ,
                   1823: and
                   1824: .Em Tab .
                   1825: Note that to bind the
                   1826: .Ql \&"
                   1827: or
                   1828: .Ql '
                   1829: keys, quotation marks are necessary, for example:
                   1830: .Bd -literal -offset indent
                   1831: bind-key '"' split-window
1.167     nicm     1832: bind-key "'" new-window
1.93      nicm     1833: .Ed
                   1834: .Pp
1.57      jmc      1835: Commands related to key bindings are as follows:
                   1836: .Bl -tag -width Ds
                   1837: .It Xo Ic bind-key
                   1838: .Op Fl cnr
                   1839: .Op Fl t Ar key-table
                   1840: .Ar key Ar command Op Ar arguments
1.1       nicm     1841: .Xc
1.57      jmc      1842: .D1 (alias: Ic bind )
                   1843: Bind key
                   1844: .Ar key
                   1845: to
                   1846: .Ar command .
                   1847: By default (without
                   1848: .Fl t )
                   1849: the primary key bindings are modified (those normally activated with the prefix
                   1850: key); in this case, if
                   1851: .Fl n
                   1852: is specified, it is not necessary to use the prefix key,
                   1853: .Ar command
                   1854: is bound to
                   1855: .Ar key
                   1856: alone.
1.1       nicm     1857: The
1.57      jmc      1858: .Fl r
                   1859: flag indicates this key may repeat, see the
                   1860: .Ic repeat-time
                   1861: option.
                   1862: .Pp
                   1863: If
                   1864: .Fl t
                   1865: is present,
                   1866: .Ar key
                   1867: is bound in
                   1868: .Ar key-table :
                   1869: the binding for command mode with
                   1870: .Fl c
                   1871: or for normal mode without.
                   1872: To view the default bindings and possible commands, see the
                   1873: .Ic list-keys
                   1874: command.
                   1875: .It Ic list-keys Op Fl t Ar key-table
                   1876: .D1 (alias: Ic lsk )
                   1877: List all key bindings.
                   1878: Without
                   1879: .Fl t
                   1880: the primary key bindings - those executed when preceded by the prefix key -
                   1881: are printed.
                   1882: .Pp
                   1883: With
                   1884: .Fl t ,
                   1885: the key bindings in
                   1886: .Ar key-table
                   1887: are listed; this may be one of:
                   1888: .Em vi-edit ,
                   1889: .Em emacs-edit ,
                   1890: .Em vi-choice ,
                   1891: .Em emacs-choice ,
                   1892: .Em vi-copy
                   1893: or
                   1894: .Em emacs-copy .
                   1895: .It Xo Ic send-keys
1.273     nicm     1896: .Op Fl lR
1.72      nicm     1897: .Op Fl t Ar target-pane
1.57      jmc      1898: .Ar key Ar ...
1.1       nicm     1899: .Xc
1.57      jmc      1900: .D1 (alias: Ic send )
                   1901: Send a key or keys to a window.
                   1902: Each argument
                   1903: .Ar key
                   1904: is the name of the key (such as
                   1905: .Ql C-a
                   1906: or
                   1907: .Ql npage
                   1908: ) to send; if the string is not recognised as a key, it is sent as a series of
                   1909: characters.
1.273     nicm     1910: The
                   1911: .Fl l
                   1912: flag disables key name lookup and sends the keys literally.
1.57      jmc      1913: All arguments are sent sequentially from first to last.
1.265     nicm     1914: The
                   1915: .Fl R
                   1916: flag causes the terminal state to be reset.
1.267     nicm     1917: .It Xo Ic send-prefix
                   1918: .Op Fl 2
                   1919: .Op Fl t Ar target-pane
                   1920: .Xc
                   1921: Send the prefix key, or with
                   1922: .Fl 2
                   1923: the secondary prefix key, to a window as if it was pressed.
1.57      jmc      1924: .It Xo Ic unbind-key
1.189     nicm     1925: .Op Fl acn
1.57      jmc      1926: .Op Fl t Ar key-table
                   1927: .Ar key
1.2       nicm     1928: .Xc
1.57      jmc      1929: .D1 (alias: Ic unbind )
                   1930: Unbind the command bound to
                   1931: .Ar key .
                   1932: Without
                   1933: .Fl t
                   1934: the primary key bindings are modified; in this case, if
                   1935: .Fl n
                   1936: is specified, the command bound to
                   1937: .Ar key
                   1938: without a prefix (if any) is removed.
1.189     nicm     1939: If
                   1940: .Fl a
                   1941: is present, all key bindings are removed.
1.57      jmc      1942: .Pp
1.47      nicm     1943: If
1.57      jmc      1944: .Fl t
                   1945: is present,
                   1946: .Ar key
                   1947: in
                   1948: .Ar key-table
                   1949: is unbound: the binding for command mode with
                   1950: .Fl c
                   1951: or for normal mode without.
                   1952: .El
                   1953: .Sh OPTIONS
                   1954: The appearance and behaviour of
                   1955: .Nm
                   1956: may be modified by changing the value of various options.
1.133     nicm     1957: There are three types of option:
                   1958: .Em server options ,
1.57      jmc      1959: .Em session options
                   1960: and
                   1961: .Em window options .
                   1962: .Pp
1.133     nicm     1963: The
                   1964: .Nm
                   1965: server has a set of global options which do not apply to any particular
                   1966: window or session.
                   1967: These are altered with the
                   1968: .Ic set-option
                   1969: .Fl s
                   1970: command, or displayed with the
                   1971: .Ic show-options
                   1972: .Fl s
                   1973: command.
                   1974: .Pp
                   1975: In addition, each individual session may have a set of session options, and
                   1976: there is a separate set of global session options.
1.57      jmc      1977: Sessions which do not have a particular option configured inherit the value
                   1978: from the global session options.
                   1979: Session options are set or unset with the
                   1980: .Ic set-option
                   1981: command and may be listed with the
                   1982: .Ic show-options
                   1983: command.
1.133     nicm     1984: The available server and session options are listed under the
1.57      jmc      1985: .Ic set-option
                   1986: command.
                   1987: .Pp
                   1988: Similarly, a set of window options is attached to each window, and there is
                   1989: a set of global window options from which any unset options are inherited.
                   1990: Window options are altered with the
                   1991: .Ic set-window-option
                   1992: command and can be listed with the
                   1993: .Ic show-window-options
                   1994: command.
                   1995: All window options are documented with the
                   1996: .Ic set-window-option
                   1997: command.
1.318     nicm     1998: .Pp
                   1999: .Nm
                   2000: also supports user options which are prefixed with a
                   2001: .Ql \&@ .
1.321     jmc      2002: User options may have any name, so long as they are prefixed with
                   2003: .Ql \&@ ,
1.318     nicm     2004: and be set to any string.
                   2005: For example
                   2006: .Bd -literal -offset indent
                   2007: $ tmux setw -q @foo "abc123"
                   2008: $ tmux showw -v @foo
                   2009: abc123
                   2010: .Ed
1.57      jmc      2011: .Pp
                   2012: Commands which set options are as follows:
                   2013: .Bl -tag -width Ds
1.1       nicm     2014: .It Xo Ic set-option
1.336     nicm     2015: .Op Fl agoqsuw
1.129     nicm     2016: .Op Fl t Ar target-session | Ar target-window
1.1       nicm     2017: .Ar option Ar value
                   2018: .Xc
                   2019: .D1 (alias: Ic set )
1.133     nicm     2020: Set a window option with
                   2021: .Fl w
                   2022: (equivalent to the
                   2023: .Ic set-window-option
                   2024: command),
                   2025: a server option with
                   2026: .Fl s ,
                   2027: otherwise a session option.
                   2028: .Pp
                   2029: If
                   2030: .Fl g
                   2031: is specified, the global session or window option is set.
1.1       nicm     2032: The
                   2033: .Fl u
                   2034: flag unsets an option, so a session inherits the option from the global
1.133     nicm     2035: options.
                   2036: It is not possible to unset a global option.
1.336     nicm     2037: .Pp
                   2038: The
                   2039: .Fl o
                   2040: flag prevents setting an option that is already set.
1.1       nicm     2041: .Pp
1.281     nicm     2042: The
                   2043: .Fl q
1.389     nicm     2044: flag suppresses errors about unknown options.
1.281     nicm     2045: .Pp
1.378     nicm     2046: With
                   2047: .Fl a ,
                   2048: and if the option expects a string or a style,
                   2049: .Ar value
                   2050: is appended to the existing setting.
                   2051: For example:
                   2052: .Bd -literal -offset indent
                   2053: set -g status-left "foo"
                   2054: set -ag status-left "bar"
                   2055: .Ed
                   2056: .Pp
                   2057: Will result in
                   2058: .Ql foobar .
                   2059: And:
                   2060: .Bd -literal -offset indent
                   2061: set -g status-style "bg=red"
                   2062: set -ag status-style "fg=blue"
                   2063: .Ed
                   2064: .Pp
                   2065: Will result in a red background
                   2066: .Em and
                   2067: blue foreground.
                   2068: Without
                   2069: .Fl a ,
                   2070: the result would be the default background and a blue foreground.
                   2071: .Pp
1.133     nicm     2072: Available window options are listed under
                   2073: .Ic set-window-option .
1.274     nicm     2074: .Pp
                   2075: .Ar value
                   2076: depends on the option and may be a number, a string, or a flag (on, off, or
                   2077: omitted to toggle).
1.133     nicm     2078: .Pp
                   2079: Available server options are:
                   2080: .Bl -tag -width Ds
1.198     nicm     2081: .It Ic buffer-limit Ar number
                   2082: Set the number of buffers; as new buffers are added to the top of the stack,
                   2083: old ones are removed from the bottom if necessary to maintain this maximum
                   2084: length.
1.239     nicm     2085: .It Ic escape-time Ar time
                   2086: Set the time in milliseconds for which
                   2087: .Nm
                   2088: waits after an escape is input to determine if it is part of a function or meta
                   2089: key sequences.
                   2090: The default is 500 milliseconds.
                   2091: .It Xo Ic exit-unattached
                   2092: .Op Ic on | off
                   2093: .Xc
                   2094: If enabled, the server will exit when there are no attached clients.
1.362     nicm     2095: .It Xo Ic focus-events
                   2096: .Op Ic on | off
                   2097: .Xc
                   2098: When enabled, focus events are requested from the terminal if supported and
                   2099: passed through to applications running in
                   2100: .Nm .
                   2101: Attached clients should be detached and attached again after changing this
                   2102: option.
1.384     nicm     2103: .It Ic message-limit Ar number
                   2104: Set the number of error or information messages to save in the message log for
                   2105: each client.
                   2106: The default is 100.
1.228     nicm     2107: .It Xo Ic set-clipboard
                   2108: .Op Ic on | off
                   2109: .Xc
                   2110: Attempt to set the terminal clipboard content using the
                   2111: \ee]52;...\e007
                   2112: .Xr xterm 1
                   2113: escape sequences.
                   2114: This option is on by default if there is an
                   2115: .Em \&Ms
                   2116: entry in the
                   2117: .Xr terminfo 5
                   2118: description for the client terminal.
                   2119: Note that this feature needs to be enabled in
                   2120: .Xr xterm 1
                   2121: by setting the resource:
                   2122: .Bd -literal -offset indent
                   2123: disallowedWindowOps: 20,21,SetXprop
                   2124: .Ed
                   2125: .Pp
                   2126: Or changing this property from the
                   2127: .Xr xterm 1
                   2128: interactive menu when required.
1.381     nicm     2129: .It Ic terminal-overrides Ar string
                   2130: Contains a list of entries which override terminal descriptions read using
                   2131: .Xr terminfo 5 .
                   2132: .Ar string
                   2133: is a comma-separated list of items each a colon-separated string made up of a
                   2134: terminal type pattern (matched using
                   2135: .Xr fnmatch 3 )
                   2136: and a set of
                   2137: .Em name=value
                   2138: entries.
                   2139: .Pp
                   2140: For example, to set the
                   2141: .Ql clear
                   2142: .Xr terminfo 5
                   2143: entry to
                   2144: .Ql \ee[H\ee[2J
                   2145: for all terminal types and the
                   2146: .Ql dch1
                   2147: entry to
                   2148: .Ql \ee[P
                   2149: for the
                   2150: .Ql rxvt
                   2151: terminal type, the option could be set to the string:
                   2152: .Bd -literal -offset indent
                   2153: "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
                   2154: .Ed
                   2155: .Pp
                   2156: The terminal entry value is passed through
                   2157: .Xr strunvis 3
                   2158: before interpretation.
                   2159: The default value forcibly corrects the
                   2160: .Ql colors
                   2161: entry for terminals which support 256 colours:
                   2162: .Bd -literal -offset indent
                   2163: "*256col*:colors=256,xterm*:XT"
                   2164: .Ed
1.133     nicm     2165: .El
1.129     nicm     2166: .Pp
1.18      nicm     2167: Available session options are:
1.1       nicm     2168: .Bl -tag -width Ds
1.312     nicm     2169: .It Ic assume-paste-time Ar milliseconds
                   2170: If keys are entered faster than one in
                   2171: .Ar milliseconds ,
                   2172: they are assumed to have been pasted rather than typed and
                   2173: .Nm
                   2174: key bindings are not processed.
                   2175: The default is one millisecond and zero disables.
1.69      nicm     2176: .It Ic base-index Ar index
                   2177: Set the base index from which an unused index should be searched when a new
                   2178: window is created.
                   2179: The default is zero.
1.1       nicm     2180: .It Xo Ic bell-action
1.56      jmc      2181: .Op Ic any | none | current
1.1       nicm     2182: .Xc
                   2183: Set action on window bell.
                   2184: .Ic any
                   2185: means a bell in any window linked to a session causes a bell in the current
                   2186: window of that session,
                   2187: .Ic none
                   2188: means all bells are ignored and
                   2189: .Ic current
1.305     nicm     2190: means only bells in windows other than the current window are ignored.
1.237     nicm     2191: .It Xo Ic bell-on-alert
                   2192: .Op Ic on | off
                   2193: .Xc
1.295     nicm     2194: If on, ring the terminal bell when an alert
1.237     nicm     2195: occurs.
1.153     nicm     2196: .It Ic default-command Ar shell-command
1.1       nicm     2197: Set the command used for new windows (if not specified when the window is
                   2198: created) to
1.153     nicm     2199: .Ar shell-command ,
1.79      nicm     2200: which may be any
                   2201: .Xr sh 1
                   2202: command.
1.19      nicm     2203: The default is an empty string, which instructs
                   2204: .Nm
1.79      nicm     2205: to create a login shell using the value of the
                   2206: .Ic default-shell
                   2207: option.
                   2208: .It Ic default-shell Ar path
                   2209: Specify the default shell.
                   2210: This is used as the login shell for new windows when the
                   2211: .Ic default-command
                   2212: option is set to empty, and must be the full path of the executable.
                   2213: When started
                   2214: .Nm
                   2215: tries to set a default value from the first suitable of the
1.19      nicm     2216: .Ev SHELL
1.79      nicm     2217: environment variable, the shell returned by
                   2218: .Xr getpwuid 3 ,
                   2219: or
                   2220: .Pa /bin/sh .
                   2221: This option should be configured when
                   2222: .Nm
                   2223: is used as a login shell.
1.22      nicm     2224: .It Ic default-terminal Ar terminal
                   2225: Set the default terminal for new windows created in this session - the
                   2226: default value of the
                   2227: .Ev TERM
                   2228: environment variable.
                   2229: For
                   2230: .Nm
                   2231: to work correctly, this
                   2232: .Em must
                   2233: be set to
                   2234: .Ql screen
                   2235: or a derivative of it.
1.206     nicm     2236: .It Xo Ic destroy-unattached
                   2237: .Op Ic on | off
                   2238: .Xc
1.185     nicm     2239: If enabled and the session is no longer attached to any clients, it is
                   2240: destroyed.
1.206     nicm     2241: .It Xo Ic detach-on-destroy
                   2242: .Op Ic on | off
                   2243: .Xc
1.184     nicm     2244: If on (the default), the client is detached when the session it is attached to
                   2245: is destroyed.
                   2246: If off, the client is switched to the most recently active of the remaining
                   2247: sessions.
1.145     nicm     2248: .It Ic display-panes-active-colour Ar colour
                   2249: Set the colour used by the
                   2250: .Ic display-panes
                   2251: command to show the indicator for the active pane.
1.78      nicm     2252: .It Ic display-panes-colour Ar colour
1.145     nicm     2253: Set the colour used by the
1.78      nicm     2254: .Ic display-panes
1.145     nicm     2255: command to show the indicators for inactive panes.
1.78      nicm     2256: .It Ic display-panes-time Ar time
                   2257: Set the time in milliseconds for which the indicators shown by the
                   2258: .Ic display-panes
                   2259: command appear.
1.21      nicm     2260: .It Ic display-time Ar time
1.78      nicm     2261: Set the amount of time for which status line messages and other on-screen
                   2262: indicators are displayed.
1.21      nicm     2263: .Ar time
                   2264: is in milliseconds.
1.1       nicm     2265: .It Ic history-limit Ar lines
                   2266: Set the maximum number of lines held in window history.
                   2267: This setting applies only to new windows - existing window histories are not
                   2268: resized and retain the limit at the point they were created.
                   2269: .It Ic lock-after-time Ar number
1.100     nicm     2270: Lock the session (like the
                   2271: .Ic lock-session
1.90      nicm     2272: command) after
1.1       nicm     2273: .Ar number
1.100     nicm     2274: seconds of inactivity, or the entire server (all sessions) if the
                   2275: .Ic lock-server
                   2276: option is set.
                   2277: The default is not to lock (set to 0).
1.153     nicm     2278: .It Ic lock-command Ar shell-command
1.90      nicm     2279: Command to run when locking each client.
                   2280: The default is to run
                   2281: .Xr lock 1
                   2282: with
                   2283: .Fl np .
1.100     nicm     2284: .It Xo Ic lock-server
                   2285: .Op Ic on | off
                   2286: .Xc
                   2287: If this option is
1.102     nicm     2288: .Ic on
1.100     nicm     2289: (the default),
                   2290: instead of each session locking individually as each has been
                   2291: idle for
1.108     jmc      2292: .Ic lock-after-time ,
                   2293: the entire server will lock after
1.100     nicm     2294: .Em all
                   2295: sessions would have locked.
                   2296: This has no effect as a session option; it must be set as a global option.
1.378     nicm     2297: .It Ic message-command-style Ar style
                   2298: Set status line message command style, where
                   2299: .Ar style
                   2300: is a comma-separated list of characteristics to be specified.
                   2301: .Pp
                   2302: These may be
                   2303: .Ql bg=colour
                   2304: to set the background colour,
                   2305: .Ql fg=colour
                   2306: to set the foreground colour, and a list of attributes as specified below.
                   2307: .Pp
                   2308: The colour is one of:
1.1       nicm     2309: .Ic black ,
                   2310: .Ic red ,
                   2311: .Ic green ,
                   2312: .Ic yellow ,
                   2313: .Ic blue ,
                   2314: .Ic magenta ,
                   2315: .Ic cyan ,
1.85      nicm     2316: .Ic white ,
1.266     nicm     2317: aixterm bright variants (if supported:
                   2318: .Ic brightred ,
                   2319: .Ic brightgreen ,
                   2320: and so on),
1.85      nicm     2321: .Ic colour0
                   2322: to
                   2323: .Ic colour255
1.205     nicm     2324: from the 256-colour set,
                   2325: .Ic default ,
                   2326: or a hexadecimal RGB string such as
                   2327: .Ql #ffffff ,
                   2328: which chooses the closest match from the default 256-colour set.
1.378     nicm     2329: .Pp
                   2330: The attributes is either
                   2331: .Ic none
                   2332: or a comma-delimited list of one or more of:
                   2333: .Ic bright
                   2334: (or
                   2335: .Ic bold ) ,
                   2336: .Ic dim ,
                   2337: .Ic underscore ,
                   2338: .Ic blink ,
                   2339: .Ic reverse ,
                   2340: .Ic hidden ,
                   2341: or
                   2342: .Ic italics ,
                   2343: to turn an attribute on, or an attribute prefixed with
                   2344: .Ql no
                   2345: to turn one off.
                   2346: .Pp
                   2347: Examples are:
                   2348: .Bd -literal -offset indent
                   2349: fg=yellow,bold,underscore,blink
                   2350: bg=black,fg=default,noreverse
                   2351: .Ed
                   2352: .Pp
                   2353: With the
                   2354: .Fl a
                   2355: flag to the
                   2356: .Ic set-option
                   2357: command the new style is added otherwise the existing style is replaced.
                   2358: .It Ic message-style Ar style
                   2359: Set status line message style.
                   2360: For how to specify
                   2361: .Ar style ,
                   2362: see the
                   2363: .Ic message-command-style
                   2364: option.
1.226     nicm     2365: .It Xo Ic mouse-resize-pane
                   2366: .Op Ic on | off
                   2367: .Xc
                   2368: If on,
                   2369: .Nm
                   2370: captures the mouse and allows panes to be resized by dragging on their borders.
1.102     nicm     2371: .It Xo Ic mouse-select-pane
                   2372: .Op Ic on | off
                   2373: .Xc
                   2374: If on,
                   2375: .Nm
                   2376: captures the mouse and when a window is split into multiple panes the mouse may
                   2377: be used to select the current pane.
                   2378: The mouse click is also passed through to the application as normal.
1.222     nicm     2379: .It Xo Ic mouse-select-window
                   2380: .Op Ic on | off
                   2381: .Xc
                   2382: If on, clicking the mouse on a window name in the status line will select that
                   2383: window.
1.239     nicm     2384: .It Xo Ic mouse-utf8
                   2385: .Op Ic on | off
                   2386: .Xc
                   2387: If enabled, request mouse input as UTF-8 on UTF-8 terminals.
1.378     nicm     2388: .It Ic pane-active-border-style Ar style
                   2389: Set the pane border style for the currently active pane.
                   2390: For how to specify
                   2391: .Ar style ,
                   2392: see the
                   2393: .Ic message-command-style
                   2394: option.
                   2395: Attributes are ignored.
                   2396: .It Ic pane-border-style Ar style
                   2397: Set the pane border style for paneas aside from the active pane.
                   2398: For how to specify
                   2399: .Ar style ,
                   2400: see the
                   2401: .Ic message-command-style
                   2402: option.
                   2403: Attributes are ignored.
1.267     nicm     2404: .It Ic prefix Ar key
                   2405: Set the key accepted as a prefix key.
                   2406: .It Ic prefix2 Ar key
                   2407: Set a secondary key accepted as a prefix key.
1.291     nicm     2408: .It Xo Ic renumber-windows
                   2409: .Op Ic on | off
                   2410: .Xc
                   2411: If on, when a window is closed in a session, automatically renumber the other
                   2412: windows in numerical order.
                   2413: This respects the
                   2414: .Ic base-index
                   2415: option if it has been set.
                   2416: If off, do not renumber the windows.
1.21      nicm     2417: .It Ic repeat-time Ar time
1.1       nicm     2418: Allow multiple commands to be entered without pressing the prefix-key again
                   2419: in the specified
1.21      nicm     2420: .Ar time
1.1       nicm     2421: milliseconds (the default is 500).
                   2422: Whether a key repeats may be set when it is bound using the
                   2423: .Fl r
                   2424: flag to
                   2425: .Ic bind-key .
1.52      nicm     2426: Repeat is enabled for the default keys bound to the
                   2427: .Ic resize-pane
                   2428: command.
1.1       nicm     2429: .It Xo Ic set-remain-on-exit
1.56      jmc      2430: .Op Ic on | off
1.1       nicm     2431: .Xc
                   2432: Set the
                   2433: .Ic remain-on-exit
                   2434: window option for any windows first created in this session.
1.153     nicm     2435: When this option is true, windows in which the running program has
                   2436: exited do not close, instead remaining open but inactivate.
                   2437: Use the
                   2438: .Ic respawn-window
                   2439: command to reactivate such a window, or the
                   2440: .Ic kill-window
                   2441: command to destroy it.
1.1       nicm     2442: .It Xo Ic set-titles
1.56      jmc      2443: .Op Ic on | off
1.1       nicm     2444: .Xc
1.261     nicm     2445: Attempt to set the client terminal title using the
                   2446: .Em tsl
                   2447: and
                   2448: .Em fsl
                   2449: .Xr terminfo 5
                   2450: entries if they exist.
                   2451: .Nm
                   2452: automatically sets these to the \ee]2;...\e007 sequence if
1.1       nicm     2453: the terminal appears to be an xterm.
1.11      nicm     2454: This option is off by default.
1.6       jmc      2455: Note that elinks
1.1       nicm     2456: will only attempt to set the window title if the STY environment
                   2457: variable is set.
1.86      nicm     2458: .It Ic set-titles-string Ar string
                   2459: String used to set the window title if
                   2460: .Ic set-titles
                   2461: is on.
                   2462: Character sequences are replaced as for the
                   2463: .Ic status-left
                   2464: option.
1.1       nicm     2465: .It Xo Ic status
1.56      jmc      2466: .Op Ic on | off
1.1       nicm     2467: .Xc
                   2468: Show or hide the status line.
                   2469: .It Ic status-interval Ar interval
                   2470: Update the status bar every
                   2471: .Ar interval
                   2472: seconds.
                   2473: By default, updates will occur every 15 seconds.
                   2474: A setting of zero disables redrawing at interval.
1.41      nicm     2475: .It Xo Ic status-justify
1.56      jmc      2476: .Op Ic left | centre | right
1.41      nicm     2477: .Xc
                   2478: Set the position of the window list component of the status line: left, centre
                   2479: or right justified.
1.1       nicm     2480: .It Xo Ic status-keys
1.56      jmc      2481: .Op Ic vi | emacs
1.1       nicm     2482: .Xc
1.6       jmc      2483: Use vi or emacs-style
1.1       nicm     2484: key bindings in the status line, for example at the command prompt.
1.191     nicm     2485: The default is emacs, unless the
                   2486: .Ev VISUAL
                   2487: or
                   2488: .Ev EDITOR
                   2489: environment variables are set and contain the string
                   2490: .Ql vi .
1.1       nicm     2491: .It Ic status-left Ar string
                   2492: Display
                   2493: .Ar string
1.359     nicm     2494: (by default the session name) to the left of the status bar.
1.1       nicm     2495: .Ar string
                   2496: will be passed through
                   2497: .Xr strftime 3
1.359     nicm     2498: and formats (see
1.379     jmc      2499: .Sx FORMATS )
1.359     nicm     2500: will be expanded.
                   2501: It may also contain any of the following special character sequences:
1.1       nicm     2502: .Bl -column "Character pair" "Replaced with" -offset indent
                   2503: .It Sy "Character pair" Ta Sy "Replaced with"
1.153     nicm     2504: .It Li "#(shell-command)" Ta "First line of the command's output"
1.83      nicm     2505: .It Li "#[attributes]" Ta "Colour or attribute change"
1.1       nicm     2506: .It Li "##" Ta "A literal" Ql #
                   2507: .El
1.83      nicm     2508: .Pp
1.153     nicm     2509: The #(shell-command) form executes
                   2510: .Ql shell-command
                   2511: and inserts the first line of its output.
1.103     nicm     2512: Note that shell commands are only executed once at the interval specified by
                   2513: the
                   2514: .Ic status-interval
                   2515: option: if the status line is redrawn in the meantime, the previous result is
                   2516: used.
1.161     nicm     2517: Shell commands are executed with the
                   2518: .Nm
                   2519: global environment set (see the
1.162     jmc      2520: .Sx ENVIRONMENT
                   2521: section).
1.163     nicm     2522: .Pp
1.263     nicm     2523: For details on how the names and titles can be set see the
1.261     nicm     2524: .Sx "NAMES AND TITLES"
                   2525: section.
1.378     nicm     2526: For a list of allowed attributes see the
                   2527: .Ic message-command-style
                   2528: option.
1.109     nicm     2529: .Pp
1.83      nicm     2530: Examples are:
                   2531: .Bd -literal -offset indent
                   2532: #(sysctl vm.loadavg)
                   2533: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
                   2534: .Ed
1.10      nicm     2535: .Pp
1.12      jmc      2536: By default, UTF-8 in
1.10      nicm     2537: .Ar string
                   2538: is not interpreted, to enable UTF-8, use the
                   2539: .Ic status-utf8
                   2540: option.
1.1       nicm     2541: .It Ic status-left-length Ar length
                   2542: Set the maximum
                   2543: .Ar length
                   2544: of the left component of the status bar.
                   2545: The default is 10.
1.378     nicm     2546: .It Ic status-left-style Ar style
                   2547: Set the style of the left part of the status line.
                   2548: For how to specify
                   2549: .Ar style ,
                   2550: see the
                   2551: .Ic message-command-style
                   2552: option.
1.269     nicm     2553: .It Xo Ic status-position
                   2554: .Op Ic top | bottom
                   2555: .Xc
                   2556: Set the position of the status line.
1.1       nicm     2557: .It Ic status-right Ar string
                   2558: Display
                   2559: .Ar string
                   2560: to the right of the status bar.
1.151     nicm     2561: By default, the current window title in double quotes, the date and the time
                   2562: are shown.
1.1       nicm     2563: As with
                   2564: .Ic status-left ,
                   2565: .Ar string
                   2566: will be passed to
1.10      nicm     2567: .Xr strftime 3 ,
                   2568: character pairs are replaced, and UTF-8 is dependent on the
                   2569: .Ic status-utf8
                   2570: option.
1.1       nicm     2571: .It Ic status-right-length Ar length
                   2572: Set the maximum
                   2573: .Ar length
                   2574: of the right component of the status bar.
                   2575: The default is 40.
1.378     nicm     2576: .It Ic status-right-style Ar style
                   2577: Set the style of the right part of the status line.
                   2578: For how to specify
                   2579: .Ar style ,
                   2580: see the
                   2581: .Ic message-command-style
                   2582: option.
                   2583: .It Ic status-style Ar style
                   2584: Set status line style.
                   2585: For how to specify
                   2586: .Ar style ,
                   2587: see the
                   2588: .Ic message-command-style
                   2589: option.
1.10      nicm     2590: .It Xo Ic status-utf8
1.56      jmc      2591: .Op Ic on | off
1.10      nicm     2592: .Xc
                   2593: Instruct
                   2594: .Nm
                   2595: to treat top-bit-set characters in the
                   2596: .Ic status-left
                   2597: and
                   2598: .Ic status-right
                   2599: strings as UTF-8; notably, this is important for wide characters.
                   2600: This option defaults to off.
1.63      nicm     2601: .It Ic update-environment Ar variables
                   2602: Set a space-separated string containing a list of environment variables to be
                   2603: copied into the session environment when a new session is created or an
                   2604: existing session is attached.
                   2605: Any variables that do not exist in the source environment are set to be
                   2606: removed from the session environment (as if
                   2607: .Fl r
                   2608: was given to the
                   2609: .Ic set-environment
                   2610: command).
                   2611: The default is
1.190     nicm     2612: "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
                   2613: XAUTHORITY".
1.37      nicm     2614: .It Xo Ic visual-activity
1.56      jmc      2615: .Op Ic on | off
1.37      nicm     2616: .Xc
                   2617: If on, display a status line message when activity occurs in a window
1.39      jmc      2618: for which the
1.37      nicm     2619: .Ic monitor-activity
                   2620: window option is enabled.
                   2621: .It Xo Ic visual-bell
1.56      jmc      2622: .Op Ic on | off
1.37      nicm     2623: .Xc
                   2624: If this option is on, a message is shown on a bell instead of it being passed
                   2625: through to the terminal (which normally makes a sound).
                   2626: Also see the
                   2627: .Ic bell-action
                   2628: option.
1.192     nicm     2629: .It Xo Ic visual-silence
                   2630: .Op Ic on | off
                   2631: .Xc
                   2632: If
                   2633: .Ic monitor-silence
                   2634: is enabled, prints a message after the interval has expired on a given window.
1.255     nicm     2635: .It Ic word-separators Ar string
                   2636: Sets the session's conception of what characters are considered word
                   2637: separators, for the purposes of the next and previous word commands in
                   2638: copy mode.
                   2639: The default is
                   2640: .Ql \ -_@ .
1.1       nicm     2641: .El
                   2642: .It Xo Ic set-window-option
1.356     nicm     2643: .Op Fl agoqu
1.1       nicm     2644: .Op Fl t Ar target-window
                   2645: .Ar option Ar value
                   2646: .Xc
                   2647: .D1 (alias: Ic setw )
1.18      nicm     2648: Set a window option.
1.1       nicm     2649: The
1.58      nicm     2650: .Fl a ,
1.281     nicm     2651: .Fl g ,
1.356     nicm     2652: .Fl o ,
1.281     nicm     2653: .Fl q
1.1       nicm     2654: and
                   2655: .Fl u
                   2656: flags work similarly to the
                   2657: .Ic set-option
                   2658: command.
                   2659: .Pp
1.18      nicm     2660: Supported window options are:
1.56      jmc      2661: .Pp
                   2662: .Bl -tag -width Ds -compact
1.1       nicm     2663: .It Xo Ic aggressive-resize
1.56      jmc      2664: .Op Ic on | off
1.1       nicm     2665: .Xc
                   2666: Aggressively resize the chosen window.
                   2667: This means that
                   2668: .Nm
                   2669: will resize the window to the size of the smallest session for which it is the
                   2670: current window, rather than the smallest session to which it is attached.
                   2671: The window may resize when the current window is changed on another sessions;
1.6       jmc      2672: this option is good for full-screen programs which support
                   2673: .Dv SIGWINCH
                   2674: and poor for interactive programs such as shells.
1.262     nicm     2675: .Pp
                   2676: .It Xo Ic allow-rename
                   2677: .Op Ic on | off
                   2678: .Xc
                   2679: Allow programs to change the window name using a terminal escape
                   2680: sequence (\\033k...\\033\\\\).
                   2681: The default is on.
1.56      jmc      2682: .Pp
1.196     nicm     2683: .It Xo Ic alternate-screen
                   2684: .Op Ic on | off
                   2685: .Xc
                   2686: This option configures whether programs running inside
                   2687: .Nm
                   2688: may use the terminal alternate screen feature, which allows the
                   2689: .Em smcup
                   2690: and
                   2691: .Em rmcup
                   2692: .Xr terminfo 5
1.209     nicm     2693: capabilities.
                   2694: The alternate screen feature preserves the contents of the window when an
                   2695: interactive application starts and restores it on exit, so that any output
                   2696: visible before the application starts reappears unchanged after it exits.
                   2697: The default is on.
1.196     nicm     2698: .Pp
1.1       nicm     2699: .It Xo Ic automatic-rename
1.56      jmc      2700: .Op Ic on | off
1.1       nicm     2701: .Xc
                   2702: Control automatic window renaming.
                   2703: When this setting is enabled,
                   2704: .Nm
1.368     nicm     2705: will rename the window automatically using the format specified by
                   2706: .Ic automatic-rename-format .
1.1       nicm     2707: This flag is automatically disabled for an individual window when a name
                   2708: is specified at creation with
1.186     nicm     2709: .Ic new-window
                   2710: or
1.1       nicm     2711: .Ic new-session ,
                   2712: or later with
1.261     nicm     2713: .Ic rename-window ,
                   2714: or with a terminal escape sequence.
1.1       nicm     2715: It may be switched off globally with:
                   2716: .Bd -literal -offset indent
                   2717: set-window-option -g automatic-rename off
                   2718: .Ed
1.368     nicm     2719: .Pp
                   2720: .It Ic automatic-rename-format Ar format
                   2721: The format (see
                   2722: .Sx FORMATS )
                   2723: used when the
                   2724: .Ic automatic-rename
                   2725: option is enabled.
1.283     nicm     2726: .Pp
                   2727: .It Ic c0-change-interval Ar interval
                   2728: .It Ic c0-change-trigger Ar trigger
                   2729: These two options configure a simple form of rate limiting for a pane.
                   2730: If
                   2731: .Nm
                   2732: sees more than
                   2733: .Ar trigger
                   2734: C0 sequences that modify the screen (for example, carriage returns, linefeeds
                   2735: or backspaces) in one millisecond, it will stop updating the pane immediately and
                   2736: instead redraw it entirely every
                   2737: .Ar interval
                   2738: milliseconds.
                   2739: This helps to prevent fast output (such as
1.374     nicm     2740: .Xr yes 1 )
                   2741: overwhelming the terminal.
1.284     nicm     2742: The default is a trigger of 250 and an interval of 100.
1.283     nicm     2743: A trigger of zero disables the rate limiting.
1.56      jmc      2744: .Pp
1.1       nicm     2745: .It Ic clock-mode-colour Ar colour
                   2746: Set clock colour.
1.56      jmc      2747: .Pp
1.1       nicm     2748: .It Xo Ic clock-mode-style
1.56      jmc      2749: .Op Ic 12 | 24
1.1       nicm     2750: .Xc
                   2751: Set clock hour format.
1.56      jmc      2752: .Pp
1.1       nicm     2753: .It Ic force-height Ar height
                   2754: .It Ic force-width Ar width
                   2755: Prevent
                   2756: .Nm
                   2757: from resizing a window to greater than
                   2758: .Ar width
                   2759: or
                   2760: .Ar height .
                   2761: A value of zero restores the default unlimited setting.
1.56      jmc      2762: .Pp
1.196     nicm     2763: .It Ic main-pane-height Ar height
1.2       nicm     2764: .It Ic main-pane-width Ar width
                   2765: Set the width or height of the main (left or top) pane in the
                   2766: .Ic main-horizontal
                   2767: or
                   2768: .Ic main-vertical
                   2769: layouts.
1.56      jmc      2770: .Pp
1.1       nicm     2771: .It Xo Ic mode-keys
1.56      jmc      2772: .Op Ic vi | emacs
1.1       nicm     2773: .Xc
1.105     nicm     2774: Use vi or emacs-style key bindings in copy and choice modes.
1.191     nicm     2775: As with the
                   2776: .Ic status-keys
                   2777: option, the default is emacs, unless
                   2778: .Ev VISUAL
                   2779: or
                   2780: .Ev EDITOR
                   2781: contains
                   2782: .Ql vi .
1.56      jmc      2783: .Pp
1.50      nicm     2784: .It Xo Ic mode-mouse
1.240     nicm     2785: .Op Ic on | off | copy-mode
1.50      nicm     2786: .Xc
1.51      jmc      2787: Mouse state in modes.
1.223     nicm     2788: If on, the mouse may be used to enter copy mode and copy a selection by
                   2789: dragging, to enter copy mode and scroll with the mouse wheel, or to select an
                   2790: option in choice mode.
1.240     nicm     2791: If set to
1.241     jmc      2792: .Em copy-mode ,
1.240     nicm     2793: the mouse behaves as set to on, but cannot be used to enter copy
                   2794: mode.
1.56      jmc      2795: .Pp
1.378     nicm     2796: .It Ic mode-style Ar style
                   2797: Set window modes style.
                   2798: For how to specify
                   2799: .Ar style ,
                   2800: see the
                   2801: .Ic message-command-style
                   2802: option.
                   2803: .Pp
1.1       nicm     2804: .It Xo Ic monitor-activity
1.56      jmc      2805: .Op Ic on | off
1.1       nicm     2806: .Xc
                   2807: Monitor for activity in the window.
                   2808: Windows with activity are highlighted in the status line.
1.56      jmc      2809: .Pp
1.192     nicm     2810: .It Xo Ic monitor-silence
                   2811: .Op Ic interval
                   2812: .Xc
                   2813: Monitor for silence (no activity) in the window within
                   2814: .Ic interval
                   2815: seconds.
                   2816: Windows that have been silent for the interval are highlighted in the
                   2817: status line.
                   2818: An interval of zero disables the monitoring.
1.195     nicm     2819: .Pp
                   2820: .It Ic other-pane-height Ar height
                   2821: Set the height of the other panes (not the main pane) in the
                   2822: .Ic main-horizontal
                   2823: layout.
                   2824: If this option is set to 0 (the default), it will have no effect.
                   2825: If both the
                   2826: .Ic main-pane-height
                   2827: and
                   2828: .Ic other-pane-height
                   2829: options are set, the main pane will grow taller to make the other panes the
                   2830: specified height, but will never shrink to do so.
                   2831: .Pp
                   2832: .It Ic other-pane-width Ar width
                   2833: Like
                   2834: .Ic other-pane-height ,
                   2835: but set the width of other panes in the
                   2836: .Ic main-vertical
                   2837: layout.
1.243     nicm     2838: .Pp
                   2839: .It Ic pane-base-index Ar index
                   2840: Like
                   2841: .Ic base-index ,
                   2842: but set the starting index for pane numbers.
1.192     nicm     2843: .Pp
1.1       nicm     2844: .It Xo Ic remain-on-exit
1.56      jmc      2845: .Op Ic on | off
1.1       nicm     2846: .Xc
                   2847: A window with this flag set is not destroyed when the program running in it
                   2848: exits.
                   2849: The window may be reactivated with the
                   2850: .Ic respawn-window
                   2851: command.
1.56      jmc      2852: .Pp
1.99      nicm     2853: .It Xo Ic synchronize-panes
                   2854: .Op Ic on | off
                   2855: .Xc
1.164     nicm     2856: Duplicate input to any pane to all other panes in the same window (only
                   2857: for panes that are not in any special mode).
1.139     nicm     2858: .Pp
1.1       nicm     2859: .It Xo Ic utf8
1.56      jmc      2860: .Op Ic on | off
1.1       nicm     2861: .Xc
                   2862: Instructs
                   2863: .Nm
                   2864: to expect UTF-8 sequences to appear in this window.
1.56      jmc      2865: .Pp
1.378     nicm     2866: .It Ic window-status-activity-style Ar style
                   2867: Set status line style for windows with an activity alert.
                   2868: For how to specify
                   2869: .Ar style ,
                   2870: see the
                   2871: .Ic message-command-style
                   2872: option.
1.169     nicm     2873: .Pp
1.378     nicm     2874: .It Ic window-status-bell-style Ar style
                   2875: Set status line style for windows with a bell alert.
                   2876: For how to specify
                   2877: .Ar style ,
                   2878: see the
                   2879: .Ic message-command-style
                   2880: option.
1.169     nicm     2881: .Pp
1.125     nicm     2882: .It Ic window-status-current-format Ar string
                   2883: Like
                   2884: .Ar window-status-format ,
                   2885: but is the format used when the window is the current window.
1.307     nicm     2886: .Pp
1.378     nicm     2887: .It Ic window-status-current-style Ar style
                   2888: Set status line style for the currently active window.
                   2889: For how to specify
                   2890: .Ar style ,
                   2891: see the
                   2892: .Ic message-command-style
                   2893: option.
1.239     nicm     2894: .Pp
                   2895: .It Ic window-status-format Ar string
                   2896: Set the format in which the window is displayed in the status line window list.
                   2897: See the
                   2898: .Ar status-left
                   2899: option for details of special character sequences available.
                   2900: The default is
                   2901: .Ql #I:#W#F .
1.290     nicm     2902: .Pp
1.378     nicm     2903: .It Ic window-status-last-style Ar style
                   2904: Set status line style for the last active window.
                   2905: For how to specify
                   2906: .Ar style ,
                   2907: see the
                   2908: .Ic message-command-style
                   2909: option.
                   2910: .Pp
1.290     nicm     2911: .It Ic window-status-separator Ar string
                   2912: Sets the separator drawn between windows in the status line.
                   2913: The default is a single space character.
1.125     nicm     2914: .Pp
1.378     nicm     2915: .It Ic window-status-style Ar style
                   2916: Set status line style for a single window.
                   2917: For how to specify
                   2918: .Ar style ,
                   2919: see the
                   2920: .Ic message-command-style
                   2921: option.
                   2922: .Pp
1.1       nicm     2923: .It Xo Ic xterm-keys
1.56      jmc      2924: .Op Ic on | off
1.1       nicm     2925: .Xc
                   2926: If this option is set,
                   2927: .Nm
                   2928: will generate
1.57      jmc      2929: .Xr xterm 1 -style
                   2930: function key sequences; these have a number included to indicate modifiers such
                   2931: as Shift, Alt or Ctrl.
1.123     nicm     2932: The default is off.
1.282     nicm     2933: .Pp
                   2934: .It Xo Ic wrap-search
                   2935: .Op Ic on | off
                   2936: .Xc
                   2937: If this option is set, searches will wrap around the end of the pane contents.
                   2938: The default is on.
1.57      jmc      2939: .El
                   2940: .It Xo Ic show-options
1.340     nicm     2941: .Op Fl gqsvw
1.129     nicm     2942: .Op Fl t Ar target-session | Ar target-window
1.276     nicm     2943: .Op Ar option
1.57      jmc      2944: .Xc
                   2945: .D1 (alias: Ic show )
1.276     nicm     2946: Show the window options (or a single window option if given) with
1.129     nicm     2947: .Fl w
1.133     nicm     2948: (equivalent to
1.134     nicm     2949: .Ic show-window-options ) ,
1.133     nicm     2950: the server options with
                   2951: .Fl s ,
                   2952: otherwise the session options for
                   2953: .Ar target session .
                   2954: Global session or window options are listed if
                   2955: .Fl g
                   2956: is used.
1.317     nicm     2957: .Fl v
                   2958: shows only the option value, not the name.
1.340     nicm     2959: If
                   2960: .Fl q
                   2961: is set, no error will be returned if
                   2962: .Ar option
                   2963: is unset.
1.57      jmc      2964: .It Xo Ic show-window-options
1.317     nicm     2965: .Op Fl gv
1.57      jmc      2966: .Op Fl t Ar target-window
1.276     nicm     2967: .Op Ar option
1.57      jmc      2968: .Xc
                   2969: .D1 (alias: Ic showw )
1.276     nicm     2970: List the window options or a single option for
1.57      jmc      2971: .Ar target-window ,
                   2972: or the global window options if
                   2973: .Fl g
                   2974: is used.
1.317     nicm     2975: .Fl v
                   2976: shows only the option value, not the name.
1.63      nicm     2977: .El
1.245     nicm     2978: .Sh FORMATS
1.294     nicm     2979: Certain commands accept the
1.245     nicm     2980: .Fl F
                   2981: flag with a
                   2982: .Ar format
                   2983: argument.
                   2984: This is a string which controls the output format of the command.
                   2985: Replacement variables are enclosed in
                   2986: .Ql #{
                   2987: and
                   2988: .Ql } ,
                   2989: for example
1.359     nicm     2990: .Ql #{session_name} .
                   2991: Some variables also have an shorter alias such as
1.245     nicm     2992: .Ql #S .
1.376     nicm     2993: .Ql ##
                   2994: is replaced by a single
                   2995: .Ql # .
1.245     nicm     2996: Conditionals are also accepted by prefixing with
1.246     jmc      2997: .Ql \&?
1.245     nicm     2998: and separating two alternatives with a comma;
                   2999: if the specified variable exists and is not zero, the first alternative
1.246     jmc      3000: is chosen, otherwise the second is used.
                   3001: For example
1.245     nicm     3002: .Ql #{?session_attached,attached,not attached}
                   3003: will include the string
                   3004: .Ql attached
                   3005: if the session is attached and the string
                   3006: .Ql not attached
                   3007: if it is unattached.
1.367     nicm     3008: A limit may be placed on the length of the resultant string by prefixing it
                   3009: by an
                   3010: .Ql = ,
                   3011: a number and a colon, so
                   3012: .Ql #{=10:pane_title}
                   3013: will include at most the first 10 characters of the pane title.
1.245     nicm     3014: .Pp
                   3015: The following variables are available, where appropriate:
1.359     nicm     3016: .Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX"
                   3017: .It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with"
                   3018: .It Li "alternate_on" Ta "" Ta "If pane is in alternate screen"
                   3019: .It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen"
                   3020: .It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen"
1.386     nicm     3021: .It Li "buffer_sample" Ta "" Ta "Sample of start of buffer"
1.359     nicm     3022: .It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes"
                   3023: .It Li "client_activity" Ta "" Ta "Integer time client last had activity"
                   3024: .It Li "client_activity_string" Ta "" Ta "String time client last had activity"
                   3025: .It Li "client_created" Ta "" Ta "Integer time client created"
                   3026: .It Li "client_created_string" Ta "" Ta "String time client created"
                   3027: .It Li "client_height" Ta "" Ta "Height of client"
                   3028: .It Li "client_last_session" Ta "" Ta "Name of the client's last session"
                   3029: .It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed"
                   3030: .It Li "client_readonly" Ta "" Ta "1 if client is readonly"
                   3031: .It Li "client_session" Ta "" Ta "Name of the client's session"
                   3032: .It Li "client_termname" Ta "" Ta "Terminal name of client"
                   3033: .It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
                   3034: .It Li "client_utf8" Ta "" Ta "1 if client supports utf8"
                   3035: .It Li "client_width" Ta "" Ta "Width of client"
                   3036: .It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
                   3037: .It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
                   3038: .It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"
                   3039: .It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
                   3040: .It Li "history_limit" Ta "" Ta "Maximum window history lines"
                   3041: .It Li "history_size" Ta "" Ta "Size of history in bytes"
                   3042: .It Li "host" Ta "#H" Ta "Hostname of local host"
                   3043: .It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)"
                   3044: .It Li "insert_flag" Ta "" Ta "Pane insert flag"
                   3045: .It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag"
                   3046: .It Li "keypad_flag" Ta "" Ta "Pane keypad flag"
                   3047: .It Li "line" Ta "" Ta "Line number in the list"
                   3048: .It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag"
                   3049: .It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag"
                   3050: .It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
                   3051: .It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
                   3052: .It Li "pane_active" Ta "" Ta "1 if active pane"
                   3053: .It Li "pane_current_command" Ta "" Ta "Current command if available"
                   3054: .It Li "pane_dead" Ta "" Ta "1 if pane is dead"
                   3055: .It Li "pane_height" Ta "" Ta "Height of pane"
                   3056: .It Li "pane_id" Ta "#D" Ta "Unique pane ID"
                   3057: .It Li "pane_in_mode" Ta "" Ta "If pane is in a mode"
1.363     nicm     3058: .It Li "pane_synchronized" Ta "" Ta "If pane is synchronized"
1.359     nicm     3059: .It Li "pane_index" Ta "#P" Ta "Index of pane"
                   3060: .It Li "pane_pid" Ta "" Ta "PID of first process in pane"
                   3061: .It Li "pane_start_command" Ta "" Ta "Command pane started with"
                   3062: .It Li "pane_tabs" Ta "" Ta "Pane tab positions"
                   3063: .It Li "pane_title" Ta "#T" Ta "Title of pane"
                   3064: .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
                   3065: .It Li "pane_width" Ta "" Ta "Width of pane"
                   3066: .It Li "saved_cursor_x" Ta "" Ta "Saved cursor X in pane"
                   3067: .It Li "saved_cursor_y" Ta "" Ta "Saved cursor Y in pane"
                   3068: .It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
                   3069: .It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
1.382     nicm     3070: .It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
1.359     nicm     3071: .It Li "session_created" Ta "" Ta "Integer time session created"
                   3072: .It Li "session_created_string" Ta "" Ta "String time session created"
                   3073: .It Li "session_group" Ta "" Ta "Number of session group"
                   3074: .It Li "session_grouped" Ta "" Ta "1 if session in a group"
                   3075: .It Li "session_height" Ta "" Ta "Height of session"
                   3076: .It Li "session_id" Ta "" Ta "Unique session ID"
1.382     nicm     3077: .It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached"
1.359     nicm     3078: .It Li "session_name" Ta "#S" Ta "Name of session"
                   3079: .It Li "session_width" Ta "" Ta "Width of session"
                   3080: .It Li "session_windows" Ta "" Ta "Number of windows in session"
                   3081: .It Li "window_active" Ta "" Ta "1 if window active"
1.366     nicm     3082: .It Li "window_activity_flag" Ta "" Ta "1 if window has activity alert"
                   3083: .It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
1.359     nicm     3084: .It Li "window_find_matches" Ta "" Ta "Matched data from the find-window"
                   3085: .It Li "window_flags" Ta "#F" Ta "Window flags"
                   3086: .It Li "window_height" Ta "" Ta "Height of window"
                   3087: .It Li "window_id" Ta "" Ta "Unique window ID"
                   3088: .It Li "window_index" Ta "#I" Ta "Index of window"
                   3089: .It Li "window_layout" Ta "" Ta "Window layout description"
                   3090: .It Li "window_name" Ta "#W" Ta "Name of window"
                   3091: .It Li "window_panes" Ta "" Ta "Number of panes in window"
1.366     nicm     3092: .It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
1.359     nicm     3093: .It Li "window_width" Ta "" Ta "Width of window"
                   3094: .It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
1.245     nicm     3095: .El
1.261     nicm     3096: .Sh NAMES AND TITLES
                   3097: .Nm
                   3098: distinguishes between names and titles.
                   3099: Windows and sessions have names, which may be used to specify them in targets
                   3100: and are displayed in the status line and various lists: the name is the
                   3101: .Nm
                   3102: identifier for a window or session.
                   3103: Only panes have titles.
                   3104: A pane's title is typically set by the program running inside the pane and
                   3105: is not modified by
                   3106: .Nm .
                   3107: It is the same mechanism used to set for example the
                   3108: .Xr xterm 1
                   3109: window title in an
                   3110: .Xr X 7
                   3111: window manager.
1.268     nicm     3112: Windows themselves do not have titles - a window's title is the title of its
1.261     nicm     3113: active pane.
                   3114: .Nm
                   3115: itself may set the title of the terminal in which the client is running, see
                   3116: the
                   3117: .Ic set-titles
                   3118: option.
                   3119: .Pp
                   3120: A session's name is set with the
                   3121: .Ic new-session
                   3122: and
                   3123: .Ic rename-session
                   3124: commands.
                   3125: A window's name is set with one of:
                   3126: .Bl -enum -width Ds
                   3127: .It
                   3128: A command argument (such as
                   3129: .Fl n
                   3130: for
                   3131: .Ic new-window
                   3132: or
                   3133: .Ic new-session ) .
                   3134: .It
                   3135: An escape sequence:
                   3136: .Bd -literal -offset indent
                   3137: $ printf '\e033kWINDOW_NAME\e033\e\e'
                   3138: .Ed
                   3139: .It
                   3140: Automatic renaming, which sets the name to the active command in the window's
                   3141: active pane.
                   3142: See the
                   3143: .Ic automatic-rename
                   3144: option.
                   3145: .El
                   3146: .Pp
                   3147: When a pane is first created, its title is the hostname.
                   3148: A pane's title can be set via the OSC title setting sequence, for example:
                   3149: .Bd -literal -offset indent
                   3150: $ printf '\e033]2;My Title\e033\e\e'
                   3151: .Ed
1.63      nicm     3152: .Sh ENVIRONMENT
                   3153: When the server is started,
                   3154: .Nm
                   3155: copies the environment into the
                   3156: .Em global environment ;
                   3157: in addition, each session has a
                   3158: .Em session environment .
1.193     nicm     3159: When a window is created, the session and global environments are merged.
                   3160: If a variable exists in both, the value from the session environment is used.
                   3161: The result is the initial environment passed to the new process.
1.63      nicm     3162: .Pp
                   3163: The
                   3164: .Ic update-environment
                   3165: session option may be used to update the session environment from the client
                   3166: when a new session is created or an old reattached.
                   3167: .Nm
                   3168: also initialises the
                   3169: .Ev TMUX
                   3170: variable with some internal information to allow commands to be executed
                   3171: from inside, and the
                   3172: .Ev TERM
                   3173: variable with the correct terminal setting of
                   3174: .Ql screen .
                   3175: .Pp
                   3176: Commands to alter and view the environment are:
                   3177: .Bl -tag -width Ds
                   3178: .It Xo Ic set-environment
                   3179: .Op Fl gru
                   3180: .Op Fl t Ar target-session
                   3181: .Ar name Op Ar value
                   3182: .Xc
1.115     nicm     3183: .D1 (alias: Ic setenv )
1.63      nicm     3184: Set or unset an environment variable.
                   3185: If
                   3186: .Fl g
                   3187: is used, the change is made in the global environment; otherwise, it is applied
                   3188: to the session environment for
                   3189: .Ar target-session .
                   3190: The
                   3191: .Fl u
                   3192: flag unsets a variable.
                   3193: .Fl r
                   3194: indicates the variable is to be removed from the environment before starting a
                   3195: new process.
                   3196: .It Xo Ic show-environment
                   3197: .Op Fl g
                   3198: .Op Fl t Ar target-session
1.286     nicm     3199: .Op Ar variable
1.63      nicm     3200: .Xc
1.115     nicm     3201: .D1 (alias: Ic showenv )
1.63      nicm     3202: Display the environment for
                   3203: .Ar target-session
                   3204: or the global environment with
                   3205: .Fl g .
1.286     nicm     3206: If
                   3207: .Ar variable
                   3208: is omitted, all variables are shown.
1.63      nicm     3209: Variables removed from the environment are prefixed with
                   3210: .Ql - .
1.57      jmc      3211: .El
                   3212: .Sh STATUS LINE
                   3213: .Nm
                   3214: includes an optional status line which is displayed in the bottom line of each
                   3215: terminal.
                   3216: By default, the status line is enabled (it may be disabled with the
                   3217: .Ic status
                   3218: session option) and contains, from left-to-right: the name of the current
1.261     nicm     3219: session in square brackets; the window list; the title of the active pane
                   3220: in double quotes; and the time and date.
1.57      jmc      3221: .Pp
                   3222: The status line is made of three parts: configurable left and right sections
                   3223: (which may contain dynamic content such as the time or output from a shell
                   3224: command, see the
                   3225: .Ic status-left ,
                   3226: .Ic status-left-length ,
                   3227: .Ic status-right ,
                   3228: and
                   3229: .Ic status-right-length
                   3230: options below), and a central window list.
1.125     nicm     3231: By default, the window list shows the index, name and (if any) flag of the
                   3232: windows present in the current session in ascending numerical order.
                   3233: It may be customised with the
                   3234: .Ar window-status-format
                   3235: and
                   3236: .Ar window-status-current-format
                   3237: options.
1.57      jmc      3238: The flag is one of the following symbols appended to the window name:
                   3239: .Bl -column "Symbol" "Meaning" -offset indent
                   3240: .It Sy "Symbol" Ta Sy "Meaning"
                   3241: .It Li "*" Ta "Denotes the current window."
                   3242: .It Li "-" Ta "Marks the last window (previously selected)."
                   3243: .It Li "#" Ta "Window is monitored and activity has been detected."
                   3244: .It Li "!" Ta "A bell has occurred in the window."
1.192     nicm     3245: .It Li "~" Ta "The window has been silent for the monitor-silence interval."
1.349     nicm     3246: .It Li "Z" Ta "The window's active pane is zoomed."
1.57      jmc      3247: .El
                   3248: .Pp
                   3249: The # symbol relates to the
                   3250: .Ic monitor-activity
1.388     nicm     3251: window option.
1.57      jmc      3252: The window name is printed in inverted colours if an alert (bell, activity or
1.388     nicm     3253: silence) is present.
1.57      jmc      3254: .Pp
1.131     nicm     3255: The colour and attributes of the status line may be configured, the entire
                   3256: status line using the
1.378     nicm     3257: .Ic status-style
                   3258: session option and individual windows using the
                   3259: .Ic window-status-style
                   3260: window option.
1.57      jmc      3261: .Pp
1.131     nicm     3262: The status line is automatically refreshed at interval if it has changed, the
                   3263: interval may be controlled with the
1.57      jmc      3264: .Ic status-interval
                   3265: session option.
                   3266: .Pp
                   3267: Commands related to the status line are as follows:
                   3268: .Bl -tag -width Ds
                   3269: .It Xo Ic command-prompt
1.235     nicm     3270: .Op Fl I Ar inputs
1.73      nicm     3271: .Op Fl p Ar prompts
1.57      jmc      3272: .Op Fl t Ar target-client
                   3273: .Op Ar template
                   3274: .Xc
                   3275: Open the command prompt in a client.
                   3276: This may be used from inside
                   3277: .Nm
                   3278: to execute commands interactively.
1.231     nicm     3279: .Pp
1.57      jmc      3280: If
                   3281: .Ar template
1.73      nicm     3282: is specified, it is used as the command.
1.235     nicm     3283: If present,
                   3284: .Fl I
                   3285: is a comma-separated list of the initial text for each prompt.
1.73      nicm     3286: If
                   3287: .Fl p
                   3288: is given,
                   3289: .Ar prompts
                   3290: is a comma-separated list of prompts which are displayed in order; otherwise
                   3291: a single prompt is displayed, constructed from
                   3292: .Ar template
                   3293: if it is present, or
                   3294: .Ql \&:
                   3295: if not.
1.235     nicm     3296: .Pp
                   3297: Both
                   3298: .Ar inputs
                   3299: and
1.231     nicm     3300: .Ar prompts
                   3301: may contain the special character sequences supported by the
                   3302: .Ic status-left
                   3303: option.
                   3304: .Pp
1.73      nicm     3305: Before the command is executed, the first occurrence of the string
                   3306: .Ql %%
1.74      jmc      3307: and all occurrences of
1.73      nicm     3308: .Ql %1
                   3309: are replaced by the response to the first prompt, the second
                   3310: .Ql %%
                   3311: and all
                   3312: .Ql %2
                   3313: are replaced with the response to the second prompt, and so on for further
1.74      jmc      3314: prompts.
                   3315: Up to nine prompt responses may be replaced
                   3316: .Po
                   3317: .Ql %1
1.73      nicm     3318: to
1.74      jmc      3319: .Ql %9
                   3320: .Pc .
1.57      jmc      3321: .It Xo Ic confirm-before
1.238     nicm     3322: .Op Fl p Ar prompt
1.57      jmc      3323: .Op Fl t Ar target-client
                   3324: .Ar command
                   3325: .Xc
                   3326: .D1 (alias: Ic confirm )
                   3327: Ask for confirmation before executing
                   3328: .Ar command .
1.238     nicm     3329: If
                   3330: .Fl p
                   3331: is given,
                   3332: .Ar prompt
                   3333: is the prompt to display; otherwise a prompt is constructed from
                   3334: .Ar command .
                   3335: It may contain the special character sequences supported by the
                   3336: .Ic status-left
                   3337: option.
                   3338: .Pp
1.57      jmc      3339: This command works only from inside
                   3340: .Nm .
                   3341: .It Xo Ic display-message
1.127     nicm     3342: .Op Fl p
1.215     nicm     3343: .Op Fl c Ar target-client
                   3344: .Op Fl t Ar target-pane
1.57      jmc      3345: .Op Ar message
                   3346: .Xc
                   3347: .D1 (alias: Ic display )
1.127     nicm     3348: Display a message.
                   3349: If
                   3350: .Fl p
                   3351: is given, the output is printed to stdout, otherwise it is displayed in the
                   3352: .Ar target-client
                   3353: status line.
1.122     nicm     3354: The format of
1.124     jmc      3355: .Ar message
1.275     nicm     3356: is described in the
                   3357: .Sx FORMATS
                   3358: section; information is taken from
1.215     nicm     3359: .Ar target-pane
                   3360: if
                   3361: .Fl t
                   3362: is given, otherwise the active pane for the session attached to
                   3363: .Ar target-client .
1.57      jmc      3364: .El
                   3365: .Sh BUFFERS
                   3366: .Nm
1.392     nicm     3367: maintains a set of named
1.199     nicm     3368: .Em paste buffers .
1.392     nicm     3369: Each buffer may be either explicitly or automatically named.
                   3370: Explicitly named buffers are named when created with the
                   3371: .Ic set-buffer
                   3372: or
                   3373: .Ic load-buffer
                   3374: commands, or by renaming an automatically named buffer with
                   3375: .Ic set-buffer
                   3376: .Fl n .
                   3377: Automatically named buffers are given a name such as
                   3378: .Ql buffer0001 ,
                   3379: .Ql buffer0002
                   3380: and so on.
                   3381: When the
                   3382: .Ic buffer-limit
                   3383: option is reached, the oldest automatically named buffer is deleted.
                   3384: Explicitly named are not subject to
1.57      jmc      3385: .Ic buffer-limit
1.392     nicm     3386: and may be deleted with
                   3387: .Ic delete-buffer
                   3388: command.
                   3389: .Pp
1.57      jmc      3390: Buffers may be added using
                   3391: .Ic copy-mode
                   3392: or the
                   3393: .Ic set-buffer
1.392     nicm     3394: and
                   3395: .Ic load-buffer
                   3396: commands, and pasted into a window using the
1.57      jmc      3397: .Ic paste-buffer
                   3398: command.
1.392     nicm     3399: If a buffer command is used and no buffer is specified, the most
                   3400: recently added automatically named buffer is assumed.
1.57      jmc      3401: .Pp
                   3402: A configurable history buffer is also maintained for each window.
                   3403: By default, up to 2000 lines are kept; this can be altered with the
                   3404: .Ic history-limit
                   3405: option (see the
                   3406: .Ic set-option
                   3407: command above).
                   3408: .Pp
                   3409: The buffer commands are as follows:
                   3410: .Bl -tag -width Ds
1.178     nicm     3411: .It Xo
                   3412: .Ic choose-buffer
1.294     nicm     3413: .Op Fl F Ar format
1.178     nicm     3414: .Op Fl t Ar target-window
                   3415: .Op Ar template
                   3416: .Xc
                   3417: Put a window into buffer choice mode, where a buffer may be chosen
                   3418: interactively from a list.
                   3419: After a buffer is selected,
                   3420: .Ql %%
1.392     nicm     3421: is replaced by the buffer name in
1.178     nicm     3422: .Ar template
                   3423: and the result executed as a command.
                   3424: If
                   3425: .Ar template
                   3426: is not given, "paste-buffer -b '%%'" is used.
1.294     nicm     3427: For the meaning of the
                   3428: .Fl F
                   3429: flag, see the
                   3430: .Sx FORMATS
                   3431: section.
1.314     nicm     3432: This command works only if at least one client is attached.
1.57      jmc      3433: .It Ic clear-history Op Fl t Ar target-pane
                   3434: .D1 (alias: Ic clearhist )
                   3435: Remove and free the history for the specified pane.
1.392     nicm     3436: .It Ic delete-buffer Op Fl b Ar buffer-name
1.57      jmc      3437: .D1 (alias: Ic deleteb )
1.392     nicm     3438: Delete the buffer named
                   3439: .Ar buffer-name ,
                   3440: or the most recently added automatically named buffer if not specified.
1.294     nicm     3441: .It Xo Ic list-buffers
                   3442: .Op Fl F Ar format
                   3443: .Xc
1.57      jmc      3444: .D1 (alias: Ic lsb )
1.198     nicm     3445: List the global buffers.
1.294     nicm     3446: For the meaning of the
                   3447: .Fl F
                   3448: flag, see the
                   3449: .Sx FORMATS
                   3450: section.
1.200     jmc      3451: .It Xo Ic load-buffer
1.392     nicm     3452: .Op Fl b Ar buffer-name
1.57      jmc      3453: .Ar path
                   3454: .Xc
                   3455: .D1 (alias: Ic loadb )
                   3456: Load the contents of the specified paste buffer from
                   3457: .Ar path .
                   3458: .It Xo Ic paste-buffer
1.278     nicm     3459: .Op Fl dpr
1.392     nicm     3460: .Op Fl b Ar buffer-name
1.170     nicm     3461: .Op Fl s Ar separator
1.158     nicm     3462: .Op Fl t Ar target-pane
1.57      jmc      3463: .Xc
                   3464: .D1 (alias: Ic pasteb )
1.158     nicm     3465: Insert the contents of a paste buffer into the specified pane.
                   3466: If not specified, paste into the current one.
1.57      jmc      3467: With
                   3468: .Fl d ,
1.392     nicm     3469: also delete the paste buffer.
1.57      jmc      3470: When output, any linefeed (LF) characters in the paste buffer are replaced with
1.170     nicm     3471: a separator, by default carriage return (CR).
                   3472: A custom separator may be specified using the
                   3473: .Fl s
                   3474: flag.
                   3475: The
1.57      jmc      3476: .Fl r
1.170     nicm     3477: flag means to do no replacement (equivalent to a separator of LF).
1.278     nicm     3478: If
                   3479: .Fl p
                   3480: is specified, paste bracket control codes are inserted around the
                   3481: buffer if the application has requested bracketed paste mode.
1.57      jmc      3482: .It Xo Ic save-buffer
                   3483: .Op Fl a
1.392     nicm     3484: .Op Fl b Ar buffer-name
1.57      jmc      3485: .Ar path
                   3486: .Xc
                   3487: .D1 (alias: Ic saveb )
                   3488: Save the contents of the specified paste buffer to
                   3489: .Ar path .
                   3490: The
                   3491: .Fl a
                   3492: option appends to rather than overwriting the file.
                   3493: .It Xo Ic set-buffer
1.383     nicm     3494: .Op Fl a
1.392     nicm     3495: .Op Fl b Ar buffer-name
                   3496: .Op Fl n Ar new-buffer-name
1.57      jmc      3497: .Ar data
                   3498: .Xc
                   3499: .D1 (alias: Ic setb )
                   3500: Set the contents of the specified buffer to
                   3501: .Ar data .
1.383     nicm     3502: The
                   3503: .Fl a
                   3504: option appends to rather than overwriting the buffer.
1.392     nicm     3505: The
                   3506: .Fl n
                   3507: option renames the buffer to
                   3508: .Ar new-buffer-name .
1.1       nicm     3509: .It Xo Ic show-buffer
1.392     nicm     3510: .Op Fl b Ar buffer-name
1.1       nicm     3511: .Xc
                   3512: .D1 (alias: Ic showb )
                   3513: Display the contents of the specified buffer.
1.57      jmc      3514: .El
                   3515: .Sh MISCELLANEOUS
                   3516: Miscellaneous commands are as follows:
                   3517: .Bl -tag -width Ds
1.72      nicm     3518: .It Ic clock-mode Op Fl t Ar target-pane
1.57      jmc      3519: Display a large clock.
1.334     nicm     3520: .It Xo Ic if-shell
1.352     nicm     3521: .Op Fl b
1.334     nicm     3522: .Op Fl t Ar target-pane
                   3523: .Ar shell-command command
                   3524: .Op Ar command
                   3525: .Xc
1.57      jmc      3526: .D1 (alias: Ic if )
1.251     nicm     3527: Execute the first
1.57      jmc      3528: .Ar command
                   3529: if
                   3530: .Ar shell-command
1.251     nicm     3531: returns success or the second
                   3532: .Ar command
                   3533: otherwise.
1.334     nicm     3534: Before being executed, shell-command is expanded using the rules specified in the
                   3535: .Sx FORMATS
                   3536: section, including those relevant to
                   3537: .Ar target-pane .
1.335     nicm     3538: With
                   3539: .Fl b ,
                   3540: .Ar shell-command
                   3541: is run in the background.
1.57      jmc      3542: .It Ic lock-server
                   3543: .D1 (alias: Ic lock )
1.90      nicm     3544: Lock each client individually by running the command specified by the
                   3545: .Ic lock-command
                   3546: option.
1.308     nicm     3547: .It Xo Ic run-shell
1.357     nicm     3548: .Op Fl b
1.308     nicm     3549: .Op Fl t Ar target-pane
                   3550: .Ar shell-command
                   3551: .Xc
1.87      nicm     3552: .D1 (alias: Ic run )
                   3553: Execute
1.153     nicm     3554: .Ar shell-command
1.106     nicm     3555: in the background without creating a window.
1.334     nicm     3556: Before being executed, shell-command is expanded using the rules specified in
                   3557: the
                   3558: .Sx FORMATS
                   3559: section.
1.335     nicm     3560: With
                   3561: .Fl b ,
                   3562: the command is run in the background.
1.308     nicm     3563: After it finishes, any output to stdout is displayed in copy mode (in the pane
                   3564: specified by
                   3565: .Fl t
                   3566: or the current pane if omitted).
1.153     nicm     3567: If the command doesn't return success, the exit status is also displayed.
1.342     nicm     3568: .It Xo Ic wait-for
1.370     nicm     3569: .Op Fl L | S | U
1.342     nicm     3570: .Ar channel
                   3571: .Xc
                   3572: .D1 (alias: Ic wait )
1.343     nicm     3573: When used without options, prevents the client from exiting until woken using
1.342     nicm     3574: .Ic wait-for
                   3575: .Fl S
                   3576: with the same channel.
1.343     nicm     3577: When
                   3578: .Fl L
                   3579: is used, the channel is locked and any clients that try to lock the same
                   3580: channel are made to wait until the channel is unlocked with
                   3581: .Ic wait-for
                   3582: .Fl U .
1.342     nicm     3583: This command only works from outside
                   3584: .Nm .
1.228     nicm     3585: .El
                   3586: .Sh TERMINFO EXTENSIONS
                   3587: .Nm
                   3588: understands some extensions to
                   3589: .Xr terminfo 5 :
                   3590: .Bl -tag -width Ds
1.360     nicm     3591: .It Em Cs , Cr
1.233     nicm     3592: Set the cursor colour.
1.232     jmc      3593: The first takes a single string argument and is used to set the colour;
                   3594: the second takes no arguments and restores the default cursor colour.
                   3595: If set, a sequence such as this may be used
                   3596: to change the cursor colour from inside
                   3597: .Nm :
                   3598: .Bd -literal -offset indent
                   3599: $ printf '\e033]12;red\e033\e\e'
                   3600: .Ed
1.361     jmc      3601: .It Em \&Ss , Se
1.230     nicm     3602: Change the cursor style.
1.232     jmc      3603: If set, a sequence such as this may be used
                   3604: to change the cursor to an underline:
1.230     nicm     3605: .Bd -literal -offset indent
                   3606: $ printf '\e033[4 q'
                   3607: .Ed
                   3608: .Pp
                   3609: If
                   3610: .Em Csr
                   3611: is set, it will be used to reset the cursor style instead
                   3612: of
                   3613: .Em Cs .
1.232     jmc      3614: .It Em \&Ms
                   3615: This sequence can be used by
                   3616: .Nm
                   3617: to store the current buffer in the host terminal's selection (clipboard).
                   3618: See the
                   3619: .Em set-clipboard
                   3620: option above and the
                   3621: .Xr xterm 1
                   3622: man page.
1.345     nicm     3623: .El
                   3624: .Sh CONTROL MODE
                   3625: .Nm
                   3626: offers a textual interface called
                   3627: .Em control mode .
                   3628: This allows applications to communicate with
                   3629: .Nm
                   3630: using a simple text-only protocol.
                   3631: .Pp
                   3632: In control mode, a client sends
                   3633: .Nm
                   3634: commands or command sequences terminated by newlines on standard input.
                   3635: Each command will produce one block of output on standard output.
                   3636: An output block consists of a
                   3637: .Em %begin
                   3638: line followed by the output (which may be empty).
                   3639: The output block ends with a
                   3640: .Em %end
                   3641: or
                   3642: .Em %error .
                   3643: .Em %begin
                   3644: and matching
                   3645: .Em %end
                   3646: or
                   3647: .Em %error
                   3648: have two arguments: an integer time (as seconds from epoch) and command number.
                   3649: For example:
                   3650: .Bd -literal -offset indent
                   3651: %begin 1363006971 2
                   3652: 0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
                   3653: %end 1363006971 2
                   3654: .Ed
                   3655: .Pp
                   3656: In control mode,
                   3657: .Nm
                   3658: outputs notifications.
                   3659: A notification will never occur inside an output block.
                   3660: .Pp
                   3661: The following notifications are defined:
                   3662: .Bl -tag -width Ds
                   3663: .It Ic %exit Op Ar reason
                   3664: The
                   3665: .Nm
                   3666: client is exiting immediately, either because it is not attached to any session
                   3667: or an error occurred.
                   3668: If present,
                   3669: .Ar reason
                   3670: describes why the client exited.
                   3671: .It Ic %layout-change Ar window-id Ar window-layout
                   3672: The layout of a window with ID
                   3673: .Ar window-id
                   3674: changed.
                   3675: The new layout is
                   3676: .Ar window-layout .
1.347     nicm     3677: .It Ic %output Ar pane-id Ar value
                   3678: A window pane produced output.
1.345     nicm     3679: .Ar value
1.350     nicm     3680: escapes non-printable characters and backslash as octal \\xxx.
1.345     nicm     3681: .It Ic %session-changed Ar session-id Ar name
                   3682: The client is now attached to the session with ID
                   3683: .Ar session-id ,
                   3684: which is named
                   3685: .Ar name .
                   3686: .It Ic %session-renamed Ar name
                   3687: The current session was renamed to
                   3688: .Ar name .
                   3689: .It Ic %sessions-changed
                   3690: A session was created or destroyed.
                   3691: .It Ic %unlinked-window-add Ar window-id
                   3692: The window with ID
                   3693: .Ar window-id
                   3694: was created but is not linked to the current session.
                   3695: .It Ic %window-add Ar window-id
                   3696: The window with ID
                   3697: .Ar window-id
                   3698: was linked to the current session.
                   3699: .It Ic %window-close Ar window-id
                   3700: The window with ID
                   3701: .Ar window-id
                   3702: closed.
                   3703: .It Ic %window-renamed Ar window-id Ar name
                   3704: The window with ID
                   3705: .Ar window-id
                   3706: was renamed to
                   3707: .Ar name .
1.1       nicm     3708: .El
                   3709: .Sh FILES
1.26      nicm     3710: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1       nicm     3711: .It Pa ~/.tmux.conf
1.6       jmc      3712: Default
1.1       nicm     3713: .Nm
1.6       jmc      3714: configuration file.
1.26      nicm     3715: .It Pa /etc/tmux.conf
                   3716: System-wide configuration file.
1.1       nicm     3717: .El
1.57      jmc      3718: .Sh EXAMPLES
                   3719: To create a new
                   3720: .Nm
                   3721: session running
                   3722: .Xr vi 1 :
                   3723: .Pp
                   3724: .Dl $ tmux new-session vi
                   3725: .Pp
                   3726: Most commands have a shorter form, known as an alias.
                   3727: For new-session, this is
                   3728: .Ic new :
                   3729: .Pp
                   3730: .Dl $ tmux new vi
                   3731: .Pp
                   3732: Alternatively, the shortest unambiguous form of a command is accepted.
                   3733: If there are several options, they are listed:
                   3734: .Bd -literal -offset indent
                   3735: $ tmux n
                   3736: ambiguous command: n, could be: new-session, new-window, next-window
                   3737: .Ed
                   3738: .Pp
                   3739: Within an active session, a new window may be created by typing
                   3740: .Ql C-b c
                   3741: (Ctrl
                   3742: followed by the
                   3743: .Ql b
                   3744: key
                   3745: followed by the
                   3746: .Ql c
                   3747: key).
                   3748: .Pp
                   3749: Windows may be navigated with:
                   3750: .Ql C-b 0
                   3751: (to select window 0),
                   3752: .Ql C-b 1
                   3753: (to select window 1), and so on;
                   3754: .Ql C-b n
                   3755: to select the next window; and
                   3756: .Ql C-b p
                   3757: to select the previous window.
                   3758: .Pp
                   3759: A session may be detached using
                   3760: .Ql C-b d
1.64      nicm     3761: (or by an external event such as
                   3762: .Xr ssh 1
                   3763: disconnection) and reattached with:
1.57      jmc      3764: .Pp
                   3765: .Dl $ tmux attach-session
                   3766: .Pp
                   3767: Typing
                   3768: .Ql C-b \&?
                   3769: lists the current key bindings in the current window; up and down may be used
                   3770: to navigate the list or
                   3771: .Ql q
                   3772: to exit from it.
                   3773: .Pp
                   3774: Commands to be run when the
                   3775: .Nm
                   3776: server is started may be placed in the
                   3777: .Pa ~/.tmux.conf
                   3778: configuration file.
                   3779: Common examples include:
                   3780: .Pp
                   3781: Changing the default prefix key:
                   3782: .Bd -literal -offset indent
                   3783: set-option -g prefix C-a
                   3784: unbind-key C-b
                   3785: bind-key C-a send-prefix
                   3786: .Ed
                   3787: .Pp
                   3788: Turning the status line off, or changing its colour:
                   3789: .Bd -literal -offset indent
                   3790: set-option -g status off
1.378     nicm     3791: set-option -g status-style bg=blue
1.57      jmc      3792: .Ed
                   3793: .Pp
                   3794: Setting other options, such as the default command,
                   3795: or locking after 30 minutes of inactivity:
                   3796: .Bd -literal -offset indent
                   3797: set-option -g default-command "exec /bin/ksh"
                   3798: set-option -g lock-after-time 1800
                   3799: .Ed
                   3800: .Pp
                   3801: Creating new key bindings:
                   3802: .Bd -literal -offset indent
                   3803: bind-key b set-option status
                   3804: bind-key / command-prompt "split-window 'exec man %%'"
1.73      nicm     3805: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57      jmc      3806: .Ed
1.1       nicm     3807: .Sh SEE ALSO
                   3808: .Xr pty 4
                   3809: .Sh AUTHORS
1.364     schwarze 3810: .An Nicholas Marriott Aq Mt nicm@users.sourceforge.net