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

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