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

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