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

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