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

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