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

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