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

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