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

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