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

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