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

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