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

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