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

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