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

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