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

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