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

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