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

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