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

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