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

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