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

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