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

1.774   ! nicm        1: .\" $OpenBSD: tmux.1,v 1.773 2020/05/21 07:24:13 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.774   ! nicm       17: .Dd $Mdocdate: May 21 2020 $
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.767     nicm       26: .Op Fl 2CDluvV
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
1.744     nicm       31: .Op Fl T Ar features
1.1       nicm       32: .Op Ar command Op Ar flags
                     33: .Ek
                     34: .Sh DESCRIPTION
                     35: .Nm
1.59      jmc        36: is a terminal multiplexer:
                     37: it enables a number of terminals to be created, accessed, and
                     38: controlled from a single screen.
1.67      jmc        39: .Nm
                     40: may be detached from a screen
                     41: and continue running in the background,
                     42: then later reattached.
1.1       nicm       43: .Pp
1.60      nicm       44: When
                     45: .Nm
                     46: is started it creates a new
                     47: .Em session
                     48: with a single
                     49: .Em window
                     50: and displays it on screen.
                     51: A status line at the bottom of the screen
                     52: shows information on the current session
                     53: and is used to enter interactive commands.
                     54: .Pp
                     55: A session is a single collection of
                     56: .Em pseudo terminals
                     57: under the management of
                     58: .Nm .
                     59: Each session has one or more
                     60: windows linked to it.
                     61: A window occupies the entire screen
                     62: and may be split into rectangular panes,
                     63: each of which is a separate pseudo terminal
                     64: (the
                     65: .Xr pty 4
                     66: manual page documents the technical details of pseudo terminals).
                     67: Any number of
                     68: .Nm
                     69: instances may connect to the same session,
                     70: and any number of windows may be present in the same session.
                     71: Once all sessions are killed,
                     72: .Nm
                     73: exits.
                     74: .Pp
1.64      nicm       75: Each session is persistent and will survive accidental disconnection
1.66      jmc        76: (such as
1.64      nicm       77: .Xr ssh 1
1.67      jmc        78: connection timeout) or intentional detaching (with the
1.64      nicm       79: .Ql C-b d
                     80: key strokes).
                     81: .Nm
                     82: may be reattached using:
                     83: .Pp
                     84: .Dl $ tmux attach
1.60      nicm       85: .Pp
1.64      nicm       86: In
                     87: .Nm ,
                     88: a session is displayed on screen by a
                     89: .Em client
                     90: and all sessions are managed by a single
                     91: .Em server .
                     92: The server and each client are separate processes which communicate through a
                     93: socket in
                     94: .Pa /tmp .
1.65      nicm       95: .Pp
1.1       nicm       96: The options are as follows:
                     97: .Bl -tag -width "XXXXXXXXXXXX"
                     98: .It Fl 2
                     99: Force
                    100: .Nm
                    101: to assume the terminal supports 256 colours.
1.744     nicm      102: This is equivalent to
                    103: .Fl T Ar 256 .
1.345     nicm      104: .It Fl C
1.369     nicm      105: Start in control mode (see the
                    106: .Sx CONTROL MODE
                    107: section).
1.345     nicm      108: Given twice
                    109: .Xo ( Fl CC ) Xc
                    110: disables echo.
1.91      nicm      111: .It Fl c Ar shell-command
                    112: Execute
                    113: .Ar shell-command
                    114: using the default shell.
                    115: If necessary, the
                    116: .Nm
                    117: server will be started to retrieve the
                    118: .Ic default-shell
                    119: option.
1.153     nicm      120: This option is for compatibility with
                    121: .Xr sh 1
                    122: when
                    123: .Nm
                    124: is used as a login shell.
1.767     nicm      125: .It Fl D
                    126: Do not start the
                    127: .Nm
                    128: server as a daemon.
                    129: This also turns the
                    130: .Ic exit-empty
                    131: option off.
                    132: With
                    133: .Fl D ,
                    134: .Ar command
                    135: may not be specified.
1.1       nicm      136: .It Fl f Ar file
                    137: Specify an alternative configuration file.
                    138: By default,
                    139: .Nm
1.26      nicm      140: loads the system configuration file from
                    141: .Pa /etc/tmux.conf ,
                    142: if present, then looks for a user configuration file at
1.1       nicm      143: .Pa ~/.tmux.conf .
1.306     nicm      144: .Pp
1.1       nicm      145: The configuration file is a set of
                    146: .Nm
                    147: commands which are executed in sequence when the server is first started.
1.306     nicm      148: .Nm
                    149: loads configuration files once when the server process has started.
                    150: The
                    151: .Ic source-file
                    152: command may be used to load a file later.
1.61      nicm      153: .Pp
                    154: .Nm
1.306     nicm      155: shows any error messages from commands in configuration files in the first
                    156: session created, and continues to process the rest of the configuration file.
1.1       nicm      157: .It Fl L Ar socket-name
                    158: .Nm
                    159: stores the server socket in a directory under
1.455     nicm      160: .Ev TMUX_TMPDIR
                    161: or
1.208     nicm      162: .Pa /tmp
1.455     nicm      163: if it is unset.
1.355     nicm      164: The default socket is named
1.1       nicm      165: .Em default .
                    166: This option allows a different socket name to be specified, allowing several
                    167: independent
                    168: .Nm
                    169: servers to be run.
                    170: Unlike
                    171: .Fl S
                    172: a full path is not necessary: the sockets are all created in the same
                    173: directory.
1.2       nicm      174: .Pp
                    175: If the socket is accidentally removed, the
1.6       jmc       176: .Dv SIGUSR1
1.2       nicm      177: signal may be sent to the
                    178: .Nm
1.422     nicm      179: server process to recreate it (note that this will fail if any parent
                    180: directories are missing).
1.166     sobrado   181: .It Fl l
                    182: Behave as a login shell.
                    183: This flag currently has no effect and is for compatibility with other shells
                    184: when using tmux as a login shell.
1.1       nicm      185: .It Fl S Ar socket-path
                    186: Specify a full alternative path to the server socket.
                    187: If
                    188: .Fl S
                    189: is specified, the default socket directory is not used and any
                    190: .Fl L
                    191: flag is ignored.
                    192: .It Fl u
1.644     schwarze  193: Write UTF-8 output to the terminal even if the first environment
                    194: variable of
1.14      nicm      195: .Ev LC_ALL ,
1.644     schwarze  196: .Ev LC_CTYPE ,
                    197: or
1.2       nicm      198: .Ev LANG
1.644     schwarze  199: that is set does not contain
                    200: .Qq UTF-8
                    201: or
                    202: .Qq UTF8 .
1.744     nicm      203: This is equivalent to
                    204: .Fl T Ar UTF-8 .
                    205: .It Fl T Ar features
                    206: Set terminal features for the client.
                    207: This is a comma-separated list of features.
                    208: See the
                    209: .Ic terminal-features
                    210: option.
1.1       nicm      211: .It Fl v
                    212: Request verbose logging.
                    213: Log messages will be saved into
                    214: .Pa tmux-client-PID.log
                    215: and
                    216: .Pa tmux-server-PID.log
                    217: files in the current directory, where
                    218: .Em PID
1.6       jmc       219: is the PID of the server or client process.
1.558     nicm      220: If
                    221: .Fl v
                    222: is specified twice, an additional
                    223: .Pa tmux-out-PID.log
                    224: file is generated with a copy of everything
                    225: .Nm
                    226: writes to the terminal.
                    227: .Pp
                    228: The
                    229: .Dv SIGUSR2
                    230: signal may be sent to the
                    231: .Nm
                    232: server process to toggle logging between on (as if
                    233: .Fl v
                    234: was given) and off.
1.708     nicm      235: .It Fl V
                    236: Report the
                    237: .Nm
                    238: version.
1.1       nicm      239: .It Ar command Op Ar flags
                    240: This specifies one of a set of commands used to control
                    241: .Nm ,
1.6       jmc       242: as described in the following sections.
1.59      jmc       243: If no commands are specified, the
1.1       nicm      244: .Ic new-session
                    245: command is assumed.
1.57      jmc       246: .El
1.627     nicm      247: .Sh DEFAULT KEY BINDINGS
1.64      nicm      248: .Nm
                    249: may be controlled from an attached client by using a key combination of a
                    250: prefix key,
                    251: .Ql C-b
                    252: (Ctrl-b) by default, followed by a command key.
                    253: .Pp
1.172     nicm      254: The default command key bindings are:
1.64      nicm      255: .Pp
1.171     nicm      256: .Bl -tag -width "XXXXXXXXXX" -offset indent -compact
                    257: .It C-b
                    258: Send the prefix key (C-b) through to the application.
                    259: .It C-o
                    260: Rotate the panes in the current window forwards.
                    261: .It C-z
                    262: Suspend the
                    263: .Nm
                    264: client.
                    265: .It !
                    266: Break the current pane out of the window.
                    267: .It \&"
1.625     nicm      268: .\" "
1.171     nicm      269: Split the current pane into two, top and bottom.
                    270: .It #
                    271: List all paste buffers.
1.236     nicm      272: .It $
                    273: Rename the current session.
1.171     nicm      274: .It %
                    275: Split the current pane into two, left and right.
                    276: .It &
                    277: Kill the current window.
                    278: .It '
                    279: Prompt for a window index to select.
1.412     nicm      280: .It \&(
                    281: Switch the attached client to the previous session.
                    282: .It \&)
                    283: Switch the attached client to the next session.
1.171     nicm      284: .It ,
                    285: Rename the current window.
                    286: .It -
                    287: Delete the most recently copied buffer of text.
                    288: .It .
                    289: Prompt for an index to move the current window.
                    290: .It 0 to 9
                    291: Select windows 0 to 9.
                    292: .It :
                    293: Enter the
                    294: .Nm
                    295: command prompt.
1.187     nicm      296: .It ;
                    297: Move to the previously active pane.
1.178     nicm      298: .It =
                    299: Choose which buffer to paste interactively from a list.
1.171     nicm      300: .It \&?
                    301: List all key bindings.
                    302: .It D
                    303: Choose a client to detach.
1.412     nicm      304: .It L
                    305: Switch the attached client back to the last session.
1.182     jmc       306: .It \&[
1.171     nicm      307: Enter copy mode to copy text or view the history.
1.182     jmc       308: .It \&]
1.171     nicm      309: Paste the most recently copied buffer of text.
1.64      nicm      310: .It c
1.65      nicm      311: Create a new window.
1.64      nicm      312: .It d
1.65      nicm      313: Detach the current client.
1.171     nicm      314: .It f
                    315: Prompt to search for text in open windows.
                    316: .It i
                    317: Display some information about the current window.
1.64      nicm      318: .It l
1.65      nicm      319: Move to the previously selected window.
1.684     nicm      320: .It m
                    321: Mark the current pane (see
                    322: .Ic select-pane
                    323: .Fl m ) .
                    324: .It M
                    325: Clear the marked pane.
1.64      nicm      326: .It n
1.65      nicm      327: Change to the next window.
1.171     nicm      328: .It o
                    329: Select the next pane in the current window.
1.64      nicm      330: .It p
1.65      nicm      331: Change to the previous window.
1.171     nicm      332: .It q
                    333: Briefly display pane indexes.
                    334: .It r
                    335: Force redraw of the attached client.
                    336: .It s
                    337: Select a new session for the attached client interactively.
                    338: .It t
                    339: Show the time.
                    340: .It w
                    341: Choose the current window interactively.
                    342: .It x
                    343: Kill the current pane.
1.412     nicm      344: .It z
                    345: Toggle zoom state of the current pane.
1.171     nicm      346: .It {
                    347: Swap the current pane with the previous pane.
                    348: .It }
                    349: Swap the current pane with the next pane.
                    350: .It ~
                    351: Show previous messages from
                    352: .Nm ,
                    353: if any.
                    354: .It Page Up
                    355: Enter copy mode and scroll one page up.
                    356: .It Up, Down
                    357: .It Left, Right
                    358: Change to the pane above, below, to the left, or to the right of the current
                    359: pane.
                    360: .It M-1 to M-5
                    361: Arrange panes in one of the five preset layouts: even-horizontal,
                    362: even-vertical, main-horizontal, main-vertical, or tiled.
1.412     nicm      363: .It Space
                    364: Arrange the current window in the next preset layout.
1.171     nicm      365: .It M-n
                    366: Move to the next window with a bell or activity marker.
                    367: .It M-o
                    368: Rotate the panes in the current window backwards.
                    369: .It M-p
                    370: Move to the previous window with a bell or activity marker.
                    371: .It C-Up, C-Down
                    372: .It C-Left, C-Right
                    373: Resize the current pane in steps of one cell.
                    374: .It M-Up, M-Down
                    375: .It M-Left, M-Right
                    376: Resize the current pane in steps of five cells.
1.64      nicm      377: .El
                    378: .Pp
                    379: Key bindings may be changed with the
                    380: .Ic bind-key
                    381: and
                    382: .Ic unbind-key
                    383: commands.
1.651     nicm      384: .Sh COMMAND PARSING AND EXECUTION
                    385: .Nm
                    386: supports a large number of commands which can be used to control its
                    387: behaviour.
                    388: Each command is named and can accept zero or more flags and arguments.
                    389: They may be bound to a key with the
                    390: .Ic bind-key
                    391: command or run from the shell prompt, a shell script, a configuration file or
                    392: the command prompt.
                    393: For example, the same
                    394: .Ic set-option
                    395: command run from the shell prompt, from
                    396: .Pa ~/.tmux.conf
                    397: and bound to a key may look like:
                    398: .Bd -literal -offset indent
                    399: $ tmux set-option -g status-style bg=cyan
                    400:
                    401: set-option -g status-style bg=cyan
                    402:
                    403: bind-key C set-option -g status-style bg=cyan
                    404: .Ed
                    405: .Pp
                    406: Here, the command name is
                    407: .Ql set-option ,
                    408: .Ql Fl g
                    409: is a flag and
                    410: .Ql status-style
                    411: and
                    412: .Ql bg=cyan
                    413: are arguments.
                    414: .Pp
                    415: .Nm
                    416: distinguishes between command parsing and execution.
                    417: In order to execute a command,
                    418: .Nm
                    419: needs it to be split up into its name and arguments.
                    420: This is command parsing.
                    421: If a command is run from the shell, the shell parses it; from inside
                    422: .Nm
                    423: or from a configuration file,
                    424: .Nm
                    425: does.
                    426: Examples of when
                    427: .Nm
                    428: parses commands are:
                    429: .Bl -dash -offset indent
                    430: .It
                    431: in a configuration file;
                    432: .It
                    433: typed at the command prompt (see
                    434: .Ic command-prompt ) ;
                    435: .It
                    436: given to
                    437: .Ic bind-key ;
                    438: .It
                    439: passed as arguments to
                    440: .Ic if-shell
                    441: or
                    442: .Ic confirm-before .
                    443: .El
                    444: .Pp
                    445: To execute commands, each client has a
                    446: .Ql command queue .
                    447: A global command queue not attached to any client is used on startup
                    448: for configuration files like
                    449: .Pa ~/.tmux.conf .
                    450: Parsed commands added to the queue are executed in order.
                    451: Some commands, like
                    452: .Ic if-shell
                    453: and
                    454: .Ic confirm-before ,
                    455: parse their argument to create a new command which is inserted immediately
                    456: after themselves.
                    457: This means that arguments can be parsed twice or more - once when the parent command (such as
                    458: .Ic if-shell )
                    459: is parsed and again when it parses and executes its command.
                    460: Commands like
                    461: .Ic if-shell ,
                    462: .Ic run-shell
                    463: and
                    464: .Ic display-panes
                    465: stop execution of subsequent commands on the queue until something happens -
                    466: .Ic if-shell
                    467: and
                    468: .Ic run-shell
                    469: until a shell command finishes and
                    470: .Ic display-panes
                    471: until a key is pressed.
                    472: For example, the following commands:
                    473: .Bd -literal -offset indent
                    474: new-session; new-window
                    475: if-shell "true" "split-window"
                    476: kill-session
                    477: .Ed
                    478: .Pp
                    479: Will execute
                    480: .Ic new-session ,
                    481: .Ic new-window ,
                    482: .Ic if-shell ,
                    483: the shell command
                    484: .Xr true 1 ,
1.671     nicm      485: .Ic split-window
1.651     nicm      486: and
                    487: .Ic kill-session
                    488: in that order.
                    489: .Pp
                    490: The
                    491: .Sx COMMANDS
                    492: section lists the
                    493: .Nm
                    494: commands and their arguments.
                    495: .Sh PARSING SYNTAX
                    496: This section describes the syntax of commands parsed by
                    497: .Nm ,
                    498: for example in a configuration file or at the command prompt.
1.671     nicm      499: Note that when commands are entered into the shell, they are parsed by the shell
1.651     nicm      500: - see for example
                    501: .Xr ksh 1
                    502: or
                    503: .Xr csh 1 .
                    504: .Pp
                    505: Each command is terminated by a newline or a semicolon (;).
                    506: Commands separated by semicolons together form a
                    507: .Ql command sequence
                    508: - if a command in the sequence encounters an error, no subsequent commands are
                    509: executed.
                    510: .Pp
                    511: Comments are marked by the unquoted # character - any remaining text after a
                    512: comment is ignored until the end of the line.
                    513: .Pp
                    514: If the last character of a line is \e, the line is joined with the following
                    515: line (the \e and the newline are completely removed).
                    516: This is called line continuation and applies both inside and outside quoted
1.656     nicm      517: strings and in comments, but not inside braces.
1.651     nicm      518: .Pp
1.655     nicm      519: Command arguments may be specified as strings surrounded by single (') quotes,
                    520: double quotes (") or braces ({}).
1.651     nicm      521: .\" "
                    522: This is required when the argument contains any special character.
1.655     nicm      523: Single and double quoted strings cannot span multiple lines except with line
                    524: continuation.
                    525: Braces can span multiple lines.
1.651     nicm      526: .Pp
                    527: Outside of quotes and inside double quotes, these replacements are performed:
                    528: .Bl -dash -offset indent
                    529: .It
                    530: Environment variables preceded by $ are replaced with their value from the
                    531: global environment (see the
                    532: .Sx GLOBAL AND SESSION ENVIRONMENT
                    533: section).
                    534: .It
                    535: A leading ~ or ~user is expanded to the home directory of the current or
                    536: specified user.
                    537: .It
                    538: \euXXXX or \euXXXXXXXX is replaced by the Unicode codepoint corresponding to
                    539: the given four or eight digit hexadecimal number.
                    540: .It
                    541: When preceded (escaped) by a \e, the following characters are replaced: \ee by
                    542: the escape character; \er by a carriage return; \en by a newline; and \et by a
                    543: tab.
1.660     nicm      544: .It
                    545: \eooo is replaced by a character of the octal value ooo.
                    546: Three octal digits are required, for example \e001.
                    547: The largest valid character is \e377.
                    548: .It
1.651     nicm      549: Any other characters preceded by \e are replaced by themselves (that is, the \e
                    550: is removed) and are not treated as having any special meaning - so for example
                    551: \e; will not mark a command sequence and \e$ will not expand an environment
                    552: variable.
                    553: .El
                    554: .Pp
1.655     nicm      555: Braces are similar to single quotes in that the text inside is taken literally
1.656     nicm      556: without any replacements but this also includes line continuation.
                    557: Braces can span multiple lines in which case a literal newline is included in the
                    558: string.
1.655     nicm      559: They are designed to avoid the need for additional escaping when passing a group
                    560: of
                    561: .Nm
                    562: or shell commands as an argument (for example to
                    563: .Ic if-shell
                    564: or
                    565: .Ic pipe-pane ) .
                    566: These two examples produce an identical command - note that no escaping is
                    567: needed when using {}:
                    568: .Bd -literal -offset indent
                    569: if-shell true {
                    570:     display -p 'brace-dollar-foo: }$foo'
                    571: }
                    572:
                    573: if-shell true "\en    display -p 'brace-dollar-foo: }\e$foo'\en"
                    574: .Ed
                    575: .Pp
                    576: Braces may be enclosed inside braces, for example:
                    577: .Bd -literal -offset indent
                    578: bind x if-shell "true" {
                    579:     if-shell "true" {
1.706     nicm      580:         display "true!"
1.655     nicm      581:     }
                    582: }
                    583: .Ed
                    584: .Pp
1.651     nicm      585: Environment variables may be set by using the syntax
                    586: .Ql name=value ,
                    587: for example
                    588: .Ql HOME=/home/user .
                    589: Variables set during parsing are added to the global environment.
1.728     nicm      590: A hidden variable may be set with
                    591: .Ql %hidden ,
                    592: for example:
                    593: .Bd -literal -offset indent
                    594: %hidden MYVAR=42
                    595: .Ed
                    596: .Pp
                    597: Hidden variables are not passed to the environment of processes created
                    598: by tmux.
                    599: See the
                    600: .Sx GLOBAL AND SESSION ENVIRONMENT
                    601: section.
1.651     nicm      602: .Pp
                    603: Commands may be parsed conditionally by surrounding them with
                    604: .Ql %if ,
                    605: .Ql %elif ,
                    606: .Ql %else
                    607: and
                    608: .Ql %endif .
                    609: The argument to
                    610: .Ql %if
                    611: and
                    612: .Ql %elif
                    613: is expanded as a format (see
                    614: .Sx FORMATS )
                    615: and if it evaluates to false (zero or empty), subsequent text is ignored until
                    616: the closing
                    617: .Ql %elif ,
                    618: .Ql %else
                    619: or
                    620: .Ql %endif .
                    621: For example:
                    622: .Bd -literal -offset indent
1.666     nicm      623: %if "#{==:#{host},myhost}"
1.651     nicm      624: set -g status-style bg=red
1.666     nicm      625: %elif "#{==:#{host},myotherhost}"
1.651     nicm      626: set -g status-style bg=green
                    627: %else
                    628: set -g status-style bg=blue
                    629: %endif
                    630: .Ed
                    631: .Pp
                    632: Will change the status line to red if running on
                    633: .Ql myhost ,
                    634: green if running on
                    635: .Ql myotherhost ,
                    636: or blue if running on another host.
                    637: Conditionals may be given on one line, for example:
                    638: .Bd -literal -offset indent
                    639: %if #{==:#{host},myhost} set -g status-style bg=red %endif
                    640: .Ed
1.57      jmc       641: .Sh COMMANDS
1.651     nicm      642: This section describes the commands supported by
1.57      jmc       643: .Nm .
                    644: Most commands accept the optional
                    645: .Fl t
1.432     nicm      646: (and sometimes
                    647: .Fl s )
1.57      jmc       648: argument with one of
                    649: .Ar target-client ,
1.678     nicm      650: .Ar target-session ,
1.57      jmc       651: .Ar target-window ,
                    652: or
                    653: .Ar target-pane .
                    654: These specify the client, session, window or pane which a command should affect.
1.423     nicm      655: .Pp
1.57      jmc       656: .Ar target-client
1.540     nicm      657: should be the name of the client,
                    658: typically the
1.57      jmc       659: .Xr pty 4
                    660: file to which the client is connected, for example either of
                    661: .Pa /dev/ttyp1
                    662: or
                    663: .Pa ttyp1
                    664: for the client attached to
                    665: .Pa /dev/ttyp1 .
1.423     nicm      666: If no client is specified,
                    667: .Nm
                    668: attempts to work out the client currently in use; if that fails, an error is
                    669: reported.
1.57      jmc       670: Clients may be listed with the
                    671: .Ic list-clients
                    672: command.
1.1       nicm      673: .Pp
1.57      jmc       674: .Ar target-session
1.423     nicm      675: is tried as, in order:
                    676: .Bl -enum -offset Ds
                    677: .It
                    678: A session ID prefixed with a $.
                    679: .It
                    680: An exact name of a session (as listed by the
1.57      jmc       681: .Ic list-sessions
1.423     nicm      682: command).
                    683: .It
                    684: The start of a session name, for example
                    685: .Ql mysess
                    686: would match a session named
                    687: .Ql mysession .
                    688: .It
                    689: An
1.57      jmc       690: .Xr fnmatch 3
1.423     nicm      691: pattern which is matched against the session name.
                    692: .El
                    693: .Pp
1.441     nicm      694: If the session name is prefixed with an
                    695: .Ql = ,
1.435     nicm      696: only an exact match is accepted (so
                    697: .Ql =mysess
                    698: will only match exactly
                    699: .Ql mysess ,
                    700: not
                    701: .Ql mysession ) .
1.441     nicm      702: .Pp
1.423     nicm      703: If a single session is found, it is used as the target session; multiple matches
1.57      jmc       704: produce an error.
                    705: If a session is omitted, the current session is used if available; if no
1.117     nicm      706: current session is available, the most recently used is chosen.
1.1       nicm      707: .Pp
1.57      jmc       708: .Ar target-window
1.472     nicm      709: (or
                    710: .Ar src-window
                    711: or
                    712: .Ar dst-window )
1.57      jmc       713: specifies a window in the form
                    714: .Em session Ns \&: Ns Em window .
                    715: .Em session
                    716: follows the same rules as for
                    717: .Ar target-session ,
                    718: and
                    719: .Em window
1.423     nicm      720: is looked for in order as:
                    721: .Bl -enum -offset Ds
                    722: .It
                    723: A special token, listed below.
                    724: .It
                    725: A window index, for example
                    726: .Ql mysession:1
                    727: is window 1 in session
                    728: .Ql mysession .
                    729: .It
                    730: A window ID, such as @1.
                    731: .It
                    732: An exact window name, such as
                    733: .Ql mysession:mywindow .
                    734: .It
                    735: The start of a window name, such as
                    736: .Ql mysession:mywin .
                    737: .It
                    738: As an
1.57      jmc       739: .Xr fnmatch 3
1.423     nicm      740: pattern matched against the window name.
                    741: .El
                    742: .Pp
1.435     nicm      743: Like sessions, a
                    744: .Ql =
                    745: prefix will do an exact match only.
1.57      jmc       746: An empty window name specifies the next unused index if appropriate (for
                    747: example the
                    748: .Ic new-window
                    749: and
                    750: .Ic link-window
                    751: commands)
                    752: otherwise the current window in
                    753: .Em session
                    754: is chosen.
1.423     nicm      755: .Pp
1.424     nicm      756: The following special tokens are available to indicate particular windows.
                    757: Each has a single-character alternative form.
1.423     nicm      758: .Bl -column "XXXXXXXXXX" "X"
                    759: .It Sy "Token" Ta Sy "" Ta Sy "Meaning"
                    760: .It Li "{start}" Ta "^" Ta "The lowest-numbered window"
                    761: .It Li "{end}" Ta "$" Ta "The highest-numbered window"
                    762: .It Li "{last}" Ta "!" Ta "The last (previously current) window"
                    763: .It Li "{next}" Ta "+" Ta "The next window by number"
                    764: .It Li "{previous}" Ta "-" Ta "The previous window by number"
                    765: .El
1.1       nicm      766: .Pp
1.57      jmc       767: .Ar target-pane
1.472     nicm      768: (or
                    769: .Ar src-pane
                    770: or
                    771: .Ar dst-pane )
                    772: may be a pane ID or takes a similar form to
1.57      jmc       773: .Ar target-window
1.423     nicm      774: but with the optional addition of a period followed by a pane index or pane ID,
                    775: for example:
                    776: .Ql mysession:mywindow.1 .
1.57      jmc       777: If the pane index is omitted, the currently active pane in the specified
                    778: window is used.
1.423     nicm      779: The following special tokens are available for the pane index:
                    780: .Bl -column "XXXXXXXXXXXXXX" "X"
                    781: .It Sy "Token" Ta Sy "" Ta Sy "Meaning"
                    782: .It Li "{last}" Ta "!" Ta "The last (previously active) pane"
                    783: .It Li "{next}" Ta "+" Ta "The next pane by number"
                    784: .It Li "{previous}" Ta "-" Ta "The previous pane by number"
                    785: .It Li "{top}" Ta "" Ta "The top pane"
                    786: .It Li "{bottom}" Ta "" Ta "The bottom pane"
                    787: .It Li "{left}" Ta "" Ta "The leftmost pane"
                    788: .It Li "{right}" Ta "" Ta "The rightmost pane"
                    789: .It Li "{top-left}" Ta "" Ta "The top-left pane"
                    790: .It Li "{top-right}" Ta "" Ta "The top-right pane"
                    791: .It Li "{bottom-left}" Ta "" Ta "The bottom-left pane"
                    792: .It Li "{bottom-right}" Ta "" Ta "The bottom-right pane"
1.447     nicm      793: .It Li "{up-of}" Ta "" Ta "The pane above the active pane"
                    794: .It Li "{down-of}" Ta "" Ta "The pane below the active pane"
                    795: .It Li "{left-of}" Ta "" Ta "The pane to the left of the active pane"
                    796: .It Li "{right-of}" Ta "" Ta "The pane to the right of the active pane"
1.423     nicm      797: .El
1.177     nicm      798: .Pp
1.423     nicm      799: The tokens
1.177     nicm      800: .Ql +
                    801: and
                    802: .Ql -
                    803: may be followed by an offset, for example:
                    804: .Bd -literal -offset indent
                    805: select-window -t:+2
                    806: .Ed
                    807: .Pp
1.432     nicm      808: In addition,
                    809: .Em target-session ,
                    810: .Em target-window
                    811: or
                    812: .Em target-pane
                    813: may consist entirely of the token
                    814: .Ql {mouse}
                    815: (alternative form
                    816: .Ql = )
1.678     nicm      817: to specify the session, window or pane where the most recent mouse event occurred
1.432     nicm      818: (see the
                    819: .Sx MOUSE SUPPORT
                    820: section)
                    821: or
                    822: .Ql {marked}
                    823: (alternative form
                    824: .Ql ~ )
                    825: to specify the marked pane (see
                    826: .Ic select-pane
                    827: .Fl m ) .
                    828: .Pp
1.423     nicm      829: Sessions, window and panes are each numbered with a unique ID; session IDs are
                    830: prefixed with a
                    831: .Ql $ ,
                    832: windows with a
                    833: .Ql @ ,
                    834: and panes with a
                    835: .Ql % .
                    836: These are unique and are unchanged for the life of the session, window or pane
                    837: in the
1.212     nicm      838: .Nm
1.423     nicm      839: server.
                    840: The pane ID is passed to the child process of the pane in the
1.212     nicm      841: .Ev TMUX_PANE
                    842: environment variable.
1.423     nicm      843: IDs may be displayed using the
                    844: .Ql session_id ,
                    845: .Ql window_id ,
                    846: or
                    847: .Ql pane_id
                    848: formats (see the
                    849: .Sx FORMATS
                    850: section) and the
                    851: .Ic display-message ,
                    852: .Ic list-sessions ,
                    853: .Ic list-windows
                    854: or
                    855: .Ic list-panes
                    856: commands.
1.15      jmc       857: .Pp
1.153     nicm      858: .Ar shell-command
                    859: arguments are
                    860: .Xr sh 1
                    861: commands.
1.394     nicm      862: This may be a single argument passed to the shell, for example:
1.153     nicm      863: .Bd -literal -offset indent
                    864: new-window 'vi /etc/passwd'
                    865: .Ed
1.394     nicm      866: .Pp
                    867: Will run:
                    868: .Bd -literal -offset indent
                    869: /bin/sh -c 'vi /etc/passwd'
                    870: .Ed
                    871: .Pp
                    872: Additionally, the
                    873: .Ic new-window ,
                    874: .Ic new-session ,
                    875: .Ic split-window ,
                    876: .Ic respawn-window
                    877: and
                    878: .Ic respawn-pane
                    879: commands allow
                    880: .Ar shell-command
                    881: to be given as multiple arguments and executed directly (without
                    882: .Ql sh -c ) .
                    883: This can avoid issues with shell quoting.
                    884: For example:
                    885: .Bd -literal -offset indent
                    886: $ tmux new-window vi /etc/passwd
                    887: .Ed
                    888: .Pp
                    889: Will run
                    890: .Xr vi 1
                    891: directly without invoking the shell.
1.153     nicm      892: .Pp
                    893: .Ar command
                    894: .Op Ar arguments
                    895: refers to a
                    896: .Nm
1.655     nicm      897: command, either passed with the command and arguments separately, for example:
1.153     nicm      898: .Bd -literal -offset indent
1.629     nicm      899: bind-key F1 set-option status off
1.153     nicm      900: .Ed
                    901: .Pp
1.655     nicm      902: Or passed as a single string argument in
                    903: .Pa .tmux.conf ,
                    904: for example:
1.153     nicm      905: .Bd -literal -offset indent
1.655     nicm      906: bind-key F1 { set-option status off }
1.153     nicm      907: .Ed
                    908: .Pp
                    909: Example
                    910: .Nm
                    911: commands include:
1.13      nicm      912: .Bd -literal -offset indent
1.57      jmc       913: refresh-client -t/dev/ttyp2
                    914:
                    915: rename-session -tfirst newname
                    916:
1.668     nicm      917: set-option -wt:0 monitor-activity on
1.57      jmc       918:
                    919: new-window ; split-window -d
1.244     nicm      920:
                    921: bind-key R source-file ~/.tmux.conf \e; \e
                    922:        display-message "source-file done"
1.13      nicm      923: .Ed
1.153     nicm      924: .Pp
                    925: Or from
                    926: .Xr sh 1 :
                    927: .Bd -literal -offset indent
                    928: $ tmux kill-window -t :1
                    929:
1.159     jmc       930: $ tmux new-window \e; split-window -d
1.153     nicm      931:
1.159     jmc       932: $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
1.153     nicm      933: .Ed
1.57      jmc       934: .Sh CLIENTS AND SESSIONS
1.153     nicm      935: The
                    936: .Nm
                    937: server manages clients, sessions, windows and panes.
                    938: Clients are attached to sessions to interact with them, either
                    939: when they are created with the
                    940: .Ic new-session
                    941: command, or later with the
                    942: .Ic attach-session
                    943: command.
1.188     nicm      944: Each session has one or more windows
1.153     nicm      945: .Em linked
                    946: into it.
                    947: Windows may be linked to multiple sessions and are made up of one or
                    948: more panes,
                    949: each of which contains a pseudo terminal.
                    950: Commands for creating, linking and otherwise manipulating windows
                    951: are covered
                    952: in the
                    953: .Sx WINDOWS AND PANES
                    954: section.
                    955: .Pp
                    956: The following commands are available to manage clients and sessions:
1.57      jmc       957: .Bl -tag -width Ds
                    958: .It Xo Ic attach-session
1.662     nicm      959: .Op Fl dErx
1.372     nicm      960: .Op Fl c Ar working-directory
1.762     nicm      961: .Op Fl f Ar flags
1.57      jmc       962: .Op Fl t Ar target-session
                    963: .Xc
                    964: .D1 (alias: Ic attach )
                    965: If run from outside
                    966: .Nm ,
                    967: create a new client in the current terminal and attach it to
                    968: .Ar target-session .
                    969: If used from inside, switch the current client.
                    970: If
                    971: .Fl d
                    972: is specified, any other clients attached to the session are detached.
1.662     nicm      973: If
                    974: .Fl x
1.703     nicm      975: is given, send
                    976: .Dv SIGHUP
                    977: to the parent process of the client as well as
1.662     nicm      978: detaching the client, typically causing it to exit.
1.762     nicm      979: .Fl f
                    980: sets a comma-separated list of client flags.
                    981: The flags are:
                    982: .Bl -tag -width Ds
                    983: .It read-only
                    984: the client is read-only
                    985: .It ignore-size
                    986: the client does not affect the size of other clients
                    987: .It no-output
                    988: the client does not receive pane output in control mode
1.769     nicm      989: .It active-pane
                    990: the client has an independent active pane
1.762     nicm      991: .El
                    992: .Pp
                    993: A leading
                    994: .Ql !
                    995: turns a flag off if the client is already attached.
1.148     nicm      996: .Fl r
1.762     nicm      997: is an alias for
                    998: .Fl f
                    999: .Ar read-only,ignore-size .
                   1000: When a client is read-only, only keys bound to the
1.148     nicm     1001: .Ic detach-client
1.242     nicm     1002: or
                   1003: .Ic switch-client
1.762     nicm     1004: commands have any effect.
1.769     nicm     1005: A client with the
                   1006: .Ar active-pane
                   1007: flag allows the active pane to be selected independently of the window's active
                   1008: pane used by clients without the flag.
                   1009: This only affects the cursor position and commands issued from the client;
                   1010: other features such as hooks and styles continue to use the window's active
                   1011: pane.
1.13      nicm     1012: .Pp
1.57      jmc      1013: If no server is started,
                   1014: .Ic attach-session
                   1015: will attempt to start it; this will fail unless sessions are created in the
                   1016: configuration file.
1.217     nicm     1017: .Pp
                   1018: The
                   1019: .Ar target-session
                   1020: rules for
                   1021: .Ic attach-session
                   1022: are slightly adjusted: if
                   1023: .Nm
                   1024: needs to select the most recently used session, it will prefer the most
                   1025: recently used
                   1026: .Em unattached
                   1027: session.
1.372     nicm     1028: .Pp
                   1029: .Fl c
                   1030: will set the session working directory (used for new windows) to
                   1031: .Ar working-directory .
1.436     nicm     1032: .Pp
                   1033: If
                   1034: .Fl E
1.480     nicm     1035: is used, the
1.436     nicm     1036: .Ic update-environment
                   1037: option will not be applied.
1.211     nicm     1038: .It Xo Ic detach-client
1.463     nicm     1039: .Op Fl aP
1.525     nicm     1040: .Op Fl E Ar shell-command
1.219     nicm     1041: .Op Fl s Ar target-session
1.211     nicm     1042: .Op Fl t Ar target-client
                   1043: .Xc
1.57      jmc      1044: .D1 (alias: Ic detach )
1.218     nicm     1045: Detach the current client if bound to a key, the client specified with
                   1046: .Fl t ,
1.258     jmc      1047: or all clients currently attached to the session specified by
1.218     nicm     1048: .Fl s .
1.296     nicm     1049: The
                   1050: .Fl a
                   1051: option kills all but the client given with
                   1052: .Fl t .
1.211     nicm     1053: If
                   1054: .Fl P
1.703     nicm     1055: is given, send
                   1056: .Dv SIGHUP
                   1057: to the parent process of the client, typically causing it
1.211     nicm     1058: to exit.
1.525     nicm     1059: With
                   1060: .Fl E ,
                   1061: run
                   1062: .Ar shell-command
                   1063: to replace the client.
1.57      jmc      1064: .It Ic has-session Op Fl t Ar target-session
                   1065: .D1 (alias: Ic has )
                   1066: Report an error and exit with 1 if the specified session does not exist.
                   1067: If it does exist, exit with 0.
                   1068: .It Ic kill-server
                   1069: Kill the
1.1       nicm     1070: .Nm
1.57      jmc      1071: server and clients and destroy all sessions.
1.369     nicm     1072: .It Xo Ic kill-session
1.464     nicm     1073: .Op Fl aC
1.297     nicm     1074: .Op Fl t Ar target-session
1.369     nicm     1075: .Xc
1.57      jmc      1076: Destroy the given session, closing any windows linked to it and no other
                   1077: sessions, and detaching all clients attached to it.
1.297     nicm     1078: If
                   1079: .Fl a
                   1080: is given, all sessions but the specified one is killed.
1.464     nicm     1081: The
                   1082: .Fl C
1.467     nicm     1083: flag clears alerts (bell, activity, or silence) in all windows linked to the
1.464     nicm     1084: session.
1.250     nicm     1085: .It Xo Ic list-clients
                   1086: .Op Fl F Ar format
                   1087: .Op Fl t Ar target-session
                   1088: .Xc
1.57      jmc      1089: .D1 (alias: Ic lsc )
1.221     jmc      1090: List all clients attached to the server.
1.250     nicm     1091: For the meaning of the
                   1092: .Fl F
                   1093: flag, see the
1.252     jmc      1094: .Sx FORMATS
                   1095: section.
1.221     jmc      1096: If
1.220     nicm     1097: .Ar target-session
                   1098: is specified, list only clients connected to that session.
1.489     nicm     1099: .It Xo Ic list-commands
                   1100: .Op Fl F Ar format
1.731     nicm     1101: .Op Ar command
1.489     nicm     1102: .Xc
1.57      jmc      1103: .D1 (alias: Ic lscm )
1.731     nicm     1104: List the syntax of
                   1105: .Ar command
                   1106: or - if omitted - of all commands supported by
1.57      jmc      1107: .Nm .
1.738     nicm     1108: .It Xo Ic list-sessions
                   1109: .Op Fl F Ar format
                   1110: .Op Fl f Ar filter
                   1111: .Xc
1.57      jmc      1112: .D1 (alias: Ic ls )
                   1113: List all sessions managed by the server.
1.247     nicm     1114: .Fl F
1.738     nicm     1115: specifies the format of each line and
                   1116: .Fl f
                   1117: a filter.
                   1118: Only sessions for which the filter is true are shown.
                   1119: See the
1.247     nicm     1120: .Sx FORMATS
                   1121: section.
1.175     nicm     1122: .It Ic lock-client Op Fl t Ar target-client
                   1123: .D1 (alias: Ic lockc )
1.92      nicm     1124: Lock
                   1125: .Ar target-client ,
                   1126: see the
                   1127: .Ic lock-server
                   1128: command.
1.175     nicm     1129: .It Ic lock-session Op Fl t Ar target-session
                   1130: .D1 (alias: Ic locks )
1.92      nicm     1131: Lock all clients attached to
                   1132: .Ar target-session .
1.57      jmc      1133: .It Xo Ic new-session
1.662     nicm     1134: .Op Fl AdDEPX
1.371     nicm     1135: .Op Fl c Ar start-directory
1.760     nicm     1136: .Op Fl e Ar environment
1.762     nicm     1137: .Op Fl f Ar flags
1.351     nicm     1138: .Op Fl F Ar format
1.57      jmc      1139: .Op Fl n Ar window-name
                   1140: .Op Fl s Ar session-name
1.536     nicm     1141: .Op Fl t Ar group-name
1.210     nicm     1142: .Op Fl x Ar width
                   1143: .Op Fl y Ar height
1.153     nicm     1144: .Op Ar shell-command
1.57      jmc      1145: .Xc
                   1146: .D1 (alias: Ic new )
                   1147: Create a new session with name
                   1148: .Ar session-name .
1.153     nicm     1149: .Pp
1.57      jmc      1150: The new session is attached to the current terminal unless
                   1151: .Fl d
                   1152: is given.
                   1153: .Ar window-name
1.1       nicm     1154: and
1.153     nicm     1155: .Ar shell-command
                   1156: are the name of and shell command to execute in the initial window.
1.552     nicm     1157: With
                   1158: .Fl d ,
1.642     nicm     1159: the initial size comes from the global
                   1160: .Ic default-size
                   1161: option;
1.210     nicm     1162: .Fl x
                   1163: and
                   1164: .Fl y
1.602     nicm     1165: can be used to specify a different size.
                   1166: .Ql -
                   1167: uses the size of the current client if any.
1.642     nicm     1168: If
                   1169: .Fl x
                   1170: or
                   1171: .Fl y
                   1172: is given, the
                   1173: .Ic default-size
                   1174: option is set for the session.
1.762     nicm     1175: .Fl f
                   1176: sets a comma-separated list of client flags (see
                   1177: .Ic attach-session ) .
1.68      nicm     1178: .Pp
                   1179: If run from a terminal, any
                   1180: .Xr termios 4
                   1181: special characters are saved and used for new windows in the new session.
1.338     nicm     1182: .Pp
                   1183: The
                   1184: .Fl A
                   1185: flag makes
                   1186: .Ic new-session
                   1187: behave like
                   1188: .Ic attach-session
                   1189: if
                   1190: .Ar session-name
1.416     nicm     1191: already exists; in this case,
1.338     nicm     1192: .Fl D
                   1193: behaves like
                   1194: .Fl d
1.662     nicm     1195: to
                   1196: .Ic attach-session ,
                   1197: and
                   1198: .Fl X
                   1199: behaves like
                   1200: .Fl x
1.338     nicm     1201: to
                   1202: .Ic attach-session .
1.101     nicm     1203: .Pp
                   1204: If
                   1205: .Fl t
1.536     nicm     1206: is given, it specifies a
                   1207: .Ic session group .
                   1208: Sessions in the same group share the same set of windows - new windows are
1.537     nicm     1209: linked to all sessions in the group and any windows closed removed from all
1.536     nicm     1210: sessions.
1.101     nicm     1211: The current and previous window and any session options remain independent and
1.536     nicm     1212: any session in a group may be killed without affecting the others.
                   1213: The
                   1214: .Ar group-name
                   1215: argument may be:
                   1216: .Bl -enum -width Ds
                   1217: .It
                   1218: the name of an existing group, in which case the new session is added to that
                   1219: group;
                   1220: .It
                   1221: the name of an existing session - the new session is added to the same group
                   1222: as that session, creating a new group if necessary;
                   1223: .It
                   1224: the name for a new group containing only the new session.
                   1225: .El
                   1226: .Pp
1.101     nicm     1227: .Fl n
1.480     nicm     1228: and
1.153     nicm     1229: .Ar shell-command
1.101     nicm     1230: are invalid if
                   1231: .Fl t
                   1232: is used.
1.351     nicm     1233: .Pp
                   1234: The
                   1235: .Fl P
                   1236: option prints information about the new session after it has been created.
                   1237: By default, it uses the format
1.683     nicm     1238: .Ql #{session_name}:\&
1.351     nicm     1239: but a different format may be specified with
                   1240: .Fl F .
1.436     nicm     1241: .Pp
                   1242: If
                   1243: .Fl E
1.480     nicm     1244: is used, the
1.436     nicm     1245: .Ic update-environment
                   1246: option will not be applied.
1.760     nicm     1247: .Fl e
                   1248: takes the form
                   1249: .Ql VARIABLE=value
                   1250: and sets an environment variable for the newly created session; it may be
                   1251: specified multiple times.
1.248     nicm     1252: .It Xo Ic refresh-client
1.613     nicm     1253: .Op Fl cDlLRSU
1.773     nicm     1254: .Op Fl A Ar pane:state
1.677     nicm     1255: .Op Fl C Ar XxY
1.762     nicm     1256: .Op Fl f Ar flags
1.248     nicm     1257: .Op Fl t Ar target-client
1.613     nicm     1258: .Op Ar adjustment
1.248     nicm     1259: .Xc
1.57      jmc      1260: .D1 (alias: Ic refresh )
                   1261: Refresh the current client if bound to a key, or a single client if one is given
                   1262: with
                   1263: .Fl t .
1.248     nicm     1264: If
                   1265: .Fl S
1.538     nicm     1266: is specified, only update the client's status line.
1.535     nicm     1267: .Pp
1.642     nicm     1268: The
                   1269: .Fl U ,
                   1270: .Fl D ,
                   1271: .Fl L
                   1272: .Fl R ,
                   1273: and
                   1274: .Fl c
                   1275: flags allow the visible portion of a window which is larger than the client
                   1276: to be changed.
                   1277: .Fl U
                   1278: moves the visible part up by
                   1279: .Ar adjustment
                   1280: rows and
                   1281: .Fl D
                   1282: down,
                   1283: .Fl L
                   1284: left by
                   1285: .Ar adjustment
                   1286: columns and
                   1287: .Fl R
                   1288: right.
                   1289: .Fl c
                   1290: returns to tracking the cursor automatically.
                   1291: If
                   1292: .Ar adjustment
                   1293: is omitted, 1 is used.
                   1294: Note that the visible position is a property of the client not of the
                   1295: window, changing the current window in the attached session will reset
                   1296: it.
                   1297: .Pp
1.535     nicm     1298: .Fl C
1.773     nicm     1299: sets the width and height of a control mode client.
                   1300: .Fl A
                   1301: informs
                   1302: .Nm
                   1303: of a control mode client's interest in a pane.
                   1304: The argument is a pane ID (with leading
                   1305: .Ql % ) ,
                   1306: a colon, then one of
                   1307: .Ql on
                   1308: or
                   1309: .Ql off .
                   1310: If
                   1311: .Ql off ,
                   1312: .Nm
                   1313: will not send output from the pane to the client and if all clients have turned
                   1314: the pane off, will stop reading from the pane.
                   1315: .Fl A
                   1316: may be given multiple times.
                   1317: .Pp
1.762     nicm     1318: .Fl f
                   1319: sets a comma-separated list of client flags, see
                   1320: .Ic attach-session .
1.677     nicm     1321: .Pp
1.612     nicm     1322: .Fl l
                   1323: requests the clipboard from the client using the
                   1324: .Xr xterm 1
                   1325: escape sequence and stores it in a new paste buffer.
1.613     nicm     1326: .Pp
                   1327: .Fl L ,
                   1328: .Fl R ,
                   1329: .Fl U
                   1330: and
                   1331: .Fl D
                   1332: move the visible portion of the window left, right, up or down
                   1333: by
                   1334: .Ar adjustment ,
                   1335: if the window is larger than the client.
                   1336: .Fl c
                   1337: resets so that the position follows the cursor.
                   1338: See the
                   1339: .Ic window-size
                   1340: option.
1.57      jmc      1341: .It Xo Ic rename-session
                   1342: .Op Fl t Ar target-session
                   1343: .Ar new-name
                   1344: .Xc
                   1345: .D1 (alias: Ic rename )
                   1346: Rename the session to
                   1347: .Ar new-name .
1.121     nicm     1348: .It Xo Ic show-messages
1.465     nicm     1349: .Op Fl JT
1.120     nicm     1350: .Op Fl t Ar target-client
                   1351: .Xc
                   1352: .D1 (alias: Ic showmsgs )
1.764     nicm     1353: Show server messages or information.
                   1354: Messages are stored, up to a maximum of the limit set by the
1.120     nicm     1355: .Ar message-limit
1.384     nicm     1356: server option.
1.377     nicm     1357: .Fl J
                   1358: and
                   1359: .Fl T
1.465     nicm     1360: show debugging information about jobs and terminals.
1.488     tim      1361: .It Xo Ic source-file
1.663     nicm     1362: .Op Fl nqv
1.488     tim      1363: .Ar path
1.659     nicm     1364: .Ar ...
1.488     tim      1365: .Xc
1.57      jmc      1366: .D1 (alias: Ic source )
1.659     nicm     1367: Execute commands from one or more files specified by
1.519     nicm     1368: .Ar path
1.659     nicm     1369: (which may be
1.607     kn       1370: .Xr glob 7
1.659     nicm     1371: patterns).
1.488     tim      1372: If
                   1373: .Fl q
                   1374: is given, no error will be returned if
                   1375: .Ar path
                   1376: does not exist.
1.651     nicm     1377: With
                   1378: .Fl n ,
                   1379: the file is parsed but no commands are executed.
1.663     nicm     1380: .Fl v
                   1381: shows the parsed commands and line numbers if possible.
1.57      jmc      1382: .It Ic start-server
                   1383: .D1 (alias: Ic start )
                   1384: Start the
1.1       nicm     1385: .Nm
1.57      jmc      1386: server, if not already running, without creating any sessions.
1.707     nicm     1387: .Pp
                   1388: Note that as by default the
                   1389: .Nm
                   1390: server will exit with no sessions, this is only useful if a session is created in
                   1391: .Pa ~/.tmux.conf ,
                   1392: .Ic exit-empty
                   1393: is turned off, or another command is run as part of the same command sequence.
                   1394: For example:
                   1395: .Bd -literal -offset indent
                   1396: $ tmux start \\; show -g
                   1397: .Ed
1.57      jmc      1398: .It Xo Ic suspend-client
1.202     nicm     1399: .Op Fl t Ar target-client
1.57      jmc      1400: .Xc
                   1401: .D1 (alias: Ic suspendc )
                   1402: Suspend a client by sending
                   1403: .Dv SIGTSTP
                   1404: (tty stop).
                   1405: .It Xo Ic switch-client
1.681     nicm     1406: .Op Fl ElnprZ
1.57      jmc      1407: .Op Fl c Ar target-client
                   1408: .Op Fl t Ar target-session
1.421     nicm     1409: .Op Fl T Ar key-table
1.57      jmc      1410: .Xc
                   1411: .D1 (alias: Ic switchc )
                   1412: Switch the current session for client
                   1413: .Ar target-client
                   1414: to
                   1415: .Ar target-session .
1.635     nicm     1416: As a special case,
                   1417: .Fl t
                   1418: may refer to a pane (a target that contains
1.636     jmc      1419: .Ql \&: ,
                   1420: .Ql \&.
1.635     nicm     1421: or
1.636     jmc      1422: .Ql % ) ,
1.681     nicm     1423: to change session, window and pane.
                   1424: In that case,
                   1425: .Fl Z
                   1426: keeps the window zoomed if it was zoomed.
1.183     nicm     1427: If
1.197     jmc      1428: .Fl l ,
1.183     nicm     1429: .Fl n
                   1430: or
                   1431: .Fl p
1.194     nicm     1432: is used, the client is moved to the last, next or previous session
                   1433: respectively.
1.242     nicm     1434: .Fl r
1.762     nicm     1435: toggles the client
                   1436: .Ic read-only
                   1437: and
                   1438: .Ic ignore-size
                   1439: flags (see the
1.242     nicm     1440: .Ic attach-session
                   1441: command).
1.436     nicm     1442: .Pp
                   1443: If
                   1444: .Fl E
                   1445: is used,
                   1446: .Ic update-environment
                   1447: option will not be applied.
1.421     nicm     1448: .Pp
                   1449: .Fl T
1.706     nicm     1450: sets the client's key table; the next key from the client will be interpreted
                   1451: from
1.421     nicm     1452: .Ar key-table .
                   1453: This may be used to configure multiple prefix keys, or to bind commands to
                   1454: sequences of keys.
                   1455: For example, to make typing
                   1456: .Ql abc
                   1457: run the
                   1458: .Ic list-keys
                   1459: command:
                   1460: .Bd -literal -offset indent
                   1461: bind-key -Ttable2 c list-keys
                   1462: bind-key -Ttable1 b switch-client -Ttable2
                   1463: bind-key -Troot   a switch-client -Ttable1
                   1464: .Ed
1.57      jmc      1465: .El
                   1466: .Sh WINDOWS AND PANES
1.679     nicm     1467: Each window displayed by
                   1468: .Nm
                   1469: may be split into one or more
                   1470: .Em panes ;
                   1471: each pane takes up a certain area of the display and is a separate terminal.
                   1472: A window may be split into panes using the
                   1473: .Ic split-window
                   1474: command.
                   1475: Windows may be split horizontally (with the
                   1476: .Fl h
                   1477: flag) or vertically.
                   1478: Panes may be resized with the
                   1479: .Ic resize-pane
                   1480: command (bound to
                   1481: .Ql C-Up ,
                   1482: .Ql C-Down
                   1483: .Ql C-Left
                   1484: and
                   1485: .Ql C-Right
                   1486: by default), the current pane may be changed with the
                   1487: .Ic select-pane
                   1488: command and the
                   1489: .Ic rotate-window
                   1490: and
                   1491: .Ic swap-pane
                   1492: commands may be used to swap panes without changing their position.
                   1493: Panes are numbered beginning from zero in the order they are created.
                   1494: .Pp
                   1495: By default, a
1.1       nicm     1496: .Nm
1.679     nicm     1497: pane permits direct access to the terminal contained in the pane.
                   1498: A pane may also be put into one of several modes:
                   1499: .Bl -dash -offset indent
                   1500: .It
                   1501: Copy mode, which permits a section of a window or its
1.164     nicm     1502: history to be copied to a
1.1       nicm     1503: .Em paste buffer
                   1504: for later insertion into another window.
                   1505: This mode is entered with the
                   1506: .Ic copy-mode
                   1507: command, bound to
1.113     nicm     1508: .Ql \&[
1.1       nicm     1509: by default.
1.734     nicm     1510: Copied text can be pasted with the
                   1511: .Ic paste-buffer
                   1512: command, bound to
                   1513: .Ql \&] .
1.679     nicm     1514: .It
                   1515: View mode, which is like copy mode but is entered when a command that produces
                   1516: output, such as
1.164     nicm     1517: .Ic list-keys ,
                   1518: is executed from a key binding.
1.679     nicm     1519: .It
                   1520: Choose mode, which allows an item to be chosen from a list.
                   1521: This may be a client, a session or window or pane, or a buffer.
                   1522: This mode is entered with the
                   1523: .Ic choose-buffer ,
                   1524: .Ic choose-client
                   1525: and
                   1526: .Ic choose-tree
                   1527: commands.
                   1528: .El
1.1       nicm     1529: .Pp
1.678     nicm     1530: In copy mode an indicator is displayed in the top-right corner of the pane with
                   1531: the current position and the number of lines in the history.
                   1532: .Pp
1.497     nicm     1533: Commands are sent to copy mode using the
                   1534: .Fl X
                   1535: flag to the
                   1536: .Ic send-keys
                   1537: command.
                   1538: When a key is pressed, copy mode automatically uses one of two key tables,
                   1539: depending on the
1.1       nicm     1540: .Ic mode-keys
1.497     nicm     1541: option:
                   1542: .Ic copy-mode
                   1543: for emacs, or
                   1544: .Ic copy-mode-vi
                   1545: for vi.
                   1546: Key tables may be viewed with the
                   1547: .Ic list-keys
                   1548: command.
                   1549: .Pp
                   1550: The following commands are supported in copy mode:
1.648     nicm     1551: .Bl -column "CommandXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
1.497     nicm     1552: .It Sy "Command" Ta Sy "vi" Ta Sy "emacs"
                   1553: .It Li "append-selection" Ta "" Ta ""
                   1554: .It Li "append-selection-and-cancel" Ta "A" Ta ""
                   1555: .It Li "back-to-indentation" Ta "^" Ta "M-m"
                   1556: .It Li "begin-selection" Ta "Space" Ta "C-Space"
                   1557: .It Li "bottom-line" Ta "L" Ta ""
                   1558: .It Li "cancel" Ta "q" Ta "Escape"
                   1559: .It Li "clear-selection" Ta "Escape" Ta "C-g"
1.633     nicm     1560: .It Li "copy-end-of-line [<prefix>]" Ta "D" Ta "C-k"
                   1561: .It Li "copy-line [<prefix>]" Ta "" Ta ""
1.742     nicm     1562: .It Li "copy-pipe [<command>] [<prefix>]" Ta "" Ta ""
                   1563: .It Li "copy-pipe-no-clear [<command>] [<prefix>]" Ta "" Ta ""
                   1564: .It Li "copy-pipe-and-cancel [<command>] [<prefix>]" Ta "" Ta ""
1.633     nicm     1565: .It Li "copy-selection [<prefix>]" Ta "" Ta ""
1.638     nicm     1566: .It Li "copy-selection-no-clear [<prefix>]" Ta "" Ta ""
1.633     nicm     1567: .It Li "copy-selection-and-cancel [<prefix>]" Ta "Enter" Ta "M-w"
1.497     nicm     1568: .It Li "cursor-down" Ta "j" Ta "Down"
1.685     nicm     1569: .It Li "cursor-down-and-cancel" Ta "" Ta ""
1.497     nicm     1570: .It Li "cursor-left" Ta "h" Ta "Left"
                   1571: .It Li "cursor-right" Ta "l" Ta "Right"
                   1572: .It Li "cursor-up" Ta "k" Ta "Up"
                   1573: .It Li "end-of-line" Ta "$" Ta "C-e"
                   1574: .It Li "goto-line <line>" Ta ":" Ta "g"
                   1575: .It Li "halfpage-down" Ta "C-d" Ta "M-Down"
1.589     nicm     1576: .It Li "halfpage-down-and-cancel" Ta "" Ta ""
1.497     nicm     1577: .It Li "halfpage-up" Ta "C-u" Ta "M-Up"
1.589     nicm     1578: .It Li "history-bottom" Ta "G" Ta "M->"
                   1579: .It Li "history-top" Ta "g" Ta "M-<"
1.497     nicm     1580: .It Li "jump-again" Ta ";" Ta ";"
                   1581: .It Li "jump-backward <to>" Ta "F" Ta "F"
                   1582: .It Li "jump-forward <to>" Ta "f" Ta "f"
                   1583: .It Li "jump-reverse" Ta "," Ta ","
                   1584: .It Li "jump-to-backward <to>" Ta "T" Ta ""
                   1585: .It Li "jump-to-forward <to>" Ta "t" Ta ""
1.768     nicm     1586: .It Li "jump-to-mark" Ta "M-x" Ta "M-x"
1.497     nicm     1587: .It Li "middle-line" Ta "M" Ta "M-r"
1.678     nicm     1588: .It Li "next-matching-bracket" Ta "%" Ta "M-C-f"
1.497     nicm     1589: .It Li "next-paragraph" Ta "}" Ta "M-}"
                   1590: .It Li "next-space" Ta "W" Ta ""
                   1591: .It Li "next-space-end" Ta "E" Ta ""
                   1592: .It Li "next-word" Ta "w" Ta ""
                   1593: .It Li "next-word-end" Ta "e" Ta "M-f"
                   1594: .It Li "other-end" Ta "o" Ta ""
                   1595: .It Li "page-down" Ta "C-f" Ta "PageDown"
1.589     nicm     1596: .It Li "page-down-and-cancel" Ta "" Ta ""
1.497     nicm     1597: .It Li "page-up" Ta "C-b" Ta "PageUp"
1.678     nicm     1598: .It Li "previous-matching-bracket" Ta "" Ta "M-C-b"
1.497     nicm     1599: .It Li "previous-paragraph" Ta "{" Ta "M-{"
                   1600: .It Li "previous-space" Ta "B" Ta ""
                   1601: .It Li "previous-word" Ta "b" Ta "M-b"
                   1602: .It Li "rectangle-toggle" Ta "v" Ta "R"
1.732     nicm     1603: .It Li "refresh-from-pane" Ta "r" Ta "r"
1.497     nicm     1604: .It Li "scroll-down" Ta "C-e" Ta "C-Down"
1.589     nicm     1605: .It Li "scroll-down-and-cancel" Ta "" Ta ""
1.497     nicm     1606: .It Li "scroll-up" Ta "C-y" Ta "C-Up"
                   1607: .It Li "search-again" Ta "n" Ta "n"
1.517     nicm     1608: .It Li "search-backward <for>" Ta "?" Ta ""
1.726     nicm     1609: .It Li "search-backward-incremental <for>" Ta "" Ta "C-r"
                   1610: .It Li "search-backward-text <for>" Ta "" Ta ""
1.517     nicm     1611: .It Li "search-forward <for>" Ta "/" Ta ""
                   1612: .It Li "search-forward-incremental <for>" Ta "" Ta "C-s"
1.726     nicm     1613: .It Li "search-forward-text <for>" Ta "" Ta ""
1.497     nicm     1614: .It Li "search-reverse" Ta "N" Ta "N"
                   1615: .It Li "select-line" Ta "V" Ta ""
1.634     nicm     1616: .It Li "select-word" Ta "" Ta ""
1.768     nicm     1617: .It Li "set-mark" Ta "X" Ta "X"
1.497     nicm     1618: .It Li "start-of-line" Ta "0" Ta "C-a"
1.515     nicm     1619: .It Li "stop-selection" Ta "" Ta ""
1.497     nicm     1620: .It Li "top-line" Ta "H" Ta "M-R"
1.1       nicm     1621: .El
1.726     nicm     1622: .Pp
                   1623: The search commands come in several varieties:
                   1624: .Ql search-forward
                   1625: and
                   1626: .Ql search-backward
                   1627: search for a regular expression;
                   1628: the
                   1629: .Ql -text
                   1630: variants search for a plain text string rather than a regular expression;
                   1631: .Ql -incremental
                   1632: perform an incremental search and expect to be used with the
                   1633: .Fl i
                   1634: flag to the
                   1635: .Ic command-prompt
                   1636: command.
                   1637: .Ql search-again
                   1638: repeats the last search and
                   1639: .Ql search-reverse
                   1640: does the same but reverses the direction (forward becomes backward and backward
                   1641: becomes forward).
1.589     nicm     1642: .Pp
1.633     nicm     1643: Copy commands may take an optional buffer prefix argument which is used
                   1644: to generate the buffer name (the default is
                   1645: .Ql buffer
                   1646: so buffers are named
                   1647: .Ql buffer0 ,
                   1648: .Ql buffer1
                   1649: and so on).
                   1650: Pipe commands take a command argument which is the command to which the
                   1651: copied text is piped.
1.589     nicm     1652: The
                   1653: .Ql -and-cancel
                   1654: variants of some commands exit copy mode after they have completed (for copy
                   1655: commands) or when the cursor reaches the bottom (for scrolling commands).
1.638     nicm     1656: .Ql -no-clear
                   1657: variants do not clear the selection.
1.146     nicm     1658: .Pp
                   1659: The next and previous word keys use space and the
                   1660: .Ql - ,
1.154     nicm     1661: .Ql _
1.146     nicm     1662: and
                   1663: .Ql @
1.154     nicm     1664: characters as word delimiters by default, but this can be adjusted by
                   1665: setting the
                   1666: .Em word-separators
1.255     nicm     1667: session option.
1.146     nicm     1668: Next word moves to the start of the next word, next word end to the end of the
                   1669: next word and previous word to the start of the previous word.
                   1670: The three next and previous space keys work similarly but use a space alone as
                   1671: the word separator.
1.157     nicm     1672: .Pp
                   1673: The jump commands enable quick movement within a line.
                   1674: For instance, typing
                   1675: .Ql f
                   1676: followed by
                   1677: .Ql /
                   1678: will move the cursor to the next
                   1679: .Ql /
                   1680: character on the current line.
                   1681: A
                   1682: .Ql \&;
                   1683: will then jump to the next occurrence.
1.1       nicm     1684: .Pp
1.155     nicm     1685: Commands in copy mode may be prefaced by an optional repeat count.
                   1686: With vi key bindings, a prefix is entered using the number keys; with
                   1687: emacs, the Alt (meta) key and a number begins prefix entry.
                   1688: .Pp
1.164     nicm     1689: The synopsis for the
                   1690: .Ic copy-mode
                   1691: command is:
1.57      jmc      1692: .Bl -tag -width Ds
                   1693: .It Xo Ic copy-mode
1.720     nicm     1694: .Op Fl eHMqu
1.735     nicm     1695: .Op Fl s Ar src-pane
1.72      nicm     1696: .Op Fl t Ar target-pane
1.57      jmc      1697: .Xc
                   1698: Enter copy mode.
                   1699: The
                   1700: .Fl u
                   1701: option scrolls one page up.
1.419     nicm     1702: .Fl M
                   1703: begins a mouse drag (only valid if bound to a mouse key binding, see
1.420     jmc      1704: .Sx MOUSE SUPPORT ) .
1.716     nicm     1705: .Fl H
                   1706: hides the position indicator in the top right.
1.720     nicm     1707: .Fl q
                   1708: cancels copy mode and any other modes.
1.735     nicm     1709: .Fl s
                   1710: copies from
                   1711: .Ar src-pane
                   1712: instead of
1.736     nicm     1713: .Ar target-pane .
1.716     nicm     1714: .Pp
1.450     nicm     1715: .Fl e
                   1716: specifies that scrolling to the bottom of the history (to the visible screen)
                   1717: should exit copy mode.
                   1718: While in copy mode, pressing a key other than those used for scrolling will
                   1719: disable this behaviour.
                   1720: This is intended to allow fast scrolling through a pane's history, for
                   1721: example with:
                   1722: .Bd -literal -offset indent
                   1723: bind PageUp copy-mode -eu
                   1724: .Ed
1.57      jmc      1725: .El
1.18      nicm     1726: .Pp
1.679     nicm     1727: A number of preset arrangements of panes are available, these are called layouts.
1.38      nicm     1728: These may be selected with the
                   1729: .Ic select-layout
                   1730: command or cycled with
                   1731: .Ic next-layout
                   1732: (bound to
1.149     nicm     1733: .Ql Space
1.131     nicm     1734: by default); once a layout is chosen, panes within it may be moved and resized
                   1735: as normal.
1.1       nicm     1736: .Pp
                   1737: The following layouts are supported:
                   1738: .Bl -tag -width Ds
                   1739: .It Ic even-horizontal
                   1740: Panes are spread out evenly from left to right across the window.
                   1741: .It Ic even-vertical
                   1742: Panes are spread evenly from top to bottom.
1.2       nicm     1743: .It Ic main-horizontal
1.131     nicm     1744: A large (main) pane is shown at the top of the window and the remaining panes
                   1745: are spread from left to right in the leftover space at the bottom.
1.2       nicm     1746: Use the
                   1747: .Em main-pane-height
                   1748: window option to specify the height of the top pane.
1.1       nicm     1749: .It Ic main-vertical
1.2       nicm     1750: Similar to
                   1751: .Ic main-horizontal
                   1752: but the large pane is placed on the left and the others spread from top to
                   1753: bottom along the right.
                   1754: See the
                   1755: .Em main-pane-width
                   1756: window option.
1.165     nicm     1757: .It Ic tiled
                   1758: Panes are spread out as evenly as possible over the window in both rows and
                   1759: columns.
1.1       nicm     1760: .El
1.8       nicm     1761: .Pp
1.181     nicm     1762: In addition,
                   1763: .Ic select-layout
                   1764: may be used to apply a previously used layout - the
                   1765: .Ic list-windows
                   1766: command displays the layout of each window in a form suitable for use with
                   1767: .Ic select-layout .
                   1768: For example:
                   1769: .Bd -literal -offset indent
                   1770: $ tmux list-windows
                   1771: 0: ksh [159x48]
                   1772:     layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
                   1773: $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
                   1774: .Ed
1.196     nicm     1775: .Pp
1.181     nicm     1776: .Nm
                   1777: automatically adjusts the size of the layout for the current window size.
                   1778: Note that a layout cannot be applied to a window with more panes than that
                   1779: from which the layout was originally defined.
                   1780: .Pp
1.57      jmc      1781: Commands related to windows and panes are as follows:
                   1782: .Bl -tag -width Ds
                   1783: .It Xo Ic break-pane
1.749     nicm     1784: .Op Fl adP
1.280     nicm     1785: .Op Fl F Ar format
1.532     nicm     1786: .Op Fl n Ar window-name
1.440     nicm     1787: .Op Fl s Ar src-pane
1.480     nicm     1788: .Op Fl t Ar dst-window
1.57      jmc      1789: .Xc
                   1790: .D1 (alias: Ic breakp )
                   1791: Break
1.440     nicm     1792: .Ar src-pane
                   1793: off from its containing window to make it the only pane in
                   1794: .Ar dst-window .
1.749     nicm     1795: With
                   1796: .Fl a ,
                   1797: the window is moved to the next index up (following windows
                   1798: are moved if necessary).
1.57      jmc      1799: If
                   1800: .Fl d
                   1801: is given, the new window does not become the current window.
1.280     nicm     1802: The
                   1803: .Fl P
                   1804: option prints information about the new window after it has been created.
                   1805: By default, it uses the format
                   1806: .Ql #{session_name}:#{window_index}
                   1807: but a different format may be specified with
                   1808: .Fl F .
1.128     nicm     1809: .It Xo Ic capture-pane
1.680     nicm     1810: .Op Fl aepPqCJN
1.392     nicm     1811: .Op Fl b Ar buffer-name
1.213     nicm     1812: .Op Fl E Ar end-line
                   1813: .Op Fl S Ar start-line
1.128     nicm     1814: .Op Fl t Ar target-pane
                   1815: .Xc
                   1816: .D1 (alias: Ic capturep )
1.322     nicm     1817: Capture the contents of a pane.
                   1818: If
                   1819: .Fl p
1.325     nicm     1820: is given, the output goes to stdout, otherwise to the buffer specified with
1.322     nicm     1821: .Fl b
                   1822: or a new buffer if omitted.
1.339     nicm     1823: If
                   1824: .Fl a
                   1825: is given, the alternate screen is used, and the history is not accessible.
1.340     nicm     1826: If no alternate screen exists, an error will be returned unless
                   1827: .Fl q
                   1828: is given.
1.326     nicm     1829: If
                   1830: .Fl e
1.328     nicm     1831: is given, the output includes escape sequences for text and background
                   1832: attributes.
                   1833: .Fl C
1.330     nicm     1834: also escapes non-printable characters as octal \exxx.
1.680     nicm     1835: .Fl N
                   1836: preserves trailing spaces at each line's end and
1.328     nicm     1837: .Fl J
1.680     nicm     1838: preserves trailing spaces and joins any wrapped lines.
1.346     nicm     1839: .Fl P
                   1840: captures only any output that the pane has received that is the beginning of an
                   1841: as-yet incomplete escape sequence.
1.213     nicm     1842: .Pp
                   1843: .Fl S
                   1844: and
                   1845: .Fl E
                   1846: specify the starting and ending line numbers, zero is the first line of the
                   1847: visible pane and negative numbers are lines in the history.
1.397     nicm     1848: .Ql -
                   1849: to
                   1850: .Fl S
                   1851: is the start of the history and to
                   1852: .Fl E
                   1853: the end of the visible pane.
1.213     nicm     1854: The default is to capture only the visible contents of the pane.
1.76      nicm     1855: .It Xo
                   1856: .Ic choose-client
1.682     nicm     1857: .Op Fl NrZ
1.572     nicm     1858: .Op Fl F Ar format
1.562     nicm     1859: .Op Fl f Ar filter
1.561     nicm     1860: .Op Fl O Ar sort-order
1.555     nicm     1861: .Op Fl t Ar target-pane
1.76      nicm     1862: .Op Ar template
                   1863: .Xc
1.555     nicm     1864: Put a pane into client mode, allowing a client to be selected interactively from
                   1865: a list.
1.593     nicm     1866: .Fl Z
                   1867: zooms the pane.
1.555     nicm     1868: The following keys may be used in client mode:
                   1869: .Bl -column "Key" "Function" -offset indent
                   1870: .It Sy "Key" Ta Sy "Function"
                   1871: .It Li "Enter" Ta "Choose selected client"
                   1872: .It Li "Up" Ta "Select previous client"
                   1873: .It Li "Down" Ta "Select next client"
1.559     nicm     1874: .It Li "C-s" Ta "Search by name"
                   1875: .It Li "n" Ta "Repeat last search"
1.555     nicm     1876: .It Li "t" Ta "Toggle if client is tagged"
                   1877: .It Li "T" Ta "Tag no clients"
                   1878: .It Li "C-t" Ta "Tag all clients"
                   1879: .It Li "d" Ta "Detach selected client"
                   1880: .It Li "D" Ta "Detach tagged clients"
                   1881: .It Li "x" Ta "Detach and HUP selected client"
                   1882: .It Li "X" Ta "Detach and HUP tagged clients"
                   1883: .It Li "z" Ta "Suspend selected client"
                   1884: .It Li "Z" Ta "Suspend tagged clients"
1.562     nicm     1885: .It Li "f" Ta "Enter a format to filter items"
1.682     nicm     1886: .It Li "O" Ta "Change sort field"
                   1887: .It Li "r" Ta "Reverse sort order"
1.576     nicm     1888: .It Li "v" Ta "Toggle preview"
1.555     nicm     1889: .It Li "q" Ta "Exit mode"
                   1890: .El
                   1891: .Pp
1.76      nicm     1892: After a client is chosen,
                   1893: .Ql %%
1.555     nicm     1894: is replaced by the client name in
1.76      nicm     1895: .Ar template
                   1896: and the result executed as a command.
                   1897: If
                   1898: .Ar template
                   1899: is not given, "detach-client -t '%%'" is used.
1.555     nicm     1900: .Pp
1.561     nicm     1901: .Fl O
1.682     nicm     1902: specifies the initial sort field: one of
1.561     nicm     1903: .Ql name ,
                   1904: .Ql size ,
                   1905: .Ql creation ,
                   1906: or
                   1907: .Ql activity .
1.682     nicm     1908: .Fl r
                   1909: reverses the sort order.
1.562     nicm     1910: .Fl f
1.579     nicm     1911: specifies an initial filter: the filter is a format - if it evaluates to zero,
                   1912: the item in the list is not shown, otherwise it is shown.
                   1913: If a filter would lead to an empty list, it is ignored.
1.572     nicm     1914: .Fl F
                   1915: specifies the format for each item in the list.
1.576     nicm     1916: .Fl N
                   1917: starts without the preview.
1.314     nicm     1918: This command works only if at least one client is attached.
1.76      nicm     1919: .It Xo
1.555     nicm     1920: .Ic choose-tree
1.682     nicm     1921: .Op Fl GNrswZ
1.572     nicm     1922: .Op Fl F Ar format
1.562     nicm     1923: .Op Fl f Ar filter
1.561     nicm     1924: .Op Fl O Ar sort-order
1.555     nicm     1925: .Op Fl t Ar target-pane
1.76      nicm     1926: .Op Ar template
                   1927: .Xc
1.555     nicm     1928: Put a pane into tree mode, where a session, window or pane may be chosen
1.76      nicm     1929: interactively from a list.
1.298     nicm     1930: .Fl s
1.555     nicm     1931: starts with sessions collapsed and
1.298     nicm     1932: .Fl w
1.555     nicm     1933: with windows collapsed.
1.593     nicm     1934: .Fl Z
                   1935: zooms the pane.
1.555     nicm     1936: The following keys may be used in tree mode:
                   1937: .Bl -column "Key" "Function" -offset indent
                   1938: .It Sy "Key" Ta Sy "Function"
                   1939: .It Li "Enter" Ta "Choose selected item"
                   1940: .It Li "Up" Ta "Select previous item"
                   1941: .It Li "Down" Ta "Select next item"
1.763     nicm     1942: .It Li "+" Ta "Expand selected item"
                   1943: .It Li "-" Ta "Collapse selected item"
                   1944: .It Li "M-+" Ta "Expand all items"
                   1945: .It Li "M--" Ta "Collapse all items"
1.594     nicm     1946: .It Li "x" Ta "Kill selected item"
                   1947: .It Li "X" Ta "Kill tagged items"
1.566     nicm     1948: .It Li "<" Ta "Scroll list of previews left"
                   1949: .It Li ">" Ta "Scroll list of previews right"
1.559     nicm     1950: .It Li "C-s" Ta "Search by name"
1.749     nicm     1951: .It Li "m" Ta "Set the marked pane"
                   1952: .It Li "M" Ta "Clear the marked pane"
1.559     nicm     1953: .It Li "n" Ta "Repeat last search"
1.555     nicm     1954: .It Li "t" Ta "Toggle if item is tagged"
                   1955: .It Li "T" Ta "Tag no items"
                   1956: .It Li "C-t" Ta "Tag all items"
1.557     nicm     1957: .It Li "\&:" Ta "Run a command for each tagged item"
1.555     nicm     1958: .It Li "f" Ta "Enter a format to filter items"
1.749     nicm     1959: .It Li "H" Ta "Jump to the starting pane"
1.682     nicm     1960: .It Li "O" Ta "Change sort field"
                   1961: .It Li "r" Ta "Reverse sort order"
1.576     nicm     1962: .It Li "v" Ta "Toggle preview"
1.555     nicm     1963: .It Li "q" Ta "Exit mode"
                   1964: .El
1.320     nicm     1965: .Pp
1.555     nicm     1966: After a session, window or pane is chosen,
1.76      nicm     1967: .Ql %%
1.555     nicm     1968: is replaced by the target in
1.76      nicm     1969: .Ar template
                   1970: and the result executed as a command.
                   1971: If
                   1972: .Ar template
1.555     nicm     1973: is not given, "switch-client -t '%%'" is used.
                   1974: .Pp
1.561     nicm     1975: .Fl O
1.682     nicm     1976: specifies the initial sort field: one of
1.561     nicm     1977: .Ql index ,
                   1978: .Ql name ,
                   1979: or
                   1980: .Ql time .
1.682     nicm     1981: .Fl r
                   1982: reverses the sort order.
1.562     nicm     1983: .Fl f
1.579     nicm     1984: specifies an initial filter: the filter is a format - if it evaluates to zero,
                   1985: the item in the list is not shown, otherwise it is shown.
                   1986: If a filter would lead to an empty list, it is ignored.
1.572     nicm     1987: .Fl F
                   1988: specifies the format for each item in the tree.
1.576     nicm     1989: .Fl N
                   1990: starts without the preview.
1.586     nicm     1991: .Fl G
                   1992: includes all sessions in any session groups in the tree rather than only the
                   1993: first.
1.766     nicm     1994: This command works only if at least one client is attached.
                   1995: .It Xo
                   1996: .Ic customize-mode
                   1997: .Op Fl NZ
                   1998: .Op Fl F Ar format
                   1999: .Op Fl f Ar filter
                   2000: .Op Fl t Ar target-pane
                   2001: .Op Ar template
                   2002: .Xc
                   2003: Put a pane into customize mode, where options and key bindings may be browsed
                   2004: and modified from a list.
                   2005: Option values in the list are shown for the active pane in the current window.
                   2006: .Fl Z
                   2007: zooms the pane.
                   2008: The following keys may be used in customize mode:
                   2009: .Bl -column "Key" "Function" -offset indent
                   2010: .It Sy "Key" Ta Sy "Function"
                   2011: .It Li "Enter" Ta "Set pane, window, session or global option value"
                   2012: .It Li "Up" Ta "Select previous item"
                   2013: .It Li "Down" Ta "Select next item"
                   2014: .It Li "+" Ta "Expand selected item"
                   2015: .It Li "-" Ta "Collapse selected item"
                   2016: .It Li "M-+" Ta "Expand all items"
                   2017: .It Li "M--" Ta "Collapse all items"
                   2018: .It Li "s" Ta "Set option value or key attribute"
                   2019: .It Li "S" Ta "Set global option value"
                   2020: .It Li "w" Ta "Set window option value, if option is for pane and window"
                   2021: .It Li "u" Ta "Unset an option (set to default value if global) or unbind a key"
                   2022: .It Li "U" Ta "Unset tagged options and unbind tagged keys"
                   2023: .It Li "C-s" Ta "Search by name"
                   2024: .It Li "n" Ta "Repeat last search"
                   2025: .It Li "t" Ta "Toggle if item is tagged"
                   2026: .It Li "T" Ta "Tag no items"
                   2027: .It Li "C-t" Ta "Tag all items"
                   2028: .It Li "f" Ta "Enter a format to filter items"
                   2029: .It Li "v" Ta "Toggle option information"
                   2030: .It Li "q" Ta "Exit mode"
                   2031: .El
                   2032: .Pp
                   2033: .Fl f
                   2034: specifies an initial filter: the filter is a format - if it evaluates to zero,
                   2035: the item in the list is not shown, otherwise it is shown.
                   2036: If a filter would lead to an empty list, it is ignored.
                   2037: .Fl F
                   2038: specifies the format for each item in the tree.
                   2039: .Fl N
                   2040: starts without the option information.
1.314     nicm     2041: This command works only if at least one client is attached.
1.491     nicm     2042: .It Xo
                   2043: .Ic display-panes
1.616     nicm     2044: .Op Fl b
1.573     nicm     2045: .Op Fl d Ar duration
1.491     nicm     2046: .Op Fl t Ar target-client
                   2047: .Op Ar template
                   2048: .Xc
1.398     nicm     2049: .D1 (alias: Ic displayp )
1.78      nicm     2050: Display a visible indicator of each pane shown by
                   2051: .Ar target-client .
                   2052: See the
1.573     nicm     2053: .Ic display-panes-colour
1.78      nicm     2054: and
1.145     nicm     2055: .Ic display-panes-active-colour
1.78      nicm     2056: session options.
1.573     nicm     2057: The indicator is closed when a key is pressed or
                   2058: .Ar duration
                   2059: milliseconds have passed.
                   2060: If
                   2061: .Fl d
                   2062: is not given,
                   2063: .Ic display-panes-time
                   2064: is used.
                   2065: A duration of zero means the indicator stays until a key is pressed.
1.491     nicm     2066: While the indicator is on screen, a pane may be chosen with the
1.84      nicm     2067: .Ql 0
                   2068: to
                   2069: .Ql 9
1.491     nicm     2070: keys, which will cause
                   2071: .Ar template
                   2072: to be executed as a command with
                   2073: .Ql %%
                   2074: substituted by the pane ID.
                   2075: The default
                   2076: .Ar template
                   2077: is "select-pane -t '%%'".
1.616     nicm     2078: With
                   2079: .Fl b ,
                   2080: other commands are not blocked from running until the indicator is closed.
1.57      jmc      2081: .It Xo Ic find-window
1.670     nicm     2082: .Op Fl rCNTZ
1.555     nicm     2083: .Op Fl t Ar target-pane
1.57      jmc      2084: .Ar match-string
                   2085: .Xc
                   2086: .D1 (alias: Ic findw )
1.670     nicm     2087: Search for a
1.57      jmc      2088: .Xr fnmatch 3
1.670     nicm     2089: pattern or, with
                   2090: .Fl r ,
                   2091: regular expression
1.57      jmc      2092: .Ar match-string
                   2093: in window names, titles, and visible content (but not history).
1.285     nicm     2094: The flags control matching behavior:
                   2095: .Fl C
                   2096: matches only visible window contents,
                   2097: .Fl N
                   2098: matches only the window name and
                   2099: .Fl T
                   2100: matches only the window title.
                   2101: The default is
                   2102: .Fl CNT .
1.608     nicm     2103: .Fl Z
                   2104: zooms the pane.
1.555     nicm     2105: .Pp
1.314     nicm     2106: This command works only if at least one client is attached.
1.137     nicm     2107: .It Xo Ic join-pane
1.697     nicm     2108: .Op Fl bdfhv
1.690     nicm     2109: .Op Fl l Ar size
1.137     nicm     2110: .Op Fl s Ar src-pane
                   2111: .Op Fl t Ar dst-pane
                   2112: .Xc
                   2113: .D1 (alias: Ic joinp )
                   2114: Like
                   2115: .Ic split-window ,
                   2116: but instead of splitting
                   2117: .Ar dst-pane
                   2118: and creating a new pane, split it and move
                   2119: .Ar src-pane
                   2120: into the space.
                   2121: This can be used to reverse
                   2122: .Ic break-pane .
1.277     nicm     2123: The
                   2124: .Fl b
                   2125: option causes
                   2126: .Ar src-pane
                   2127: to be joined to left of or above
                   2128: .Ar dst-pane .
1.432     nicm     2129: .Pp
                   2130: If
                   2131: .Fl s
                   2132: is omitted and a marked pane is present (see
                   2133: .Ic select-pane
                   2134: .Fl m ) ,
                   2135: the marked pane is used rather than the current pane.
1.112     nicm     2136: .It Xo Ic kill-pane
                   2137: .Op Fl a
                   2138: .Op Fl t Ar target-pane
                   2139: .Xc
1.57      jmc      2140: .D1 (alias: Ic killp )
                   2141: Destroy the given pane.
                   2142: If no panes remain in the containing window, it is also destroyed.
1.112     nicm     2143: The
                   2144: .Fl a
                   2145: option kills all but the pane given with
                   2146: .Fl t .
1.289     nicm     2147: .It Xo Ic kill-window
                   2148: .Op Fl a
                   2149: .Op Fl t Ar target-window
                   2150: .Xc
1.57      jmc      2151: .D1 (alias: Ic killw )
                   2152: Kill the current window or the window at
                   2153: .Ar target-window ,
1.1       nicm     2154: removing it from any sessions to which it is linked.
1.289     nicm     2155: The
                   2156: .Fl a
                   2157: option kills all but the window given with
                   2158: .Fl t .
1.398     nicm     2159: .It Xo Ic last-pane
1.681     nicm     2160: .Op Fl deZ
1.398     nicm     2161: .Op Fl t Ar target-window
                   2162: .Xc
1.187     nicm     2163: .D1 (alias: Ic lastp )
                   2164: Select the last (previously selected) pane.
1.681     nicm     2165: .Fl Z
                   2166: keeps the window zoomed if it was zoomed.
1.398     nicm     2167: .Fl e
                   2168: enables or
                   2169: .Fl d
                   2170: disables input to the pane.
1.56      jmc      2171: .It Ic last-window Op Fl t Ar target-session
1.1       nicm     2172: .D1 (alias: Ic last )
                   2173: Select the last (previously selected) window.
                   2174: If no
                   2175: .Ar target-session
                   2176: is specified, select the last window of the current session.
                   2177: .It Xo Ic link-window
1.439     nicm     2178: .Op Fl adk
1.1       nicm     2179: .Op Fl s Ar src-window
                   2180: .Op Fl t Ar dst-window
                   2181: .Xc
                   2182: .D1 (alias: Ic linkw )
                   2183: Link the window at
                   2184: .Ar src-window
                   2185: to the specified
                   2186: .Ar dst-window .
                   2187: If
                   2188: .Ar dst-window
                   2189: is specified and no such window exists, the
                   2190: .Ar src-window
                   2191: is linked there.
1.439     nicm     2192: With
                   2193: .Fl a ,
                   2194: the window is moved to the next index up (following windows
                   2195: are moved if necessary).
1.1       nicm     2196: If
                   2197: .Fl k
                   2198: is given and
                   2199: .Ar dst-window
                   2200: exists, it is killed, otherwise an error is generated.
                   2201: If
                   2202: .Fl d
                   2203: is given, the newly linked window is not selected.
1.214     nicm     2204: .It Xo Ic list-panes
                   2205: .Op Fl as
1.245     nicm     2206: .Op Fl F Ar format
1.738     nicm     2207: .Op Fl f Ar filter
1.214     nicm     2208: .Op Fl t Ar target
                   2209: .Xc
1.104     nicm     2210: .D1 (alias: Ic lsp )
1.214     nicm     2211: If
                   2212: .Fl a
                   2213: is given,
                   2214: .Ar target
                   2215: is ignored and all panes on the server are listed.
                   2216: If
                   2217: .Fl s
                   2218: is given,
                   2219: .Ar target
                   2220: is a session (or the current session).
                   2221: If neither is given,
                   2222: .Ar target
                   2223: is a window (or the current window).
1.247     nicm     2224: .Fl F
1.738     nicm     2225: specifies the format of each line and
                   2226: .Fl f
                   2227: a filter.
                   2228: Only panes for which the filter is true are shown.
                   2229: See the
1.247     nicm     2230: .Sx FORMATS
                   2231: section.
1.214     nicm     2232: .It Xo Ic list-windows
                   2233: .Op Fl a
1.245     nicm     2234: .Op Fl F Ar format
1.738     nicm     2235: .Op Fl f Ar filter
1.214     nicm     2236: .Op Fl t Ar target-session
                   2237: .Xc
1.1       nicm     2238: .D1 (alias: Ic lsw )
1.214     nicm     2239: If
                   2240: .Fl a
                   2241: is given, list all windows on the server.
                   2242: Otherwise, list windows in the current session or in
1.1       nicm     2243: .Ar target-session .
1.245     nicm     2244: .Fl F
1.738     nicm     2245: specifies the format of each line and
                   2246: .Fl f
                   2247: a filter.
                   2248: Only windows for which the filter is true are shown.
                   2249: See the
1.245     nicm     2250: .Sx FORMATS
                   2251: section.
1.277     nicm     2252: .It Xo Ic move-pane
1.749     nicm     2253: .Op Fl bdfhv
1.690     nicm     2254: .Op Fl l Ar size
1.277     nicm     2255: .Op Fl s Ar src-pane
                   2256: .Op Fl t Ar dst-pane
                   2257: .Xc
                   2258: .D1 (alias: Ic movep )
1.749     nicm     2259: Does the same as
                   2260: .Ic join-pane .
1.1       nicm     2261: .It Xo Ic move-window
1.439     nicm     2262: .Op Fl ardk
1.1       nicm     2263: .Op Fl s Ar src-window
                   2264: .Op Fl t Ar dst-window
                   2265: .Xc
                   2266: .D1 (alias: Ic movew )
                   2267: This is similar to
                   2268: .Ic link-window ,
                   2269: except the window at
                   2270: .Ar src-window
                   2271: is moved to
                   2272: .Ar dst-window .
1.291     nicm     2273: With
                   2274: .Fl r ,
                   2275: all windows in the session are renumbered in sequential order, respecting
                   2276: the
                   2277: .Ic base-index
                   2278: option.
1.1       nicm     2279: .It Xo Ic new-window
1.201     nicm     2280: .Op Fl adkP
1.272     nicm     2281: .Op Fl c Ar start-directory
1.641     nicm     2282: .Op Fl e Ar environment
1.351     nicm     2283: .Op Fl F Ar format
1.1       nicm     2284: .Op Fl n Ar window-name
                   2285: .Op Fl t Ar target-window
1.153     nicm     2286: .Op Ar shell-command
1.1       nicm     2287: .Xc
                   2288: .D1 (alias: Ic neww )
                   2289: Create a new window.
1.160     nicm     2290: With
                   2291: .Fl a ,
                   2292: the new window is inserted at the next index up from the specified
                   2293: .Ar target-window ,
                   2294: moving windows up if necessary,
                   2295: otherwise
                   2296: .Ar target-window
                   2297: is the new window location.
                   2298: .Pp
1.1       nicm     2299: If
                   2300: .Fl d
                   2301: is given, the session does not make the new window the current window.
                   2302: .Ar target-window
1.28      nicm     2303: represents the window to be created; if the target already exists an error is
                   2304: shown, unless the
                   2305: .Fl k
                   2306: flag is used, in which case it is destroyed.
1.153     nicm     2307: .Ar shell-command
1.1       nicm     2308: is the command to execute.
                   2309: If
1.153     nicm     2310: .Ar shell-command
                   2311: is not specified, the value of the
                   2312: .Ic default-command
                   2313: option is used.
1.272     nicm     2314: .Fl c
                   2315: specifies the working directory in which the new window is created.
1.153     nicm     2316: .Pp
                   2317: When the shell command completes, the window closes.
                   2318: See the
                   2319: .Ic remain-on-exit
                   2320: option to change this behaviour.
1.1       nicm     2321: .Pp
1.641     nicm     2322: .Fl e
                   2323: takes the form
                   2324: .Ql VARIABLE=value
                   2325: and sets an environment variable for the newly created window; it may be
                   2326: specified multiple times.
                   2327: .Pp
1.1       nicm     2328: The
                   2329: .Ev TERM
                   2330: environment variable must be set to
1.523     nicm     2331: .Ql screen
                   2332: or
                   2333: .Ql tmux
1.1       nicm     2334: for all programs running
                   2335: .Em inside
                   2336: .Nm .
                   2337: New windows will automatically have
1.523     nicm     2338: .Ql TERM=screen
1.1       nicm     2339: added to their environment, but care must be taken not to reset this in shell
1.641     nicm     2340: start-up files or by the
                   2341: .Fl e
                   2342: option.
1.201     nicm     2343: .Pp
                   2344: The
                   2345: .Fl P
1.279     nicm     2346: option prints information about the new window after it has been created.
                   2347: By default, it uses the format
                   2348: .Ql #{session_name}:#{window_index}
                   2349: but a different format may be specified with
                   2350: .Fl F .
1.56      jmc      2351: .It Ic next-layout Op Fl t Ar target-window
1.1       nicm     2352: .D1 (alias: Ic nextl )
                   2353: Move a window to the next layout and rearrange the panes to fit.
                   2354: .It Xo Ic next-window
1.9       nicm     2355: .Op Fl a
1.1       nicm     2356: .Op Fl t Ar target-session
                   2357: .Xc
                   2358: .D1 (alias: Ic next )
                   2359: Move to the next window in the session.
1.9       nicm     2360: If
1.12      jmc      2361: .Fl a
1.295     nicm     2362: is used, move to the next window with an alert.
1.107     nicm     2363: .It Xo Ic pipe-pane
1.591     nicm     2364: .Op Fl IOo
1.107     nicm     2365: .Op Fl t Ar target-pane
1.153     nicm     2366: .Op Ar shell-command
1.107     nicm     2367: .Xc
                   2368: .D1 (alias: Ic pipep )
1.591     nicm     2369: Pipe output sent by the program in
1.107     nicm     2370: .Ar target-pane
1.591     nicm     2371: to a shell command or vice versa.
                   2372: A pane may only be connected to one command at a time, any existing pipe is
1.107     nicm     2373: closed before
1.153     nicm     2374: .Ar shell-command
1.107     nicm     2375: is executed.
1.174     nicm     2376: The
                   2377: .Ar shell-command
                   2378: string may contain the special character sequences supported by the
                   2379: .Ic status-left
1.231     nicm     2380: option.
1.107     nicm     2381: If no
1.153     nicm     2382: .Ar shell-command
1.107     nicm     2383: is given, the current pipe (if any) is closed.
1.591     nicm     2384: .Pp
                   2385: .Fl I
                   2386: and
                   2387: .Fl O
                   2388: specify which of the
                   2389: .Ar shell-command
                   2390: output streams are connected to the pane:
                   2391: with
                   2392: .Fl I
                   2393: stdout is connected (so anything
                   2394: .Ar shell-command
                   2395: prints is written to the pane as if it were typed);
                   2396: with
                   2397: .Fl O
                   2398: stdin is connected (so any output in the pane is piped to
                   2399: .Ar shell-command ) .
                   2400: Both may be used together and if neither are specified,
                   2401: .Fl O
                   2402: is used.
1.107     nicm     2403: .Pp
                   2404: The
                   2405: .Fl o
                   2406: option only opens a new pipe if no previous pipe exists, allowing a pipe to
                   2407: be toggled with a single key, for example:
                   2408: .Bd -literal -offset indent
1.174     nicm     2409: bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1.107     nicm     2410: .Ed
1.176     nicm     2411: .It Xo Ic previous-layout
                   2412: .Op Fl t Ar target-window
                   2413: .Xc
                   2414: .D1 (alias: Ic prevl )
                   2415: Move to the previous layout in the session.
1.1       nicm     2416: .It Xo Ic previous-window
1.9       nicm     2417: .Op Fl a
1.1       nicm     2418: .Op Fl t Ar target-session
                   2419: .Xc
                   2420: .D1 (alias: Ic prev )
                   2421: Move to the previous window in the session.
1.9       nicm     2422: With
                   2423: .Fl a ,
1.295     nicm     2424: move to the previous window with an alert.
1.1       nicm     2425: .It Xo Ic rename-window
                   2426: .Op Fl t Ar target-window
                   2427: .Ar new-name
                   2428: .Xc
                   2429: .D1 (alias: Ic renamew )
                   2430: Rename the current window, or the window at
                   2431: .Ar target-window
                   2432: if specified, to
                   2433: .Ar new-name .
                   2434: .It Xo Ic resize-pane
1.727     nicm     2435: .Op Fl DLMRTUZ
1.52      nicm     2436: .Op Fl t Ar target-pane
1.324     nicm     2437: .Op Fl x Ar width
                   2438: .Op Fl y Ar height
1.1       nicm     2439: .Op Ar adjustment
                   2440: .Xc
                   2441: .D1 (alias: Ic resizep )
1.324     nicm     2442: Resize a pane, up, down, left or right by
                   2443: .Ar adjustment
                   2444: with
                   2445: .Fl U ,
1.57      jmc      2446: .Fl D ,
                   2447: .Fl L
1.324     nicm     2448: or
                   2449: .Fl R ,
                   2450: or
                   2451: to an absolute size
                   2452: with
                   2453: .Fl x
                   2454: or
                   2455: .Fl y .
1.57      jmc      2456: The
                   2457: .Ar adjustment
1.690     nicm     2458: is given in lines or columns (the default is 1);
                   2459: .Fl x
                   2460: and
                   2461: .Fl y
                   2462: may be a given as a number of lines or columns or followed by
                   2463: .Ql %
                   2464: for a percentage of the window size (for example
                   2465: .Ql -x 10% ) .
1.337     nicm     2466: With
                   2467: .Fl Z ,
1.349     nicm     2468: the active pane is toggled between zoomed (occupying the whole of the window)
                   2469: and unzoomed (its normal position in the layout).
1.419     nicm     2470: .Pp
                   2471: .Fl M
                   2472: begins mouse resizing (only valid if bound to a mouse key binding, see
1.420     jmc      2473: .Sx MOUSE SUPPORT ) .
1.729     nicm     2474: .Pp
                   2475: .Fl T
1.727     nicm     2476: trims all lines below the current cursor position and moves lines out of the
                   2477: history to replace them.
1.629     nicm     2478: .It Xo Ic resize-window
                   2479: .Op Fl aADLRU
                   2480: .Op Fl t Ar target-window
                   2481: .Op Fl x Ar width
                   2482: .Op Fl y Ar height
                   2483: .Op Ar adjustment
                   2484: .Xc
                   2485: .D1 (alias: Ic resizew )
                   2486: Resize a window, up, down, left or right by
                   2487: .Ar adjustment
                   2488: with
                   2489: .Fl U ,
                   2490: .Fl D ,
                   2491: .Fl L
                   2492: or
                   2493: .Fl R ,
                   2494: or
                   2495: to an absolute size
                   2496: with
                   2497: .Fl x
                   2498: or
                   2499: .Fl y .
                   2500: The
                   2501: .Ar adjustment
                   2502: is given in lines or cells (the default is 1).
                   2503: .Fl A
                   2504: sets the size of the largest session containing the window;
                   2505: .Fl a
                   2506: the size of the smallest.
                   2507: This command will automatically set
                   2508: .Ic window-size
                   2509: to manual in the window options.
1.234     nicm     2510: .It Xo Ic respawn-pane
1.641     nicm     2511: .Op Fl k
1.568     nicm     2512: .Op Fl c Ar start-directory
1.641     nicm     2513: .Op Fl e Ar environment
1.234     nicm     2514: .Op Fl t Ar target-pane
                   2515: .Op Ar shell-command
                   2516: .Xc
                   2517: .D1 (alias: Ic respawnp )
                   2518: Reactivate a pane in which the command has exited (see the
                   2519: .Ic remain-on-exit
                   2520: window option).
                   2521: If
                   2522: .Ar shell-command
                   2523: is not given, the command used when the pane was created is executed.
                   2524: The pane must be already inactive, unless
                   2525: .Fl k
                   2526: is given, in which case any existing command is killed.
1.568     nicm     2527: .Fl c
                   2528: specifies a new working directory for the pane.
1.641     nicm     2529: The
                   2530: .Fl e
                   2531: option has the same meaning as for the
                   2532: .Ic new-window
                   2533: command.
1.57      jmc      2534: .It Xo Ic respawn-window
1.641     nicm     2535: .Op Fl k
1.568     nicm     2536: .Op Fl c Ar start-directory
1.641     nicm     2537: .Op Fl e Ar environment
1.57      jmc      2538: .Op Fl t Ar target-window
1.153     nicm     2539: .Op Ar shell-command
1.57      jmc      2540: .Xc
                   2541: .D1 (alias: Ic respawnw )
1.153     nicm     2542: Reactivate a window in which the command has exited (see the
1.57      jmc      2543: .Ic remain-on-exit
                   2544: window option).
                   2545: If
1.153     nicm     2546: .Ar shell-command
1.57      jmc      2547: is not given, the command used when the window was created is executed.
                   2548: The window must be already inactive, unless
                   2549: .Fl k
                   2550: is given, in which case any existing command is killed.
1.568     nicm     2551: .Fl c
                   2552: specifies a new working directory for the window.
1.641     nicm     2553: The
                   2554: .Fl e
                   2555: option has the same meaning as for the
                   2556: .Ic new-window
                   2557: command.
1.57      jmc      2558: .It Xo Ic rotate-window
1.681     nicm     2559: .Op Fl DUZ
1.57      jmc      2560: .Op Fl t Ar target-window
                   2561: .Xc
                   2562: .D1 (alias: Ic rotatew )
                   2563: Rotate the positions of the panes within a window, either upward (numerically
                   2564: lower) with
                   2565: .Fl U
                   2566: or downward (numerically higher).
1.681     nicm     2567: .Fl Z
                   2568: keeps the window zoomed if it was zoomed.
1.57      jmc      2569: .It Xo Ic select-layout
1.588     nicm     2570: .Op Fl Enop
                   2571: .Op Fl t Ar target-pane
1.57      jmc      2572: .Op Ar layout-name
                   2573: .Xc
1.176     nicm     2574: .D1 (alias: Ic selectl )
1.57      jmc      2575: Choose a specific layout for a window.
                   2576: If
                   2577: .Ar layout-name
1.181     nicm     2578: is not given, the last preset layout used (if any) is reapplied.
1.204     nicm     2579: .Fl n
                   2580: and
                   2581: .Fl p
                   2582: are equivalent to the
                   2583: .Ic next-layout
                   2584: and
                   2585: .Ic previous-layout
                   2586: commands.
1.424     nicm     2587: .Fl o
                   2588: applies the last set layout if possible (undoes the most recent layout change).
1.588     nicm     2589: .Fl E
                   2590: spreads the current pane and any panes next to it out evenly.
1.156     nicm     2591: .It Xo Ic select-pane
1.681     nicm     2592: .Op Fl DdeLlMmRUZ
1.577     nicm     2593: .Op Fl T Ar title
1.156     nicm     2594: .Op Fl t Ar target-pane
                   2595: .Xc
1.57      jmc      2596: .D1 (alias: Ic selectp )
                   2597: Make pane
                   2598: .Ar target-pane
1.774   ! nicm     2599: the active pane in its window.
1.156     nicm     2600: If one of
                   2601: .Fl D ,
                   2602: .Fl L ,
                   2603: .Fl R ,
                   2604: or
                   2605: .Fl U
                   2606: is used, respectively the pane below, to the left, to the right, or above the
                   2607: target pane is used.
1.681     nicm     2608: .Fl Z
                   2609: keeps the window zoomed if it was zoomed.
1.204     nicm     2610: .Fl l
                   2611: is the same as using the
                   2612: .Ic last-pane
                   2613: command.
1.398     nicm     2614: .Fl e
                   2615: enables or
                   2616: .Fl d
                   2617: disables input to the pane.
1.668     nicm     2618: .Fl T
                   2619: sets the pane title.
1.418     nicm     2620: .Pp
1.432     nicm     2621: .Fl m
                   2622: and
                   2623: .Fl M
                   2624: are used to set and clear the
                   2625: .Em marked pane .
                   2626: There is one marked pane at a time, setting a new marked pane clears the last.
                   2627: The marked pane is the default target for
                   2628: .Fl s
                   2629: to
                   2630: .Ic join-pane ,
                   2631: .Ic swap-pane
                   2632: and
                   2633: .Ic swap-window .
1.204     nicm     2634: .It Xo Ic select-window
1.310     nicm     2635: .Op Fl lnpT
1.204     nicm     2636: .Op Fl t Ar target-window
                   2637: .Xc
1.57      jmc      2638: .D1 (alias: Ic selectw )
                   2639: Select the window at
                   2640: .Ar target-window .
1.204     nicm     2641: .Fl l ,
                   2642: .Fl n
                   2643: and
                   2644: .Fl p
                   2645: are equivalent to the
                   2646: .Ic last-window ,
                   2647: .Ic next-window
                   2648: and
                   2649: .Ic previous-window
                   2650: commands.
1.310     nicm     2651: If
                   2652: .Fl T
                   2653: is given and the selected window is already the current window,
                   2654: the command behaves like
                   2655: .Ic last-window .
1.57      jmc      2656: .It Xo Ic split-window
1.643     nicm     2657: .Op Fl bdfhIvP
1.272     nicm     2658: .Op Fl c Ar start-directory
1.641     nicm     2659: .Op Fl e Ar environment
1.690     nicm     2660: .Op Fl l Ar size
1.136     nicm     2661: .Op Fl t Ar target-pane
1.153     nicm     2662: .Op Ar shell-command
1.279     nicm     2663: .Op Fl F Ar format
1.57      jmc      2664: .Xc
1.176     nicm     2665: .D1 (alias: Ic splitw )
1.136     nicm     2666: Create a new pane by splitting
                   2667: .Ar target-pane :
1.57      jmc      2668: .Fl h
                   2669: does a horizontal split and
                   2670: .Fl v
                   2671: a vertical split; if neither is specified,
                   2672: .Fl v
                   2673: is assumed.
                   2674: The
                   2675: .Fl l
1.690     nicm     2676: option specifies the size of the new pane in lines (for vertical split) or in
                   2677: columns (for horizontal split);
                   2678: .Ar size
                   2679: may be followed by
                   2680: .Ql %
                   2681: to specify a percentage of the available space.
1.408     nicm     2682: The
                   2683: .Fl b
                   2684: option causes the new pane to be created to the left of or above
                   2685: .Ar target-pane .
1.494     nicm     2686: The
                   2687: .Fl f
                   2688: option creates a new pane spanning the full window height (with
                   2689: .Fl h )
                   2690: or full window width (with
                   2691: .Fl v ) ,
                   2692: instead of splitting the active pane.
1.643     nicm     2693: .Pp
                   2694: An empty
                   2695: .Ar shell-command
                   2696: ('') will create a pane with no command running in it.
                   2697: Output can be sent to such a pane with the
                   2698: .Ic display-message
                   2699: command.
                   2700: The
                   2701: .Fl I
                   2702: flag (if
                   2703: .Ar shell-command
                   2704: is not specified or empty)
                   2705: will create an empty pane and forward any output from stdin to it.
                   2706: For example:
                   2707: .Bd -literal -offset indent
                   2708: $ make 2>&1|tmux splitw -dI &
                   2709: .Ed
                   2710: .Pp
1.136     nicm     2711: All other options have the same meaning as for the
1.57      jmc      2712: .Ic new-window
                   2713: command.
                   2714: .It Xo Ic swap-pane
1.681     nicm     2715: .Op Fl dDUZ
1.57      jmc      2716: .Op Fl s Ar src-pane
                   2717: .Op Fl t Ar dst-pane
                   2718: .Xc
                   2719: .D1 (alias: Ic swapp )
                   2720: Swap two panes.
                   2721: If
                   2722: .Fl U
                   2723: is used and no source pane is specified with
                   2724: .Fl s ,
                   2725: .Ar dst-pane
                   2726: is swapped with the previous pane (before it numerically);
                   2727: .Fl D
                   2728: swaps with the next pane (after it numerically).
1.138     nicm     2729: .Fl d
                   2730: instructs
                   2731: .Nm
1.681     nicm     2732: not to change the active pane and
                   2733: .Fl Z
                   2734: keeps the window zoomed if it was zoomed.
1.432     nicm     2735: .Pp
                   2736: If
                   2737: .Fl s
                   2738: is omitted and a marked pane is present (see
                   2739: .Ic select-pane
                   2740: .Fl m ) ,
                   2741: the marked pane is used rather than the current pane.
1.57      jmc      2742: .It Xo Ic swap-window
                   2743: .Op Fl d
                   2744: .Op Fl s Ar src-window
                   2745: .Op Fl t Ar dst-window
                   2746: .Xc
                   2747: .D1 (alias: Ic swapw )
                   2748: This is similar to
                   2749: .Ic link-window ,
                   2750: except the source and destination windows are swapped.
                   2751: It is an error if no window exists at
                   2752: .Ar src-window .
1.705     nicm     2753: If
                   2754: .Fl d
                   2755: is given, the new window does not become the current window.
1.432     nicm     2756: .Pp
1.705     nicm     2757: If
1.432     nicm     2758: .Fl s
                   2759: is omitted and a marked pane is present (see
                   2760: .Ic select-pane
                   2761: .Fl m ) ,
                   2762: the window containing the marked pane is used rather than the current window.
1.57      jmc      2763: .It Xo Ic unlink-window
1.1       nicm     2764: .Op Fl k
                   2765: .Op Fl t Ar target-window
                   2766: .Xc
1.57      jmc      2767: .D1 (alias: Ic unlinkw )
                   2768: Unlink
                   2769: .Ar target-window .
                   2770: Unless
                   2771: .Fl k
                   2772: is given, a window may be unlinked only if it is linked to multiple sessions -
                   2773: windows may not be linked to no sessions;
                   2774: if
1.1       nicm     2775: .Fl k
1.57      jmc      2776: is specified and the window is linked to only one session, it is unlinked and
                   2777: destroyed.
                   2778: .El
                   2779: .Sh KEY BINDINGS
1.93      nicm     2780: .Nm
                   2781: allows a command to be bound to most keys, with or without a prefix key.
                   2782: When specifying keys, most represent themselves (for example
                   2783: .Ql A
                   2784: to
1.95      jmc      2785: .Ql Z ) .
1.93      nicm     2786: Ctrl keys may be prefixed with
                   2787: .Ql C-
                   2788: or
1.95      jmc      2789: .Ql ^ ,
                   2790: and Alt (meta) with
1.93      nicm     2791: .Ql M- .
                   2792: In addition, the following special key names are accepted:
1.126     nicm     2793: .Em Up ,
                   2794: .Em Down ,
                   2795: .Em Left ,
                   2796: .Em Right ,
1.93      nicm     2797: .Em BSpace ,
                   2798: .Em BTab ,
                   2799: .Em DC
                   2800: (Delete),
                   2801: .Em End ,
                   2802: .Em Enter ,
                   2803: .Em Escape ,
                   2804: .Em F1
                   2805: to
1.402     nicm     2806: .Em F12 ,
1.93      nicm     2807: .Em Home ,
                   2808: .Em IC
                   2809: (Insert),
1.254     nicm     2810: .Em NPage/PageDown/PgDn ,
                   2811: .Em PPage/PageUp/PgUp ,
1.93      nicm     2812: .Em Space ,
                   2813: and
                   2814: .Em Tab .
                   2815: Note that to bind the
                   2816: .Ql \&"
                   2817: or
                   2818: .Ql '
                   2819: keys, quotation marks are necessary, for example:
                   2820: .Bd -literal -offset indent
                   2821: bind-key '"' split-window
1.167     nicm     2822: bind-key "'" new-window
1.93      nicm     2823: .Ed
1.693     nicm     2824: .Pp
                   2825: A command bound to the
                   2826: .Em Any
                   2827: key will execute for all keys which do not have a more specific binding.
1.93      nicm     2828: .Pp
1.57      jmc      2829: Commands related to key bindings are as follows:
                   2830: .Bl -tag -width Ds
                   2831: .It Xo Ic bind-key
1.501     nicm     2832: .Op Fl nr
1.706     nicm     2833: .Op Fl N Ar note
1.421     nicm     2834: .Op Fl T Ar key-table
1.750     jmc      2835: .Ar key command Op Ar arguments
1.1       nicm     2836: .Xc
1.57      jmc      2837: .D1 (alias: Ic bind )
                   2838: Bind key
                   2839: .Ar key
                   2840: to
                   2841: .Ar command .
1.421     nicm     2842: Keys are bound in a key table.
                   2843: By default (without -T), the key is bound in
                   2844: the
                   2845: .Em prefix
                   2846: key table.
                   2847: This table is used for keys pressed after the prefix key (for example,
                   2848: by default
                   2849: .Ql c
                   2850: is bound to
                   2851: .Ic new-window
                   2852: in the
                   2853: .Em prefix
                   2854: table, so
                   2855: .Ql C-b c
                   2856: creates a new window).
                   2857: The
                   2858: .Em root
                   2859: table is used for keys pressed without the prefix key: binding
                   2860: .Ql c
                   2861: to
                   2862: .Ic new-window
                   2863: in the
                   2864: .Em root
                   2865: table (not recommended) means a plain
                   2866: .Ql c
                   2867: will create a new window.
1.57      jmc      2868: .Fl n
1.421     nicm     2869: is an alias
                   2870: for
                   2871: .Fl T Ar root .
                   2872: Keys may also be bound in custom key tables and the
                   2873: .Ic switch-client
                   2874: .Fl T
                   2875: command used to switch to them from a key binding.
1.1       nicm     2876: The
1.57      jmc      2877: .Fl r
                   2878: flag indicates this key may repeat, see the
                   2879: .Ic repeat-time
                   2880: option.
1.706     nicm     2881: .Fl N
                   2882: attaches a note to the key (shown with
                   2883: .Ic list-keys
                   2884: .Fl N ) .
1.57      jmc      2885: .Pp
                   2886: To view the default bindings and possible commands, see the
                   2887: .Ic list-keys
                   2888: command.
1.421     nicm     2889: .It Xo Ic list-keys
1.712     nicm     2890: .Op Fl 1aN
1.706     nicm     2891: .Op Fl P Ar prefix-string Fl T Ar key-table
1.731     nicm     2892: .Op Ar key
1.421     nicm     2893: .Xc
1.57      jmc      2894: .D1 (alias: Ic lsk )
1.710     nicm     2895: List key bindings.
                   2896: There are two forms: the default lists keys as
1.706     nicm     2897: .Ic bind-key
1.710     nicm     2898: commands;
                   2899: .Fl N
                   2900: lists only keys with attached notes and shows only the key and note for each
                   2901: key.
                   2902: .Pp
                   2903: With the default form, all key tables are listed by default.
                   2904: .Fl T
                   2905: lists only keys in
                   2906: .Ar key-table .
                   2907: .Pp
                   2908: With the
1.706     nicm     2909: .Fl N
1.710     nicm     2910: form, only keys in the
1.706     nicm     2911: .Em root
                   2912: and
                   2913: .Em prefix
1.710     nicm     2914: key tables are listed by default;
                   2915: .Fl T
                   2916: also lists only keys in
                   2917: .Ar key-table .
1.706     nicm     2918: .Fl P
1.710     nicm     2919: specifies a prefix to print before each key and
1.706     nicm     2920: .Fl 1
1.710     nicm     2921: lists only the first matching key.
1.712     nicm     2922: .Fl a
                   2923: lists the command for keys that do have a note rather than skipping them.
1.57      jmc      2924: .It Xo Ic send-keys
1.694     nicm     2925: .Op Fl FHlMRX
1.497     nicm     2926: .Op Fl N Ar repeat-count
1.72      nicm     2927: .Op Fl t Ar target-pane
1.57      jmc      2928: .Ar key Ar ...
1.1       nicm     2929: .Xc
1.57      jmc      2930: .D1 (alias: Ic send )
                   2931: Send a key or keys to a window.
                   2932: Each argument
                   2933: .Ar key
                   2934: is the name of the key (such as
                   2935: .Ql C-a
                   2936: or
1.523     nicm     2937: .Ql NPage )
                   2938: to send; if the string is not recognised as a key, it is sent as a series of
1.57      jmc      2939: characters.
1.676     nicm     2940: All arguments are sent sequentially from first to last.
                   2941: .Pp
1.273     nicm     2942: The
                   2943: .Fl l
1.676     nicm     2944: flag disables key name lookup and processes the keys as literal UTF-8
                   2945: characters.
                   2946: The
                   2947: .Fl H
                   2948: flag expects each key to be a hexadecimal number for an ASCII character.
                   2949: .Pp
1.265     nicm     2950: The
                   2951: .Fl R
                   2952: flag causes the terminal state to be reset.
1.419     nicm     2953: .Pp
                   2954: .Fl M
                   2955: passes through a mouse event (only valid if bound to a mouse key binding, see
1.420     jmc      2956: .Sx MOUSE SUPPORT ) .
1.497     nicm     2957: .Pp
                   2958: .Fl X
                   2959: is used to send a command into copy mode - see
                   2960: the
                   2961: .Sx WINDOWS AND PANES
                   2962: section.
                   2963: .Fl N
1.694     nicm     2964: specifies a repeat count and
                   2965: .Fl F
                   2966: expands formats in arguments where appropriate.
1.267     nicm     2967: .It Xo Ic send-prefix
                   2968: .Op Fl 2
                   2969: .Op Fl t Ar target-pane
                   2970: .Xc
                   2971: Send the prefix key, or with
                   2972: .Fl 2
                   2973: the secondary prefix key, to a window as if it was pressed.
1.57      jmc      2974: .It Xo Ic unbind-key
1.501     nicm     2975: .Op Fl an
1.421     nicm     2976: .Op Fl T Ar key-table
1.57      jmc      2977: .Ar key
1.2       nicm     2978: .Xc
1.57      jmc      2979: .D1 (alias: Ic unbind )
                   2980: Unbind the command bound to
                   2981: .Ar key .
1.530     nicm     2982: .Fl n
                   2983: and
1.421     nicm     2984: .Fl T
                   2985: are the same as for
                   2986: .Ic bind-key .
1.189     nicm     2987: If
                   2988: .Fl a
                   2989: is present, all key bindings are removed.
1.57      jmc      2990: .El
                   2991: .Sh OPTIONS
                   2992: The appearance and behaviour of
                   2993: .Nm
                   2994: may be modified by changing the value of various options.
1.668     nicm     2995: There are four types of option:
1.133     nicm     2996: .Em server options ,
1.57      jmc      2997: .Em session options
1.668     nicm     2998: .Em window options
1.57      jmc      2999: and
1.668     nicm     3000: .Em pane options .
1.57      jmc      3001: .Pp
1.133     nicm     3002: The
                   3003: .Nm
1.686     nicm     3004: server has a set of global server options which do not apply to any particular
1.668     nicm     3005: window or session or pane.
1.133     nicm     3006: These are altered with the
                   3007: .Ic set-option
                   3008: .Fl s
                   3009: command, or displayed with the
                   3010: .Ic show-options
                   3011: .Fl s
                   3012: command.
                   3013: .Pp
                   3014: In addition, each individual session may have a set of session options, and
                   3015: there is a separate set of global session options.
1.57      jmc      3016: Sessions which do not have a particular option configured inherit the value
                   3017: from the global session options.
                   3018: Session options are set or unset with the
                   3019: .Ic set-option
                   3020: command and may be listed with the
                   3021: .Ic show-options
                   3022: command.
1.133     nicm     3023: The available server and session options are listed under the
1.57      jmc      3024: .Ic set-option
                   3025: command.
                   3026: .Pp
1.668     nicm     3027: Similarly, a set of window options is attached to each window and a set of pane
                   3028: options to each pane.
                   3029: Pane options inherit from window options.
                   3030: This means any pane option may be set as a window option to apply the option to
                   3031: all panes in the window without the option set, for example these commands will
                   3032: set the background colour to red for all panes except pane 0:
                   3033: .Bd -literal -offset indent
                   3034: set -w window-style bg=red
                   3035: set -pt:.0 window-style bg=blue
                   3036: .Ed
                   3037: .Pp
                   3038: There is also a set of global window options from which any unset window or
                   3039: pane options are inherited.
                   3040: Window and pane options are altered with
                   3041: .Ic set-option
                   3042: .Fl w
                   3043: and
                   3044: .Fl p
                   3045: commands and displayed with
                   3046: .Ic show-option
                   3047: .Fl w
                   3048: and
                   3049: .Fl p .
1.318     nicm     3050: .Pp
                   3051: .Nm
                   3052: also supports user options which are prefixed with a
                   3053: .Ql \&@ .
1.321     jmc      3054: User options may have any name, so long as they are prefixed with
                   3055: .Ql \&@ ,
1.318     nicm     3056: and be set to any string.
1.418     nicm     3057: For example:
1.318     nicm     3058: .Bd -literal -offset indent
1.774   ! nicm     3059: $ tmux set -wq @foo "abc123"
        !          3060: $ tmux show -wv @foo
1.318     nicm     3061: abc123
                   3062: .Ed
1.57      jmc      3063: .Pp
                   3064: Commands which set options are as follows:
                   3065: .Bl -tag -width Ds
1.1       nicm     3066: .It Xo Ic set-option
1.668     nicm     3067: .Op Fl aFgopqsuw
                   3068: .Op Fl t Ar target-pane
1.1       nicm     3069: .Ar option Ar value
                   3070: .Xc
                   3071: .D1 (alias: Ic set )
1.668     nicm     3072: Set a pane option with
                   3073: .Fl p ,
                   3074: a window option with
                   3075: .Fl w ,
1.133     nicm     3076: a server option with
                   3077: .Fl s ,
                   3078: otherwise a session option.
1.637     nicm     3079: If the option is not a user option,
                   3080: .Fl w
1.668     nicm     3081: or
1.637     nicm     3082: .Fl s
1.668     nicm     3083: may be unnecessary -
1.637     nicm     3084: .Nm
1.668     nicm     3085: will infer the type from the option name, assuming
                   3086: .Fl w
                   3087: for pane options.
1.133     nicm     3088: If
                   3089: .Fl g
1.433     nicm     3090: is given, the global session or window option is set.
1.637     nicm     3091: .Pp
1.550     nicm     3092: .Fl F
                   3093: expands formats in the option value.
1.1       nicm     3094: The
                   3095: .Fl u
                   3096: flag unsets an option, so a session inherits the option from the global
1.433     nicm     3097: options (or with
                   3098: .Fl g ,
                   3099: restores a global option to the default).
1.336     nicm     3100: .Pp
                   3101: The
                   3102: .Fl o
1.446     nicm     3103: flag prevents setting an option that is already set and the
1.281     nicm     3104: .Fl q
1.446     nicm     3105: flag suppresses errors about unknown or ambiguous options.
1.281     nicm     3106: .Pp
1.378     nicm     3107: With
                   3108: .Fl a ,
                   3109: and if the option expects a string or a style,
                   3110: .Ar value
                   3111: is appended to the existing setting.
                   3112: For example:
                   3113: .Bd -literal -offset indent
                   3114: set -g status-left "foo"
                   3115: set -ag status-left "bar"
                   3116: .Ed
                   3117: .Pp
                   3118: Will result in
                   3119: .Ql foobar .
                   3120: And:
                   3121: .Bd -literal -offset indent
                   3122: set -g status-style "bg=red"
                   3123: set -ag status-style "fg=blue"
                   3124: .Ed
                   3125: .Pp
                   3126: Will result in a red background
                   3127: .Em and
                   3128: blue foreground.
                   3129: Without
                   3130: .Fl a ,
                   3131: the result would be the default background and a blue foreground.
1.668     nicm     3132: .It Xo Ic show-options
                   3133: .Op Fl AgHpqsvw
                   3134: .Op Fl t Ar target-pane
                   3135: .Op Ar option
                   3136: .Xc
                   3137: .D1 (alias: Ic show )
                   3138: Show the pane options (or a single option if
                   3139: .Ar option
                   3140: is provided) with
                   3141: .Fl p ,
                   3142: the window options with
                   3143: .Fl w ,
                   3144: the server options with
                   3145: .Fl s ,
                   3146: otherwise the session options.
                   3147: If the option is not a user option,
                   3148: .Fl w
                   3149: or
                   3150: .Fl s
                   3151: may be unnecessary -
                   3152: .Nm
                   3153: will infer the type from the option name, assuming
                   3154: .Fl w
                   3155: for pane options.
                   3156: Global session or window options are listed if
                   3157: .Fl g
                   3158: is used.
                   3159: .Fl v
                   3160: shows only the option value, not the name.
                   3161: If
                   3162: .Fl q
                   3163: is set, no error will be returned if
                   3164: .Ar option
                   3165: is unset.
                   3166: .Fl H
                   3167: includes hooks (omitted by default).
                   3168: .Fl A
                   3169: includes options inherited from a parent set of options, such options are
                   3170: marked with an asterisk.
1.274     nicm     3171: .Ar value
                   3172: depends on the option and may be a number, a string, or a flag (on, off, or
                   3173: omitted to toggle).
1.668     nicm     3174: .El
1.133     nicm     3175: .Pp
                   3176: Available server options are:
                   3177: .Bl -tag -width Ds
1.695     nicm     3178: .It Ic backspace Ar key
                   3179: Set the key sent by
                   3180: .Nm
                   3181: for backspace.
1.198     nicm     3182: .It Ic buffer-limit Ar number
                   3183: Set the number of buffers; as new buffers are added to the top of the stack,
                   3184: old ones are removed from the bottom if necessary to maintain this maximum
                   3185: length.
1.526     nicm     3186: .It Xo Ic command-alias[]
                   3187: .Ar name=value
                   3188: .Xc
                   3189: This is an array of custom aliases for commands.
                   3190: If an unknown command matches
                   3191: .Ar name ,
                   3192: it is replaced with
                   3193: .Ar value .
                   3194: For example, after:
                   3195: .Pp
1.565     nicm     3196: .Dl set -s command-alias[100] zoom='resize-pane -Z'
1.526     nicm     3197: .Pp
                   3198: Using:
                   3199: .Pp
                   3200: .Dl zoom -t:.1
                   3201: .Pp
                   3202: Is equivalent to:
                   3203: .Pp
                   3204: .Dl resize-pane -Z -t:.1
                   3205: .Pp
                   3206: Note that aliases are expanded when a command is parsed rather than when it is
                   3207: executed, so binding an alias with
                   3208: .Ic bind-key
                   3209: will bind the expanded form.
1.425     nicm     3210: .It Ic default-terminal Ar terminal
                   3211: Set the default terminal for new windows created in this session - the
                   3212: default value of the
                   3213: .Ev TERM
                   3214: environment variable.
                   3215: For
                   3216: .Nm
                   3217: to work correctly, this
                   3218: .Em must
                   3219: be set to
                   3220: .Ql screen ,
                   3221: .Ql tmux
                   3222: or a derivative of them.
1.742     nicm     3223: .It Ic copy-command Ar shell-command
                   3224: Give the command to pipe to if the
                   3225: .Ic copy-pipe
                   3226: copy mode command is used without arguments.
1.239     nicm     3227: .It Ic escape-time Ar time
                   3228: Set the time in milliseconds for which
                   3229: .Nm
                   3230: waits after an escape is input to determine if it is part of a function or meta
                   3231: key sequences.
                   3232: The default is 500 milliseconds.
1.759     nicm     3233: .It Ic editor Ar shell-command
                   3234: Set the command used when
                   3235: .Nm
                   3236: runs an editor.
1.592     nicm     3237: .It Xo Ic exit-empty
                   3238: .Op Ic on | off
                   3239: .Xc
                   3240: If enabled (the default), the server will exit when there are no active
                   3241: sessions.
1.239     nicm     3242: .It Xo Ic exit-unattached
                   3243: .Op Ic on | off
                   3244: .Xc
                   3245: If enabled, the server will exit when there are no attached clients.
1.772     nicm     3246: .It Xo Ic extended-keys
                   3247: .Op Ic on | off
                   3248: .Xc
                   3249: When enabled, extended keys are requested from the terminal and if supported
                   3250: are recognised by
                   3251: .Nm .
1.362     nicm     3252: .It Xo Ic focus-events
                   3253: .Op Ic on | off
                   3254: .Xc
                   3255: When enabled, focus events are requested from the terminal if supported and
                   3256: passed through to applications running in
                   3257: .Nm .
                   3258: Attached clients should be detached and attached again after changing this
                   3259: option.
1.445     nicm     3260: .It Ic history-file Ar path
                   3261: If not empty, a file to which
                   3262: .Nm
                   3263: will write command prompt history on exit and load it from on start.
1.384     nicm     3264: .It Ic message-limit Ar number
                   3265: Set the number of error or information messages to save in the message log for
                   3266: each client.
                   3267: The default is 100.
1.228     nicm     3268: .It Xo Ic set-clipboard
1.556     nicm     3269: .Op Ic on | external | off
1.228     nicm     3270: .Xc
                   3271: Attempt to set the terminal clipboard content using the
                   3272: .Xr xterm 1
1.560     nicm     3273: escape sequence, if there is an
1.228     nicm     3274: .Em \&Ms
                   3275: entry in the
                   3276: .Xr terminfo 5
1.560     nicm     3277: description (see the
                   3278: .Sx TERMINFO EXTENSIONS
                   3279: section).
                   3280: .Pp
1.556     nicm     3281: If set to
                   3282: .Ic on ,
                   3283: .Nm
                   3284: will both accept the escape sequence to create a buffer and attempt to set
                   3285: the terminal clipboard.
                   3286: If set to
                   3287: .Ic external ,
                   3288: .Nm
                   3289: will attempt to set the terminal clipboard but ignore attempts
                   3290: by applications to set
                   3291: .Nm
                   3292: buffers.
                   3293: If
                   3294: .Ic off ,
                   3295: .Nm
                   3296: will neither accept the clipboard escape sequence nor attempt to set the
                   3297: clipboard.
                   3298: .Pp
1.228     nicm     3299: Note that this feature needs to be enabled in
                   3300: .Xr xterm 1
                   3301: by setting the resource:
                   3302: .Bd -literal -offset indent
                   3303: disallowedWindowOps: 20,21,SetXprop
                   3304: .Ed
                   3305: .Pp
                   3306: Or changing this property from the
                   3307: .Xr xterm 1
                   3308: interactive menu when required.
1.744     nicm     3309: .It Ic terminal-features[] Ar string
                   3310: Set terminal features for terminal types read from
                   3311: .Xr terminfo 5 .
                   3312: .Nm
                   3313: has a set of named terminal features.
                   3314: Each will apply appropriate changes to the
                   3315: .Xr terminfo 5
                   3316: entry in use.
                   3317: .Pp
                   3318: .Nm
                   3319: can detect features for a few common terminals; this option can be used to
                   3320: easily tell tmux about features supported by terminals it cannot detect.
                   3321: The
                   3322: .Ic terminal-overrides
                   3323: option allows individual
                   3324: .Xr terminfo 5
                   3325: capabilities to be set instead,
                   3326: .Ic terminal-features
                   3327: is intended for classes of functionality supported in a standard way but not
                   3328: reported by
                   3329: .Xr terminfo 5 .
                   3330: Care must be taken only to configure this with features the terminal actually
                   3331: support.
                   3332: .Pp
                   3333: This is an array option where each entry is a colon-separated string made up
                   3334: of a terminal type pattern (matched using
                   3335: .Xr fnmatch 3 )
                   3336: followed by a list of terminal features.
                   3337: The available features are:
                   3338: .Bl -tag -width Ds
                   3339: .It 256
                   3340: Supports 256 colours with the SGR escape sequences.
                   3341: .It clipboard
                   3342: Allows setting the system clipboard.
                   3343: .It ccolour
                   3344: Allows setting the cursor colour.
                   3345: .It cstyle
                   3346: Allows setting the cursor style.
                   3347: .It margins
                   3348: Supports DECSLRM margins.
                   3349: .It overline
                   3350: Supports the overline SGR attribute.
                   3351: .It rectfill
                   3352: Supports the DECFRA rectangle fill escape sequence.
                   3353: .It RGB
                   3354: Supports RGB colour with the SGR escape sequences.
                   3355: .It sync
                   3356: Supports synchronized updates.
                   3357: .It title
                   3358: Supports
                   3359: .Xr xterm 1
                   3360: title setting.
                   3361: .It usstyle
                   3362: Allows underscore style and colour to be set.
                   3363: .It UTF-8
                   3364: Is able to handle UTF-8 output.
                   3365: .El
1.528     nicm     3366: .It Ic terminal-overrides[] Ar string
                   3367: Allow terminal descriptions read using
                   3368: .Xr terminfo 5
1.531     nicm     3369: to be overridden.
1.528     nicm     3370: Each entry is a colon-separated string made up of a terminal type pattern
                   3371: (matched using
1.381     nicm     3372: .Xr fnmatch 3 )
                   3373: and a set of
                   3374: .Em name=value
                   3375: entries.
                   3376: .Pp
                   3377: For example, to set the
                   3378: .Ql clear
                   3379: .Xr terminfo 5
                   3380: entry to
                   3381: .Ql \ee[H\ee[2J
1.528     nicm     3382: for all terminal types matching
                   3383: .Ql rxvt* :
                   3384: .Pp
                   3385: .Dl "rxvt*:clear=\ee[H\ee[2J"
1.381     nicm     3386: .Pp
                   3387: The terminal entry value is passed through
                   3388: .Xr strunvis 3
                   3389: before interpretation.
1.678     nicm     3390: .It Ic user-keys[] Ar key
                   3391: Set list of user-defined key escape sequences.
                   3392: Each item is associated with a key named
                   3393: .Ql User0 ,
                   3394: .Ql User1 ,
                   3395: and so on.
                   3396: .Pp
                   3397: For example:
                   3398: .Bd -literal -offset indent
                   3399: set -s user-keys[0] "\ee[5;30012~"
                   3400: bind User0 resize-pane -L 3
                   3401: .Ed
1.133     nicm     3402: .El
1.129     nicm     3403: .Pp
1.18      nicm     3404: Available session options are:
1.1       nicm     3405: .Bl -tag -width Ds
1.569     nicm     3406: .It Xo Ic activity-action
                   3407: .Op Ic any | none | current | other
                   3408: .Xc
                   3409: Set action on window activity when
                   3410: .Ic monitor-activity
                   3411: is on.
                   3412: .Ic any
                   3413: means activity in any window linked to a session causes a bell or message
                   3414: (depending on
                   3415: .Ic visual-activity )
                   3416: in the current window of that session,
                   3417: .Ic none
                   3418: means all activity is ignored (equivalent to
                   3419: .Ic monitor-activity
                   3420: being off),
                   3421: .Ic current
                   3422: means only activity in windows other than the current window are ignored and
                   3423: .Ic other
                   3424: means activity in the current window is ignored but not those in other windows.
1.312     nicm     3425: .It Ic assume-paste-time Ar milliseconds
                   3426: If keys are entered faster than one in
                   3427: .Ar milliseconds ,
                   3428: they are assumed to have been pasted rather than typed and
                   3429: .Nm
                   3430: key bindings are not processed.
                   3431: The default is one millisecond and zero disables.
1.69      nicm     3432: .It Ic base-index Ar index
                   3433: Set the base index from which an unused index should be searched when a new
                   3434: window is created.
                   3435: The default is zero.
1.1       nicm     3436: .It Xo Ic bell-action
1.429     nicm     3437: .Op Ic any | none | current | other
1.1       nicm     3438: .Xc
1.574     nicm     3439: Set action on a bell in a window when
                   3440: .Ic monitor-bell
                   3441: is on.
1.569     nicm     3442: The values are the same as those for
                   3443: .Ic activity-action .
1.153     nicm     3444: .It Ic default-command Ar shell-command
1.1       nicm     3445: Set the command used for new windows (if not specified when the window is
                   3446: created) to
1.153     nicm     3447: .Ar shell-command ,
1.79      nicm     3448: which may be any
                   3449: .Xr sh 1
                   3450: command.
1.19      nicm     3451: The default is an empty string, which instructs
                   3452: .Nm
1.79      nicm     3453: to create a login shell using the value of the
                   3454: .Ic default-shell
                   3455: option.
                   3456: .It Ic default-shell Ar path
                   3457: Specify the default shell.
                   3458: This is used as the login shell for new windows when the
                   3459: .Ic default-command
                   3460: option is set to empty, and must be the full path of the executable.
                   3461: When started
                   3462: .Nm
                   3463: tries to set a default value from the first suitable of the
1.19      nicm     3464: .Ev SHELL
1.79      nicm     3465: environment variable, the shell returned by
                   3466: .Xr getpwuid 3 ,
                   3467: or
                   3468: .Pa /bin/sh .
                   3469: This option should be configured when
                   3470: .Nm
                   3471: is used as a login shell.
1.629     nicm     3472: .It Ic default-size Ar XxY
1.642     nicm     3473: Set the default size of new windows when the
1.643     nicm     3474: .Ic window-size
1.642     nicm     3475: option is set to manual or when a session is created with
                   3476: .Ic new-session
                   3477: .Fl d .
                   3478: The value is the width and height separated by an
                   3479: .Ql x
                   3480: character.
                   3481: The default is 80x24.
1.206     nicm     3482: .It Xo Ic destroy-unattached
                   3483: .Op Ic on | off
                   3484: .Xc
1.185     nicm     3485: If enabled and the session is no longer attached to any clients, it is
                   3486: destroyed.
1.206     nicm     3487: .It Xo Ic detach-on-destroy
                   3488: .Op Ic on | off
                   3489: .Xc
1.184     nicm     3490: If on (the default), the client is detached when the session it is attached to
                   3491: is destroyed.
                   3492: If off, the client is switched to the most recently active of the remaining
                   3493: sessions.
1.145     nicm     3494: .It Ic display-panes-active-colour Ar colour
                   3495: Set the colour used by the
                   3496: .Ic display-panes
                   3497: command to show the indicator for the active pane.
1.78      nicm     3498: .It Ic display-panes-colour Ar colour
1.145     nicm     3499: Set the colour used by the
1.78      nicm     3500: .Ic display-panes
1.145     nicm     3501: command to show the indicators for inactive panes.
1.78      nicm     3502: .It Ic display-panes-time Ar time
                   3503: Set the time in milliseconds for which the indicators shown by the
                   3504: .Ic display-panes
                   3505: command appear.
1.21      nicm     3506: .It Ic display-time Ar time
1.78      nicm     3507: Set the amount of time for which status line messages and other on-screen
                   3508: indicators are displayed.
1.462     tim      3509: If set to 0, messages and indicators are displayed until a key is pressed.
1.21      nicm     3510: .Ar time
                   3511: is in milliseconds.
1.1       nicm     3512: .It Ic history-limit Ar lines
                   3513: Set the maximum number of lines held in window history.
                   3514: This setting applies only to new windows - existing window histories are not
                   3515: resized and retain the limit at the point they were created.
1.474     nicm     3516: .It Ic key-table Ar key-table
                   3517: Set the default key table to
                   3518: .Ar key-table
                   3519: instead of
                   3520: .Em root .
1.1       nicm     3521: .It Ic lock-after-time Ar number
1.100     nicm     3522: Lock the session (like the
                   3523: .Ic lock-session
1.90      nicm     3524: command) after
1.1       nicm     3525: .Ar number
1.448     nicm     3526: seconds of inactivity.
1.100     nicm     3527: The default is not to lock (set to 0).
1.153     nicm     3528: .It Ic lock-command Ar shell-command
1.90      nicm     3529: Command to run when locking each client.
                   3530: The default is to run
                   3531: .Xr lock 1
                   3532: with
                   3533: .Fl np .
1.378     nicm     3534: .It Ic message-command-style Ar style
1.623     nicm     3535: Set status line message command style.
1.737     nicm     3536: This is used for the command prompt with
                   3537: .Xr vi 1
                   3538: keys when in command mode.
1.623     nicm     3539: For how to specify
                   3540: .Ar style ,
                   3541: see the
                   3542: .Sx STYLES
                   3543: section.
1.378     nicm     3544: .It Ic message-style Ar style
                   3545: Set status line message style.
1.737     nicm     3546: This is used for messages and for the command prompt.
1.378     nicm     3547: For how to specify
                   3548: .Ar style ,
                   3549: see the
1.623     nicm     3550: .Sx STYLES
                   3551: section.
1.419     nicm     3552: .It Xo Ic mouse
1.226     nicm     3553: .Op Ic on | off
                   3554: .Xc
                   3555: If on,
                   3556: .Nm
1.419     nicm     3557: captures the mouse and allows mouse events to be bound as key bindings.
                   3558: See the
                   3559: .Sx MOUSE SUPPORT
                   3560: section for details.
1.267     nicm     3561: .It Ic prefix Ar key
                   3562: Set the key accepted as a prefix key.
1.473     nicm     3563: In addition to the standard keys described under
                   3564: .Sx KEY BINDINGS ,
                   3565: .Ic prefix
                   3566: can be set to the special key
                   3567: .Ql None
                   3568: to set no prefix.
1.267     nicm     3569: .It Ic prefix2 Ar key
                   3570: Set a secondary key accepted as a prefix key.
1.473     nicm     3571: Like
                   3572: .Ic prefix ,
                   3573: .Ic prefix2
                   3574: can be set to
                   3575: .Ql None .
1.291     nicm     3576: .It Xo Ic renumber-windows
                   3577: .Op Ic on | off
                   3578: .Xc
                   3579: If on, when a window is closed in a session, automatically renumber the other
                   3580: windows in numerical order.
                   3581: This respects the
                   3582: .Ic base-index
                   3583: option if it has been set.
                   3584: If off, do not renumber the windows.
1.21      nicm     3585: .It Ic repeat-time Ar time
1.1       nicm     3586: Allow multiple commands to be entered without pressing the prefix-key again
                   3587: in the specified
1.21      nicm     3588: .Ar time
1.1       nicm     3589: milliseconds (the default is 500).
                   3590: Whether a key repeats may be set when it is bound using the
                   3591: .Fl r
                   3592: flag to
                   3593: .Ic bind-key .
1.52      nicm     3594: Repeat is enabled for the default keys bound to the
                   3595: .Ic resize-pane
                   3596: command.
1.1       nicm     3597: .It Xo Ic set-titles
1.56      jmc      3598: .Op Ic on | off
1.1       nicm     3599: .Xc
1.261     nicm     3600: Attempt to set the client terminal title using the
                   3601: .Em tsl
                   3602: and
                   3603: .Em fsl
                   3604: .Xr terminfo 5
                   3605: entries if they exist.
                   3606: .Nm
1.444     nicm     3607: automatically sets these to the \ee]0;...\e007 sequence if
                   3608: the terminal appears to be
                   3609: .Xr xterm 1 .
1.11      nicm     3610: This option is off by default.
1.86      nicm     3611: .It Ic set-titles-string Ar string
1.678     nicm     3612: String used to set the client terminal title if
1.86      nicm     3613: .Ic set-titles
                   3614: is on.
1.414     nicm     3615: Formats are expanded, see the
                   3616: .Sx FORMATS
                   3617: section.
1.569     nicm     3618: .It Xo Ic silence-action
                   3619: .Op Ic any | none | current | other
                   3620: .Xc
                   3621: Set action on window silence when
                   3622: .Ic monitor-silence
                   3623: is on.
                   3624: The values are the same as those for
                   3625: .Ic activity-action .
1.1       nicm     3626: .It Xo Ic status
1.625     nicm     3627: .Op Ic off | on | 2 | 3 | 4 | 5
1.1       nicm     3628: .Xc
1.625     nicm     3629: Show or hide the status line or specify its size.
                   3630: Using
                   3631: .Ic on
                   3632: gives a status line one row in height;
                   3633: .Ic 2 ,
                   3634: .Ic 3 ,
                   3635: .Ic 4
                   3636: or
                   3637: .Ic 5
                   3638: more rows.
                   3639: .It Ic status-format[] Ar format
                   3640: Specify the format to be used for each line of the status line.
                   3641: The default builds the top status line from the various individual status
                   3642: options below.
1.1       nicm     3643: .It Ic status-interval Ar interval
1.538     nicm     3644: Update the status line every
1.1       nicm     3645: .Ar interval
                   3646: seconds.
                   3647: By default, updates will occur every 15 seconds.
                   3648: A setting of zero disables redrawing at interval.
1.41      nicm     3649: .It Xo Ic status-justify
1.56      jmc      3650: .Op Ic left | centre | right
1.41      nicm     3651: .Xc
                   3652: Set the position of the window list component of the status line: left, centre
                   3653: or right justified.
1.1       nicm     3654: .It Xo Ic status-keys
1.56      jmc      3655: .Op Ic vi | emacs
1.1       nicm     3656: .Xc
1.6       jmc      3657: Use vi or emacs-style
1.1       nicm     3658: key bindings in the status line, for example at the command prompt.
1.191     nicm     3659: The default is emacs, unless the
                   3660: .Ev VISUAL
                   3661: or
                   3662: .Ev EDITOR
                   3663: environment variables are set and contain the string
                   3664: .Ql vi .
1.1       nicm     3665: .It Ic status-left Ar string
                   3666: Display
                   3667: .Ar string
1.538     nicm     3668: (by default the session name) to the left of the status line.
1.1       nicm     3669: .Ar string
                   3670: will be passed through
1.623     nicm     3671: .Xr strftime 3 .
                   3672: Also see the
                   3673: .Sx FORMATS
                   3674: and
                   3675: .Sx STYLES
                   3676: sections.
1.83      nicm     3677: .Pp
1.263     nicm     3678: For details on how the names and titles can be set see the
1.261     nicm     3679: .Sx "NAMES AND TITLES"
                   3680: section.
1.109     nicm     3681: .Pp
1.83      nicm     3682: Examples are:
                   3683: .Bd -literal -offset indent
                   3684: #(sysctl vm.loadavg)
                   3685: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
                   3686: .Ed
1.10      nicm     3687: .Pp
1.405     nicm     3688: The default is
                   3689: .Ql "[#S] " .
1.1       nicm     3690: .It Ic status-left-length Ar length
                   3691: Set the maximum
                   3692: .Ar length
1.538     nicm     3693: of the left component of the status line.
1.1       nicm     3694: The default is 10.
1.378     nicm     3695: .It Ic status-left-style Ar style
                   3696: Set the style of the left part of the status line.
                   3697: For how to specify
                   3698: .Ar style ,
                   3699: see the
1.623     nicm     3700: .Sx STYLES
                   3701: section.
1.269     nicm     3702: .It Xo Ic status-position
                   3703: .Op Ic top | bottom
                   3704: .Xc
                   3705: Set the position of the status line.
1.1       nicm     3706: .It Ic status-right Ar string
                   3707: Display
                   3708: .Ar string
1.538     nicm     3709: to the right of the status line.
1.577     nicm     3710: By default, the current pane title in double quotes, the date and the time
1.151     nicm     3711: are shown.
1.1       nicm     3712: As with
                   3713: .Ic status-left ,
                   3714: .Ar string
                   3715: will be passed to
1.459     jmc      3716: .Xr strftime 3
                   3717: and character pairs are replaced.
1.1       nicm     3718: .It Ic status-right-length Ar length
                   3719: Set the maximum
                   3720: .Ar length
1.538     nicm     3721: of the right component of the status line.
1.1       nicm     3722: The default is 40.
1.378     nicm     3723: .It Ic status-right-style Ar style
                   3724: Set the style of the right part of the status line.
                   3725: For how to specify
                   3726: .Ar style ,
                   3727: see the
1.623     nicm     3728: .Sx STYLES
                   3729: section.
1.378     nicm     3730: .It Ic status-style Ar style
                   3731: Set status line style.
                   3732: For how to specify
                   3733: .Ar style ,
                   3734: see the
1.623     nicm     3735: .Sx STYLES
                   3736: section.
1.529     nicm     3737: .It Ic update-environment[] Ar variable
                   3738: Set list of environment variables to be copied into the session environment
                   3739: when a new session is created or an existing session is attached.
1.63      nicm     3740: Any variables that do not exist in the source environment are set to be
                   3741: removed from the session environment (as if
                   3742: .Fl r
                   3743: was given to the
                   3744: .Ic set-environment
                   3745: command).
1.37      nicm     3746: .It Xo Ic visual-activity
1.569     nicm     3747: .Op Ic on | off | both
1.37      nicm     3748: .Xc
1.569     nicm     3749: If on, display a message instead of sending a bell when activity occurs in a
                   3750: window for which the
1.37      nicm     3751: .Ic monitor-activity
                   3752: window option is enabled.
1.569     nicm     3753: If set to both, a bell and a message are produced.
1.37      nicm     3754: .It Xo Ic visual-bell
1.569     nicm     3755: .Op Ic on | off | both
1.37      nicm     3756: .Xc
1.574     nicm     3757: If on, a message is shown on a bell in a window for which the
                   3758: .Ic monitor-bell
                   3759: window option is enabled instead of it being passed through to the
1.569     nicm     3760: terminal (which normally makes a sound).
                   3761: If set to both, a bell and a message are produced.
1.37      nicm     3762: Also see the
                   3763: .Ic bell-action
                   3764: option.
1.192     nicm     3765: .It Xo Ic visual-silence
1.569     nicm     3766: .Op Ic on | off | both
1.192     nicm     3767: .Xc
                   3768: If
                   3769: .Ic monitor-silence
1.569     nicm     3770: is enabled, prints a message after the interval has expired on a given window
                   3771: instead of sending a bell.
                   3772: If set to both, a bell and a message are produced.
1.255     nicm     3773: .It Ic word-separators Ar string
                   3774: Sets the session's conception of what characters are considered word
                   3775: separators, for the purposes of the next and previous word commands in
                   3776: copy mode.
                   3777: The default is
                   3778: .Ql \ -_@ .
1.1       nicm     3779: .El
                   3780: .Pp
1.668     nicm     3781: Available window options are:
1.56      jmc      3782: .Pp
                   3783: .Bl -tag -width Ds -compact
1.1       nicm     3784: .It Xo Ic aggressive-resize
1.56      jmc      3785: .Op Ic on | off
1.1       nicm     3786: .Xc
                   3787: Aggressively resize the chosen window.
                   3788: This means that
                   3789: .Nm
1.642     nicm     3790: will resize the window to the size of the smallest or largest session
                   3791: (see the
                   3792: .Ic window-size
                   3793: option) for which it is the current window, rather than the session to
                   3794: which it is attached.
                   3795: The window may resize when the current window is changed on another
                   3796: session; this option is good for full-screen programs which support
1.6       jmc      3797: .Dv SIGWINCH
                   3798: and poor for interactive programs such as shells.
1.262     nicm     3799: .Pp
1.1       nicm     3800: .It Xo Ic automatic-rename
1.56      jmc      3801: .Op Ic on | off
1.1       nicm     3802: .Xc
                   3803: Control automatic window renaming.
                   3804: When this setting is enabled,
                   3805: .Nm
1.368     nicm     3806: will rename the window automatically using the format specified by
                   3807: .Ic automatic-rename-format .
1.1       nicm     3808: This flag is automatically disabled for an individual window when a name
                   3809: is specified at creation with
1.186     nicm     3810: .Ic new-window
                   3811: or
1.1       nicm     3812: .Ic new-session ,
                   3813: or later with
1.261     nicm     3814: .Ic rename-window ,
                   3815: or with a terminal escape sequence.
1.1       nicm     3816: It may be switched off globally with:
                   3817: .Bd -literal -offset indent
1.668     nicm     3818: set-option -wg automatic-rename off
1.1       nicm     3819: .Ed
1.368     nicm     3820: .Pp
                   3821: .It Ic automatic-rename-format Ar format
                   3822: The format (see
                   3823: .Sx FORMATS )
                   3824: used when the
                   3825: .Ic automatic-rename
                   3826: option is enabled.
1.56      jmc      3827: .Pp
1.1       nicm     3828: .It Ic clock-mode-colour Ar colour
                   3829: Set clock colour.
1.56      jmc      3830: .Pp
1.1       nicm     3831: .It Xo Ic clock-mode-style
1.56      jmc      3832: .Op Ic 12 | 24
1.1       nicm     3833: .Xc
                   3834: Set clock hour format.
1.56      jmc      3835: .Pp
1.196     nicm     3836: .It Ic main-pane-height Ar height
1.2       nicm     3837: .It Ic main-pane-width Ar width
                   3838: Set the width or height of the main (left or top) pane in the
                   3839: .Ic main-horizontal
                   3840: or
                   3841: .Ic main-vertical
                   3842: layouts.
1.747     nicm     3843: If suffixed by
                   3844: .Ql % ,
                   3845: this is a percentage of the window size.
1.757     nicm     3846: .Pp
                   3847: .It Ic copy-mode-match-style Ar style
                   3848: Set the style of search matches in copy mode.
1.768     nicm     3849: For how to specify
                   3850: .Ar style ,
                   3851: see the
                   3852: .Sx STYLES
                   3853: section.
                   3854: .Pp
                   3855: .It Ic copy-mode-mark-style Ar style
                   3856: Set the style of the line containing the mark in copy mode.
1.757     nicm     3857: For how to specify
                   3858: .Ar style ,
                   3859: see the
                   3860: .Sx STYLES
                   3861: section.
                   3862: .Pp
                   3863: .It Ic copy-mode-current-match-style Ar style
                   3864: Set the style of the current search match in copy mode.
                   3865: For how to specify
                   3866: .Ar style ,
                   3867: see the
                   3868: .Sx STYLES
                   3869: section.
1.56      jmc      3870: .Pp
1.1       nicm     3871: .It Xo Ic mode-keys
1.56      jmc      3872: .Op Ic vi | emacs
1.1       nicm     3873: .Xc
1.500     nicm     3874: Use vi or emacs-style key bindings in copy mode.
                   3875: The default is emacs, unless
1.191     nicm     3876: .Ev VISUAL
                   3877: or
                   3878: .Ev EDITOR
                   3879: contains
                   3880: .Ql vi .
1.56      jmc      3881: .Pp
1.378     nicm     3882: .It Ic mode-style Ar style
                   3883: Set window modes style.
                   3884: For how to specify
                   3885: .Ar style ,
                   3886: see the
1.623     nicm     3887: .Sx STYLES
                   3888: section.
1.378     nicm     3889: .Pp
1.1       nicm     3890: .It Xo Ic monitor-activity
1.56      jmc      3891: .Op Ic on | off
1.1       nicm     3892: .Xc
                   3893: Monitor for activity in the window.
                   3894: Windows with activity are highlighted in the status line.
1.56      jmc      3895: .Pp
1.574     nicm     3896: .It Xo Ic monitor-bell
                   3897: .Op Ic on | off
                   3898: .Xc
                   3899: Monitor for a bell in the window.
                   3900: Windows with a bell are highlighted in the status line.
                   3901: .Pp
1.192     nicm     3902: .It Xo Ic monitor-silence
                   3903: .Op Ic interval
                   3904: .Xc
                   3905: Monitor for silence (no activity) in the window within
                   3906: .Ic interval
                   3907: seconds.
                   3908: Windows that have been silent for the interval are highlighted in the
                   3909: status line.
                   3910: An interval of zero disables the monitoring.
1.195     nicm     3911: .Pp
                   3912: .It Ic other-pane-height Ar height
                   3913: Set the height of the other panes (not the main pane) in the
                   3914: .Ic main-horizontal
                   3915: layout.
                   3916: If this option is set to 0 (the default), it will have no effect.
                   3917: If both the
                   3918: .Ic main-pane-height
                   3919: and
                   3920: .Ic other-pane-height
                   3921: options are set, the main pane will grow taller to make the other panes the
                   3922: specified height, but will never shrink to do so.
1.747     nicm     3923: If suffixed by
                   3924: .Ql % ,
                   3925: this is a percentage of the window size.
1.195     nicm     3926: .Pp
                   3927: .It Ic other-pane-width Ar width
                   3928: Like
                   3929: .Ic other-pane-height ,
                   3930: but set the width of other panes in the
                   3931: .Ic main-vertical
                   3932: layout.
1.243     nicm     3933: .Pp
1.413     nicm     3934: .It Ic pane-active-border-style Ar style
                   3935: Set the pane border style for the currently active pane.
                   3936: For how to specify
                   3937: .Ar style ,
                   3938: see the
1.623     nicm     3939: .Sx STYLES
                   3940: section.
1.413     nicm     3941: Attributes are ignored.
                   3942: .Pp
1.243     nicm     3943: .It Ic pane-base-index Ar index
                   3944: Like
                   3945: .Ic base-index ,
                   3946: but set the starting index for pane numbers.
1.484     nicm     3947: .Pp
                   3948: .It Ic pane-border-format Ar format
                   3949: Set the text shown in pane border status lines.
1.770     nicm     3950: .Pp
                   3951: .It Ic pane-border-lines Ar type
                   3952: Set the type of characters used for drawing pane borders.
                   3953: .Ar type
                   3954: may be one of:
                   3955: .Bl -tag -width Ds
                   3956: .It single
                   3957: single lines using ACS or UTF-8 characters
                   3958: .It double
                   3959: double lines using UTF-8 characters
                   3960: .It heavy
                   3961: heavy lines using UTF-8 characters
                   3962: .It simple
                   3963: simple ASCII characters
                   3964: .It number
                   3965: the pane number
                   3966: .El
                   3967: .Pp
                   3968: .Ql double
                   3969: and
                   3970: .Ql heavy
                   3971: will fall back to standard ACS line drawing when UTF-8 is not supported.
1.484     nicm     3972: .Pp
                   3973: .It Xo Ic pane-border-status
                   3974: .Op Ic off | top | bottom
                   3975: .Xc
                   3976: Turn pane border status lines off or set their position.
1.413     nicm     3977: .Pp
                   3978: .It Ic pane-border-style Ar style
                   3979: Set the pane border style for panes aside from the active pane.
                   3980: For how to specify
                   3981: .Ar style ,
                   3982: see the
1.623     nicm     3983: .Sx STYLES
                   3984: section.
1.413     nicm     3985: Attributes are ignored.
1.192     nicm     3986: .Pp
1.99      nicm     3987: .It Xo Ic synchronize-panes
                   3988: .Op Ic on | off
                   3989: .Xc
1.164     nicm     3990: Duplicate input to any pane to all other panes in the same window (only
                   3991: for panes that are not in any special mode).
1.56      jmc      3992: .Pp
1.378     nicm     3993: .It Ic window-status-activity-style Ar style
                   3994: Set status line style for windows with an activity alert.
                   3995: For how to specify
                   3996: .Ar style ,
                   3997: see the
1.623     nicm     3998: .Sx STYLES
                   3999: section.
1.169     nicm     4000: .Pp
1.378     nicm     4001: .It Ic window-status-bell-style Ar style
                   4002: Set status line style for windows with a bell alert.
                   4003: For how to specify
                   4004: .Ar style ,
                   4005: see the
1.623     nicm     4006: .Sx STYLES
                   4007: section.
1.169     nicm     4008: .Pp
1.125     nicm     4009: .It Ic window-status-current-format Ar string
                   4010: Like
                   4011: .Ar window-status-format ,
                   4012: but is the format used when the window is the current window.
1.307     nicm     4013: .Pp
1.378     nicm     4014: .It Ic window-status-current-style Ar style
                   4015: Set status line style for the currently active window.
                   4016: For how to specify
                   4017: .Ar style ,
                   4018: see the
1.623     nicm     4019: .Sx STYLES
                   4020: section.
1.239     nicm     4021: .Pp
                   4022: .It Ic window-status-format Ar string
                   4023: Set the format in which the window is displayed in the status line window list.
                   4024: See the
1.623     nicm     4025: .Sx FORMATS
                   4026: and
                   4027: .Sx STYLES
                   4028: sections.
1.290     nicm     4029: .Pp
1.378     nicm     4030: .It Ic window-status-last-style Ar style
                   4031: Set status line style for the last active window.
                   4032: For how to specify
                   4033: .Ar style ,
                   4034: see the
1.623     nicm     4035: .Sx STYLES
                   4036: section.
1.378     nicm     4037: .Pp
1.290     nicm     4038: .It Ic window-status-separator Ar string
                   4039: Sets the separator drawn between windows in the status line.
                   4040: The default is a single space character.
1.125     nicm     4041: .Pp
1.378     nicm     4042: .It Ic window-status-style Ar style
                   4043: Set status line style for a single window.
1.418     nicm     4044: For how to specify
                   4045: .Ar style ,
                   4046: see the
1.623     nicm     4047: .Sx STYLES
                   4048: section.
1.418     nicm     4049: .Pp
1.642     nicm     4050: .It Xo Ic window-size
1.689     nicm     4051: .Ar largest | Ar smallest | Ar manual | Ar latest
1.642     nicm     4052: .Xc
                   4053: Configure how
                   4054: .Nm
                   4055: determines the window size.
                   4056: If set to
                   4057: .Ar largest ,
                   4058: the size of the largest attached session is used; if
                   4059: .Ar smallest ,
                   4060: the size of the smallest.
                   4061: If
                   4062: .Ar manual ,
                   4063: the size of a new window is set from the
                   4064: .Ic default-size
                   4065: option and windows are resized automatically.
1.689     nicm     4066: With
                   4067: .Ar latest ,
                   4068: .Nm
                   4069: uses the size of the client that had the most recent activity.
1.642     nicm     4070: See also the
                   4071: .Ic resize-window
                   4072: command and the
                   4073: .Ic aggressive-resize
                   4074: option.
                   4075: .Pp
1.512     nicm     4076: .It Xo Ic wrap-search
                   4077: .Op Ic on | off
                   4078: .Xc
                   4079: If this option is set, searches will wrap around the end of the pane contents.
                   4080: The default is on.
1.57      jmc      4081: .El
1.668     nicm     4082: .Pp
                   4083: Available pane options are:
                   4084: .Pp
                   4085: .Bl -tag -width Ds -compact
1.669     nicm     4086: .It Xo Ic allow-rename
                   4087: .Op Ic on | off
                   4088: .Xc
                   4089: Allow programs in the pane to change the window name using a terminal escape
                   4090: sequence (\eek...\ee\e\e).
                   4091: .Pp
                   4092: .It Xo Ic alternate-screen
                   4093: .Op Ic on | off
                   4094: .Xc
                   4095: This option configures whether programs running inside the pane may use the
                   4096: terminal alternate screen feature, which allows the
                   4097: .Em smcup
                   4098: and
                   4099: .Em rmcup
                   4100: .Xr terminfo 5
                   4101: capabilities.
                   4102: The alternate screen feature preserves the contents of the window when an
                   4103: interactive application starts and restores it on exit, so that any output
                   4104: visible before the application starts reappears unchanged after it exits.
                   4105: .Pp
1.668     nicm     4106: .It Xo Ic remain-on-exit
                   4107: .Op Ic on | off
1.57      jmc      4108: .Xc
1.668     nicm     4109: A pane with this flag set is not destroyed when the program running in it
                   4110: exits.
                   4111: The pane may be reactivated with the
                   4112: .Ic respawn-pane
                   4113: command.
                   4114: .Pp
                   4115: .It Ic window-active-style Ar style
                   4116: Set the pane style when it is the active pane.
                   4117: For how to specify
                   4118: .Ar style ,
                   4119: see the
                   4120: .Sx STYLES
                   4121: section.
                   4122: .Pp
                   4123: .It Ic window-style Ar style
                   4124: Set the pane style.
                   4125: For how to specify
                   4126: .Ar style ,
                   4127: see the
                   4128: .Sx STYLES
                   4129: section.
1.63      nicm     4130: .El
1.469     nicm     4131: .Sh HOOKS
                   4132: .Nm
                   4133: allows commands to run on various triggers, called
                   4134: .Em hooks .
1.505     nicm     4135: Most
1.483     nicm     4136: .Nm
1.505     nicm     4137: commands have an
1.483     nicm     4138: .Em after
                   4139: hook and there are a number of hooks not associated with commands.
                   4140: .Pp
1.640     nicm     4141: Hooks are stored as array options, members of the array are executed in
                   4142: order when the hook is triggered.
1.740     nicm     4143: Like options different hooks may be global or belong to a session, window or pane.
1.640     nicm     4144: Hooks may be configured with the
                   4145: .Ic set-hook
                   4146: or
                   4147: .Ic set-option
                   4148: commands and displayed with
                   4149: .Ic show-hooks
                   4150: or
                   4151: .Ic show-options
                   4152: .Fl H .
                   4153: The following two commands are equivalent:
                   4154: .Bd -literal -offset indent.
                   4155: set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red'
                   4156: set-option -g pane-mode-changed[42] 'set -g status-left-style bg=red'
                   4157: .Ed
                   4158: .Pp
                   4159: Setting a hook without specifying an array index clears the hook and sets the
                   4160: first member of the array.
                   4161: .Pp
1.505     nicm     4162: A command's after
                   4163: hook is run after it completes, except when the command is run as part of a hook
1.483     nicm     4164: itself.
1.505     nicm     4165: They are named with an
1.483     nicm     4166: .Ql after-
                   4167: prefix.
                   4168: For example, the following command adds a hook to select the even-vertical
                   4169: layout after every
                   4170: .Ic split-window :
                   4171: .Bd -literal -offset indent
1.640     nicm     4172: set-hook -g after-split-window "selectl even-vertical"
1.483     nicm     4173: .Ed
                   4174: .Pp
1.584     nicm     4175: All the notifications listed in the
                   4176: .Sx CONTROL MODE
                   4177: section are hooks (without any arguments), except
                   4178: .Ic %exit .
                   4179: The following additional hooks are available:
1.560     nicm     4180: .Bl -tag -width "XXXXXXXXXXXXXXXXXXXXXX"
1.476     nicm     4181: .It alert-activity
                   4182: Run when a window has activity.
                   4183: See
                   4184: .Ic monitor-activity .
                   4185: .It alert-bell
                   4186: Run when a window has received a bell.
1.574     nicm     4187: See
                   4188: .Ic monitor-bell .
1.476     nicm     4189: .It alert-silence
                   4190: Run when a window has been silent.
                   4191: See
                   4192: .Ic monitor-silence .
1.469     nicm     4193: .It client-attached
                   4194: Run when a client is attached.
                   4195: .It client-detached
                   4196: Run when a client is detached
                   4197: .It client-resized
                   4198: Run when a client is resized.
1.511     nicm     4199: .It client-session-changed
                   4200: Run when a client's attached session is changed.
1.475     nicm     4201: .It pane-died
                   4202: Run when the program running in a pane exits, but
                   4203: .Ic remain-on-exit
                   4204: is on so the pane has not closed.
                   4205: .It pane-exited
                   4206: Run when the program running in a pane exits.
1.603     nicm     4207: .It pane-focus-in
                   4208: Run when the focus enters a pane, if the
                   4209: .Ic focus-events
                   4210: option is on.
                   4211: .It pane-focus-out
                   4212: Run when the focus exits a pane, if the
                   4213: .Ic focus-events
                   4214: option is on.
1.560     nicm     4215: .It pane-set-clipboard
                   4216: Run when the terminal clipboard is set using the
                   4217: .Xr xterm 1
                   4218: escape sequence.
1.510     nicm     4219: .It session-created
                   4220: Run when a new session created.
                   4221: .It session-closed
                   4222: Run when a session closed.
1.507     nicm     4223: .It session-renamed
                   4224: Run when a session is renamed.
1.511     nicm     4225: .It window-linked
                   4226: Run when a window is linked into a session.
1.507     nicm     4227: .It window-renamed
                   4228: Run when a window is renamed.
1.511     nicm     4229: .It window-unlinked
                   4230: Run when a window is unlinked from a session.
1.469     nicm     4231: .El
                   4232: .Pp
                   4233: Hooks are managed with these commands:
                   4234: .Bl -tag -width Ds
                   4235: .It Xo Ic set-hook
1.740     nicm     4236: .Op Fl agpRuw
                   4237: .Op Fl t Ar target-pane
1.469     nicm     4238: .Ar hook-name
                   4239: .Ar command
                   4240: .Xc
1.604     nicm     4241: Without
1.605     jmc      4242: .Fl R ,
1.604     nicm     4243: sets (or with
1.496     nicm     4244: .Fl u
                   4245: unsets) hook
1.469     nicm     4246: .Ar hook-name
                   4247: to
                   4248: .Ar command .
1.740     nicm     4249: The flags are the same as for
                   4250: .Ic set-option .
1.604     nicm     4251: .Pp
                   4252: With
                   4253: .Fl R ,
                   4254: run
                   4255: .Ar hook-name
                   4256: immediately.
1.469     nicm     4257: .It Xo Ic show-hooks
1.740     nicm     4258: .Op Fl gpw
                   4259: .Op Fl t Ar target-pane
1.469     nicm     4260: .Xc
1.740     nicm     4261: Shows hooks.
                   4262: The flags are the same as for
                   4263: .Ic show-options .
1.470     jmc      4264: .El
1.419     nicm     4265: .Sh MOUSE SUPPORT
                   4266: If the
                   4267: .Ic mouse
                   4268: option is on (the default is off),
                   4269: .Nm
                   4270: allows mouse events to be bound as keys.
                   4271: The name of each key is made up of a mouse event (such as
                   4272: .Ql MouseUp1 )
1.632     nicm     4273: and a location suffix, one of the following:
                   4274: .Bl -column "XXXXXXXXXXXXX" -offset indent
                   4275: .It Li "Pane" Ta "the contents of a pane"
                   4276: .It Li "Border" Ta "a pane border"
                   4277: .It Li "Status" Ta "the status line window list"
                   4278: .It Li "StatusLeft" Ta "the left part of the status line"
                   4279: .It Li "StatusRight" Ta "the right part of the status line"
                   4280: .It Li "StatusDefault" Ta "any other part of the status line"
                   4281: .El
                   4282: .Pp
1.419     nicm     4283: The following mouse events are available:
                   4284: .Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent
1.498     nicm     4285: .It Li "WheelUp" Ta "WheelDown" Ta ""
1.481     nicm     4286: .It Li "MouseDown1" Ta "MouseUp1" Ta "MouseDrag1" Ta "MouseDragEnd1"
                   4287: .It Li "MouseDown2" Ta "MouseUp2" Ta "MouseDrag2" Ta "MouseDragEnd2"
                   4288: .It Li "MouseDown3" Ta "MouseUp3" Ta "MouseDrag3" Ta "MouseDragEnd3"
1.724     nicm     4289: .It Li "SecondClick1" Ta "SecondClick2" Ta "SecondClick3"
1.590     nicm     4290: .It Li "DoubleClick1" Ta "DoubleClick2" Ta "DoubleClick3"
                   4291: .It Li "TripleClick1" Ta "TripleClick2" Ta "TripleClick3"
1.419     nicm     4292: .El
1.724     nicm     4293: .Pp
                   4294: The
                   4295: .Ql SecondClick
                   4296: events are fired for the second click of a double click, even if there may be a
                   4297: third click which will fire
                   4298: .Ql TripleClick
                   4299: instead of
                   4300: .Ql DoubleClick .
1.419     nicm     4301: .Pp
                   4302: Each should be suffixed with a location, for example
                   4303: .Ql MouseDown1Status .
                   4304: .Pp
1.423     nicm     4305: The special token
                   4306: .Ql {mouse}
                   4307: or
1.419     nicm     4308: .Ql =
                   4309: may be used as
                   4310: .Ar target-window
                   4311: or
                   4312: .Ar target-pane
                   4313: in commands bound to mouse key bindings.
                   4314: It resolves to the window or pane over which the mouse event took place
                   4315: (for example, the window in the status line over which button 1 was released for a
                   4316: .Ql MouseUp1Status
                   4317: binding, or the pane over which the wheel was scrolled for a
                   4318: .Ql WheelDownPane
                   4319: binding).
                   4320: .Pp
                   4321: The
                   4322: .Ic send-keys
                   4323: .Fl M
                   4324: flag may be used to forward a mouse event to a pane.
                   4325: .Pp
                   4326: The default key bindings allow the mouse to be used to select and resize panes,
                   4327: to copy text and to change window using the status line.
                   4328: These take effect if the
                   4329: .Ic mouse
                   4330: option is turned on.
1.245     nicm     4331: .Sh FORMATS
1.294     nicm     4332: Certain commands accept the
1.245     nicm     4333: .Fl F
                   4334: flag with a
                   4335: .Ar format
                   4336: argument.
                   4337: This is a string which controls the output format of the command.
1.678     nicm     4338: Format variables are enclosed in
1.245     nicm     4339: .Ql #{
                   4340: and
                   4341: .Ql } ,
                   4342: for example
1.359     nicm     4343: .Ql #{session_name} .
1.409     nicm     4344: The possible variables are listed in the table below, or the name of a
                   4345: .Nm
                   4346: option may be used for an option's value.
                   4347: Some variables have a shorter alias such as
1.598     nicm     4348: .Ql #S ;
1.376     nicm     4349: .Ql ##
                   4350: is replaced by a single
1.598     nicm     4351: .Ql # ,
                   4352: .Ql #,
                   4353: by a
                   4354: .Ql \&,
                   4355: and
                   4356: .Ql #}
                   4357: by a
                   4358: .Ql } .
1.409     nicm     4359: .Pp
                   4360: Conditionals are available by prefixing with
1.246     jmc      4361: .Ql \&?
1.245     nicm     4362: and separating two alternatives with a comma;
                   4363: if the specified variable exists and is not zero, the first alternative
1.246     jmc      4364: is chosen, otherwise the second is used.
                   4365: For example
1.245     nicm     4366: .Ql #{?session_attached,attached,not attached}
                   4367: will include the string
                   4368: .Ql attached
                   4369: if the session is attached and the string
                   4370: .Ql not attached
1.409     nicm     4371: if it is unattached, or
                   4372: .Ql #{?automatic-rename,yes,no}
                   4373: will include
                   4374: .Ql yes
                   4375: if
                   4376: .Ic automatic-rename
                   4377: is enabled, or
                   4378: .Ql no
                   4379: if not.
1.599     nicm     4380: Conditionals can be nested arbitrarily.
                   4381: Inside a conditional,
                   4382: .Ql \&,
                   4383: and
                   4384: .Ql }
                   4385: must be escaped as
                   4386: .Ql #,
                   4387: and
                   4388: .Ql #} ,
                   4389: unless they are part of a
                   4390: .Ql #{...}
1.600     nicm     4391: replacement.
                   4392: For example:
1.599     nicm     4393: .Bd -literal -offset indent
                   4394: #{?pane_in_mode,#[fg=white#,bg=red],#[fg=red#,bg=white]}#W .
                   4395: .Ed
1.520     nicm     4396: .Pp
1.678     nicm     4397: String comparisons may be expressed by prefixing two comma-separated
1.520     nicm     4398: alternatives by
1.652     nicm     4399: .Ql == ,
                   4400: .Ql != ,
                   4401: .Ql < ,
                   4402: .Ql > ,
                   4403: .Ql <=
1.520     nicm     4404: or
1.652     nicm     4405: .Ql >=
1.520     nicm     4406: and a colon.
                   4407: For example
1.544     nicm     4408: .Ql #{==:#{host},myhost}
1.520     nicm     4409: will be replaced by
                   4410: .Ql 1
                   4411: if running on
                   4412: .Ql myhost ,
                   4413: otherwise by
1.554     nicm     4414: .Ql 0 .
                   4415: .Ql ||
                   4416: and
                   4417: .Ql &&
                   4418: evaluate to true if either or both of two comma-separated alternatives are
                   4419: true, for example
1.595     nicm     4420: .Ql #{||:#{pane_in_mode},#{alternate_on}} .
1.664     nicm     4421: .Pp
                   4422: An
                   4423: .Ql m
                   4424: specifies an
                   4425: .Xr fnmatch 3
                   4426: or regular expression comparison.
                   4427: The first argument is the pattern and the second the string to compare.
1.714     nicm     4428: An optional argument specifies flags:
1.664     nicm     4429: .Ql r
                   4430: means the pattern is a regular expression instead of the default
                   4431: .Xr fnmatch 3
                   4432: pattern, and
                   4433: .Ql i
                   4434: means to ignore case.
                   4435: For example:
                   4436: .Ql #{m:*foo*,#{host}}
                   4437: or
                   4438: .Ql #{m/ri:^A,MYVAR} .
1.554     nicm     4439: A
                   4440: .Ql C
                   4441: performs a search for an
                   4442: .Xr fnmatch 3
1.664     nicm     4443: pattern or regular expression in the pane content and evaluates to zero if not
                   4444: found, or a line number if found.
                   4445: Like
                   4446: .Ql m ,
1.665     jmc      4447: an
1.664     nicm     4448: .Ql r
                   4449: flag means search for a regular expression and
                   4450: .Ql i
                   4451: ignores case.
                   4452: For example:
                   4453: .Ql #{C/r:^Start}
1.714     nicm     4454: .Pp
                   4455: Numeric operators may be performed by prefixing two comma-separated alternatives with an
                   4456: .Ql e
                   4457: and an operator.
                   4458: An optional
                   4459: .Ql f
                   4460: flag may be given after the operator to use floating point numbers, otherwise integers are used.
                   4461: This may be followed by a number giving the number of decimal places to use for the result.
                   4462: The available operators are:
                   4463: addition
                   4464: .Ql + ,
                   4465: subtraction
                   4466: .Ql - ,
                   4467: multiplication
                   4468: .Ql * ,
                   4469: division
                   4470: .Ql / ,
                   4471: and modulus
                   4472: .Ql m
                   4473: or
                   4474: .Ql %
                   4475: (note that
                   4476: .Ql %
                   4477: must be escaped as
                   4478: .Ql %%
                   4479: in formats which are also expanded by
                   4480: .Xr strftime 3 ) .
                   4481: For example,
                   4482: .Ql #{e|*|f|4:5.5,3}
                   4483: multiplies 5.5 by 3 for a result with four decimal places and
                   4484: .Ql #{e|%%:7,3}
                   4485: returns the modulus of 7 and 3.
1.453     nicm     4486: .Pp
1.367     nicm     4487: A limit may be placed on the length of the resultant string by prefixing it
                   4488: by an
                   4489: .Ql = ,
1.479     nicm     4490: a number and a colon.
                   4491: Positive numbers count from the start of the string and negative from the end,
                   4492: so
                   4493: .Ql #{=5:pane_title}
1.653     nicm     4494: will include at most the first five characters of the pane title, or
1.479     nicm     4495: .Ql #{=-5:pane_title}
1.653     nicm     4496: the last five characters.
                   4497: A suffix or prefix may be given as a second argument - if provided then it is
                   4498: appended or prepended to the string if the length has been trimmed, for example
                   4499: .Ql #{=/5/...:pane_title}
                   4500: will append
                   4501: .Ql ...
                   4502: if the pane title is more than five characters.
1.698     nicm     4503: Similarly,
                   4504: .Ql p
                   4505: pads the string to a given width, for example
                   4506: .Ql #{p10:pane_title}
                   4507: will result in a width of at least 10 characters.
                   4508: A positive width pads on the left, a negative on the right.
1.653     nicm     4509: .Pp
1.453     nicm     4510: Prefixing a time variable with
1.683     nicm     4511: .Ql t:\&
1.453     nicm     4512: will convert it to a string, so if
                   4513: .Ql #{window_activity}
                   4514: gives
1.454     jmc      4515: .Ql 1445765102 ,
1.453     nicm     4516: .Ql #{t:window_activity}
                   4517: gives
                   4518: .Ql Sun Oct 25 09:25:02 2015 .
1.751     nicm     4519: Adding
                   4520: .Ql p (
                   4521: .Ql `t/p` )
                   4522: will use shorter but less accurate time format for times in the past.
1.765     nicm     4523: A custom format may be given using an
                   4524: .Ql f
                   4525: suffix (note that
                   4526: .Ql %
                   4527: must be escaped as
                   4528: .Ql %%
                   4529: if the format is separately being passed through
                   4530: .Xr strftime 3 ,
                   4531: for example in the
                   4532: .Ic status-left
                   4533: option):
                   4534: .Ql #{t/f/%%H#:%%M:window_activity} ,
                   4535: see
                   4536: .Xr strftime 3 .
                   4537: .Pp
1.453     nicm     4538: The
1.683     nicm     4539: .Ql b:\&
1.453     nicm     4540: and
1.683     nicm     4541: .Ql d:\&
1.453     nicm     4542: prefixes are
                   4543: .Xr basename 3
                   4544: and
                   4545: .Xr dirname 3
                   4546: of the variable respectively.
1.683     nicm     4547: .Ql q:\&
1.610     nicm     4548: will escape
                   4549: .Xr sh 1
                   4550: special characters.
1.683     nicm     4551: .Ql E:\&
1.617     nicm     4552: will expand the format twice, for example
                   4553: .Ql #{E:status-left}
                   4554: is the result of expanding the content of the
                   4555: .Ic status-left
1.671     nicm     4556: option rather than the option itself.
1.683     nicm     4557: .Ql T:\&
1.620     nicm     4558: is like
1.683     nicm     4559: .Ql E:\&
1.620     nicm     4560: but also expands
                   4561: .Xr strftime 3
                   4562: specifiers.
1.683     nicm     4563: .Ql S:\& ,
                   4564: .Ql W:\&
1.618     nicm     4565: or
1.683     nicm     4566: .Ql P:\&
1.618     nicm     4567: will loop over each session, window or pane and insert the format once
1.619     nicm     4568: for each.
                   4569: For windows and panes, two comma-separated formats may be given:
                   4570: the second is used for the current window or active pane.
                   4571: For example, to get a list of windows formatted like the status line:
1.618     nicm     4572: .Bd -literal -offset indent
                   4573: #{W:#{E:window-status-format} ,#{E:window-status-current-format} }
                   4574: .Ed
1.625     nicm     4575: .Pp
1.461     nicm     4576: A prefix of the form
1.683     nicm     4577: .Ql s/foo/bar/:\&
1.461     nicm     4578: will substitute
                   4579: .Ql foo
                   4580: with
                   4581: .Ql bar
                   4582: throughout.
1.664     nicm     4583: The first argument may be an extended regular expression and a final argument may be
                   4584: .Ql i
                   4585: to ignore case, for example
1.683     nicm     4586: .Ql s/a(.)/\e1x/i:\&
1.664     nicm     4587: would change
                   4588: .Ql abABab
                   4589: into
                   4590: .Ql bxBxbx .
1.431     nicm     4591: .Pp
1.671     nicm     4592: In addition, the last line of a shell command's output may be inserted using
1.431     nicm     4593: .Ql #() .
                   4594: For example,
                   4595: .Ql #(uptime)
                   4596: will insert the system's uptime.
                   4597: When constructing formats,
                   4598: .Nm
                   4599: does not wait for
                   4600: .Ql #()
                   4601: commands to finish; instead, the previous result from running the same command is used,
                   4602: or a placeholder if the command has not been run before.
1.543     nicm     4603: If the command hasn't exited, the most recent line of output will be used, but the status
                   4604: line will not be updated more than once a second.
1.431     nicm     4605: Commands are executed with the
                   4606: .Nm
                   4607: global environment set (see the
1.644     schwarze 4608: .Sx GLOBAL AND SESSION ENVIRONMENT
1.431     nicm     4609: section).
1.671     nicm     4610: .Pp
                   4611: An
                   4612: .Ql l
                   4613: specifies that a string should be interpreted literally and not expanded.
                   4614: For example
                   4615: .Ql #{l:#{?pane_in_mode,yes,no}}
                   4616: will be replaced by
                   4617: .Ql #{?pane_in_mode,yes,no} .
1.245     nicm     4618: .Pp
                   4619: The following variables are available, where appropriate:
1.359     nicm     4620: .Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX"
                   4621: .It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with"
1.678     nicm     4622: .It Li "alternate_on" Ta "" Ta "1 if pane is in alternate screen"
1.359     nicm     4623: .It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen"
                   4624: .It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen"
1.572     nicm     4625: .It Li "buffer_created" Ta "" Ta "Time buffer created"
1.490     nicm     4626: .It Li "buffer_name" Ta "" Ta "Name of buffer"
1.386     nicm     4627: .It Li "buffer_sample" Ta "" Ta "Sample of start of buffer"
1.359     nicm     4628: .It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes"
1.572     nicm     4629: .It Li "client_activity" Ta "" Ta "Time client last had activity"
1.699     nicm     4630: .It Li "client_cell_height" Ta "" Ta "Height of each client cell in pixels"
                   4631: .It Li "client_cell_width" Ta "" Ta "Width of each client cell in pixels"
1.646     nicm     4632: .It Li "client_control_mode" Ta "" Ta "1 if client is in control mode"
1.572     nicm     4633: .It Li "client_created" Ta "" Ta "Time client created"
1.542     nicm     4634: .It Li "client_discarded" Ta "" Ta "Bytes discarded when client behind"
1.762     nicm     4635: .It Li "client_flags" Ta "" Ta "List of client flags"
1.359     nicm     4636: .It Li "client_height" Ta "" Ta "Height of client"
1.451     nicm     4637: .It Li "client_key_table" Ta "" Ta "Current key table"
1.359     nicm     4638: .It Li "client_last_session" Ta "" Ta "Name of the client's last session"
1.540     nicm     4639: .It Li "client_name" Ta "" Ta "Name of client"
1.437     nicm     4640: .It Li "client_pid" Ta "" Ta "PID of client process"
1.359     nicm     4641: .It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed"
                   4642: .It Li "client_readonly" Ta "" Ta "1 if client is readonly"
                   4643: .It Li "client_session" Ta "" Ta "Name of the client's session"
                   4644: .It Li "client_termname" Ta "" Ta "Terminal name of client"
1.754     nicm     4645: .It Li "client_termtype" Ta "" Ta "Terminal type of client, if available"
                   4646: .It Li "client_termfeatures" Ta "" Ta "Terminal features of client, if any"
1.359     nicm     4647: .It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
1.699     nicm     4648: .It Li "client_utf8" Ta "" Ta "1 if client supports UTF-8"
1.359     nicm     4649: .It Li "client_width" Ta "" Ta "Width of client"
1.541     nicm     4650: .It Li "client_written" Ta "" Ta "Bytes written to client"
1.509     nicm     4651: .It Li "command" Ta "" Ta "Name of command in use, if any"
1.646     nicm     4652: .It Li "command_list_alias" Ta "" Ta "Command alias if listing commands"
1.489     nicm     4653: .It Li "command_list_name" Ta "" Ta "Command name if listing commands"
                   4654: .It Li "command_list_usage" Ta "" Ta "Command usage if listing commands"
1.692     nicm     4655: .It Li "copy_cursor_line" Ta "" Ta "Line the cursor is on in copy mode"
                   4656: .It Li "copy_cursor_word" Ta "" Ta "Word under cursor in copy mode"
1.691     nicm     4657: .It Li "copy_cursor_x" Ta "" Ta "Cursor X position in copy mode"
                   4658: .It Li "copy_cursor_y" Ta "" Ta "Cursor Y position in copy mode"
1.646     nicm     4659: .It Li "cursor_character" Ta "" Ta "Character at cursor in pane"
1.359     nicm     4660: .It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
                   4661: .It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
                   4662: .It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"
                   4663: .It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
                   4664: .It Li "history_limit" Ta "" Ta "Maximum window history lines"
1.581     nicm     4665: .It Li "history_size" Ta "" Ta "Size of history in lines"
1.509     nicm     4666: .It Li "hook" Ta "" Ta "Name of running hook, if any"
1.511     nicm     4667: .It Li "hook_pane" Ta "" Ta "ID of pane where hook was run, if any"
1.510     nicm     4668: .It Li "hook_session" Ta "" Ta "ID of session where hook was run, if any"
                   4669: .It Li "hook_session_name" Ta "" Ta "Name of session where hook was run, if any"
                   4670: .It Li "hook_window" Ta "" Ta "ID of window where hook was run, if any"
                   4671: .It Li "hook_window_name" Ta "" Ta "Name of window where hook was run, if any"
1.359     nicm     4672: .It Li "host" Ta "#H" Ta "Hostname of local host"
                   4673: .It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)"
                   4674: .It Li "insert_flag" Ta "" Ta "Pane insert flag"
                   4675: .It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag"
                   4676: .It Li "keypad_flag" Ta "" Ta "Pane keypad flag"
                   4677: .It Li "line" Ta "" Ta "Line number in the list"
1.646     nicm     4678: .It Li "mouse_all_flag" Ta "" Ta "Pane mouse all flag"
1.359     nicm     4679: .It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag"
                   4680: .It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag"
1.676     nicm     4681: .It Li "mouse_line" Ta "" Ta "Line under mouse, if any"
                   4682: .It Li "mouse_sgr_flag" Ta "" Ta "Pane mouse SGR flag"
1.359     nicm     4683: .It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
1.676     nicm     4684: .It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
                   4685: .It Li "mouse_word" Ta "" Ta "Word under mouse, if any"
1.654     nicm     4686: .It Li "mouse_x" Ta "" Ta "Mouse X position, if any"
                   4687: .It Li "mouse_y" Ta "" Ta "Mouse Y position, if any"
1.676     nicm     4688: .It Li "origin_flag" Ta "" Ta "Pane origin flag"
1.359     nicm     4689: .It Li "pane_active" Ta "" Ta "1 if active pane"
1.570     nicm     4690: .It Li "pane_at_bottom" Ta "" Ta "1 if pane is at the bottom of window"
                   4691: .It Li "pane_at_left" Ta "" Ta "1 if pane is at the left of window"
                   4692: .It Li "pane_at_right" Ta "" Ta "1 if pane is at the right of window"
                   4693: .It Li "pane_at_top" Ta "" Ta "1 if pane is at the top of window"
1.396     nicm     4694: .It Li "pane_bottom" Ta "" Ta "Bottom of pane"
1.359     nicm     4695: .It Li "pane_current_command" Ta "" Ta "Current command if available"
1.733     nicm     4696: .It Li "pane_current_path" Ta "" Ta "Current path if available"
1.359     nicm     4697: .It Li "pane_dead" Ta "" Ta "1 if pane is dead"
1.411     nicm     4698: .It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane"
1.696     nicm     4699: .It Li "pane_format" Ta "" Ta "1 if format is for a pane"
1.359     nicm     4700: .It Li "pane_height" Ta "" Ta "Height of pane"
                   4701: .It Li "pane_id" Ta "#D" Ta "Unique pane ID"
1.678     nicm     4702: .It Li "pane_in_mode" Ta "" Ta "1 if pane is in a mode"
1.646     nicm     4703: .It Li "pane_index" Ta "#P" Ta "Index of pane"
1.678     nicm     4704: .It Li "pane_input_off" Ta "" Ta "1 if input to pane is disabled"
1.396     nicm     4705: .It Li "pane_left" Ta "" Ta "Left of pane"
1.650     nicm     4706: .It Li "pane_marked" Ta "" Ta "1 if this is the marked pane"
                   4707: .It Li "pane_marked_set" Ta "" Ta "1 if a marked pane is set"
1.678     nicm     4708: .It Li "pane_mode" Ta "" Ta "Name of pane mode, if any"
1.761     nicm     4709: .It Li "pane_path" Ta "" Ta "Path of pane (can be set by application)"
1.359     nicm     4710: .It Li "pane_pid" Ta "" Ta "PID of first process in pane"
1.567     nicm     4711: .It Li "pane_pipe" Ta "" Ta "1 if pane is being piped"
1.396     nicm     4712: .It Li "pane_right" Ta "" Ta "Right of pane"
1.546     nicm     4713: .It Li "pane_search_string" Ta "" Ta "Last search string in copy mode"
1.743     nicm     4714: .It Li "pane_skipped" Ta "" Ta "Bytes skipped as not visible in pane"
1.359     nicm     4715: .It Li "pane_start_command" Ta "" Ta "Command pane started with"
1.678     nicm     4716: .It Li "pane_synchronized" Ta "" Ta "1 if pane is synchronized"
1.359     nicm     4717: .It Li "pane_tabs" Ta "" Ta "Pane tab positions"
1.696     nicm     4718: .It Li "pane_title" Ta "#T" Ta "Title of pane (can be set by application)"
1.396     nicm     4719: .It Li "pane_top" Ta "" Ta "Top of pane"
1.359     nicm     4720: .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
                   4721: .It Li "pane_width" Ta "" Ta "Width of pane"
1.743     nicm     4722: .It Li "pane_written" Ta "" Ta "Bytes written by pane (aside from redrawing)"
1.721     nicm     4723: .It Li "pid" Ta "" Ta "Server PID"
                   4724: .It Li "popup_key" Ta "" Ta "Key pressed in popup"
                   4725: .It Li "popup_mouse_x" Ta "" Ta "Mouse X position in popup"
                   4726: .It Li "popup_mouse_y" Ta "" Ta "Mouse Y position in popup"
1.606     nicm     4727: .It Li "rectangle_toggle" Ta "" Ta "1 if rectangle selection is activated"
1.646     nicm     4728: .It Li "scroll_position" Ta "" Ta "Scroll position in copy mode"
1.359     nicm     4729: .It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
                   4730: .It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
1.713     nicm     4731: .It Li "selection_active" Ta "" Ta "1 if selection started and changes with the cursor in copy mode"
1.691     nicm     4732: .It Li "selection_end_x" Ta "" Ta "X position of the end of the selection"
                   4733: .It Li "selection_end_y" Ta "" Ta "Y position of the end of the selection"
1.571     nicm     4734: .It Li "selection_present" Ta "" Ta "1 if selection started in copy mode"
1.691     nicm     4735: .It Li "selection_start_x" Ta "" Ta "X position of the start of the selection"
                   4736: .It Li "selection_start_y" Ta "" Ta "Y position of the start of the selection"
1.646     nicm     4737: .It Li "session_activity" Ta "" Ta "Time of session last activity"
1.430     nicm     4738: .It Li "session_alerts" Ta "" Ta "List of window indexes with alerts"
1.382     nicm     4739: .It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
1.702     nicm     4740: .It Li "session_attached_list" Ta "" Ta "List of clients session is attached to"
1.572     nicm     4741: .It Li "session_created" Ta "" Ta "Time session created"
1.696     nicm     4742: .It Li "session_format" Ta "" Ta "1 if format is for a session"
1.536     nicm     4743: .It Li "session_group" Ta "" Ta "Name of session group"
1.702     nicm     4744: .It Li "session_group_attached" Ta "" Ta "Number of clients sessions in group are attached to"
                   4745: .It Li "session_group_attached_list" Ta "" Ta "List of clients sessions in group are attached to"
1.646     nicm     4746: .It Li "session_group_list" Ta "" Ta "List of sessions in group"
1.702     nicm     4747: .It Li "session_group_many_attached" Ta "" Ta "1 if multiple clients attached to sessions in group"
1.586     nicm     4748: .It Li "session_group_size" Ta "" Ta "Size of session group"
1.359     nicm     4749: .It Li "session_grouped" Ta "" Ta "1 if session in a group"
                   4750: .It Li "session_id" Ta "" Ta "Unique session ID"
1.646     nicm     4751: .It Li "session_last_attached" Ta "" Ta "Time session last attached"
1.382     nicm     4752: .It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached"
1.748     nicm     4753: .It Li "session_marked" Ta "" Ta "1 if this session contains the marked pane"
1.359     nicm     4754: .It Li "session_name" Ta "#S" Ta "Name of session"
1.725     nicm     4755: .It Li "session_path" Ta "" Ta "Working directory of session"
1.548     nicm     4756: .It Li "session_stack" Ta "" Ta "Window indexes in most recent order"
1.359     nicm     4757: .It Li "session_windows" Ta "" Ta "Number of windows in session"
1.487     nicm     4758: .It Li "socket_path" Ta "" Ta "Server socket path"
1.465     nicm     4759: .It Li "start_time" Ta "" Ta "Server start time"
1.708     nicm     4760: .It Li "version" Ta "" Ta "Server version"
1.646     nicm     4761: .It Li "window_active" Ta "" Ta "1 if window active"
1.702     nicm     4762: .It Li "window_active_clients" Ta "" Ta "Number of clients viewing this window"
                   4763: .It Li "window_active_clients_list" Ta "" Ta "List of clients viewing this window"
                   4764: .It Li "window_active_sessions" Ta "" Ta "Number of sessions on which this window is active"
                   4765: .It Li "window_active_sessions_list" Ta "" Ta "List of sessions on which this window is active"
1.572     nicm     4766: .It Li "window_activity" Ta "" Ta "Time of window last activity"
1.487     nicm     4767: .It Li "window_activity_flag" Ta "" Ta "1 if window has activity"
1.366     nicm     4768: .It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
1.642     nicm     4769: .It Li "window_bigger" Ta "" Ta "1 if window is larger than client"
1.700     nicm     4770: .It Li "window_cell_height" Ta "" Ta "Height of each cell in pixels"
                   4771: .It Li "window_cell_width" Ta "" Ta "Width of each cell in pixels"
1.621     nicm     4772: .It Li "window_end_flag" Ta "" Ta "1 if window has the highest index"
1.359     nicm     4773: .It Li "window_flags" Ta "#F" Ta "Window flags"
1.696     nicm     4774: .It Li "window_format" Ta "" Ta "1 if format is for a window"
1.359     nicm     4775: .It Li "window_height" Ta "" Ta "Height of window"
                   4776: .It Li "window_id" Ta "" Ta "Unique window ID"
                   4777: .It Li "window_index" Ta "#I" Ta "Index of window"
1.400     nicm     4778: .It Li "window_last_flag" Ta "" Ta "1 if window is the last used"
1.460     nicm     4779: .It Li "window_layout" Ta "" Ta "Window layout description, ignoring zoomed window panes"
1.426     nicm     4780: .It Li "window_linked" Ta "" Ta "1 if window is linked across sessions"
1.702     nicm     4781: .It Li "window_linked_sessions" Ta "" Ta "Number of sessions this window is linked to"
                   4782: .It Li "window_linked_sessions_list" Ta "" Ta "List of sessions this window is linked to"
1.687     nicm     4783: .It Li "window_marked_flag" Ta "" Ta "1 if window contains the marked pane"
1.359     nicm     4784: .It Li "window_name" Ta "#W" Ta "Name of window"
1.642     nicm     4785: .It Li "window_offset_x" Ta "" Ta "X offset into window if larger than client"
                   4786: .It Li "window_offset_y" Ta "" Ta "Y offset into window if larger than client"
1.359     nicm     4787: .It Li "window_panes" Ta "" Ta "Number of panes in window"
1.366     nicm     4788: .It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
1.548     nicm     4789: .It Li "window_stack_index" Ta "" Ta "Index in session most recent stack"
1.621     nicm     4790: .It Li "window_start_flag" Ta "" Ta "1 if window has the lowest index"
1.460     nicm     4791: .It Li "window_visible_layout" Ta "" Ta "Window layout description, respecting zoomed window panes"
1.359     nicm     4792: .It Li "window_width" Ta "" Ta "Width of window"
1.400     nicm     4793: .It Li "window_zoomed_flag" Ta "" Ta "1 if window is zoomed"
1.359     nicm     4794: .It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
1.245     nicm     4795: .El
1.623     nicm     4796: .Sh STYLES
                   4797: .Nm
                   4798: offers various options to specify the colour and attributes of aspects of the
                   4799: interface, for example
                   4800: .Ic status-style
                   4801: for the status line.
                   4802: In addition, embedded styles may be specified in format options, such as
1.701     nicm     4803: .Ic status-left ,
1.623     nicm     4804: by enclosing them in
                   4805: .Ql #[
                   4806: and
1.639     nicm     4807: .Ql \&] .
1.623     nicm     4808: .Pp
                   4809: A style may be the single term
                   4810: .Ql default
1.688     nicm     4811: to specify the default style (which may come from an option, for example
                   4812: .Ic status-style
                   4813: in the status line) or a space
1.630     nicm     4814: or comma separated list of the following:
1.623     nicm     4815: .Bl -tag -width Ds
                   4816: .It Ic fg=colour
                   4817: Set the foreground colour.
                   4818: The colour is one of:
                   4819: .Ic black ,
                   4820: .Ic red ,
                   4821: .Ic green ,
                   4822: .Ic yellow ,
                   4823: .Ic blue ,
                   4824: .Ic magenta ,
                   4825: .Ic cyan ,
                   4826: .Ic white ;
                   4827: if supported the bright variants
                   4828: .Ic brightred ,
                   4829: .Ic brightgreen ,
                   4830: .Ic brightyellow ;
                   4831: .Ic colour0
                   4832: to
                   4833: .Ic colour255
                   4834: from the 256-colour set;
                   4835: .Ic default
                   4836: for the default colour;
                   4837: .Ic terminal
                   4838: for the terminal default colour; or a hexadecimal RGB string such as
                   4839: .Ql #ffffff .
                   4840: .It Ic bg=colour
                   4841: Set the background colour.
                   4842: .It Ic none
                   4843: Set no attributes (turn off any active attributes).
1.752     nicm     4844: .It Xo Ic acs ,
                   4845: .Ic bright
1.625     nicm     4846: (or
                   4847: .Ic bold ) ,
1.623     nicm     4848: .Ic dim ,
                   4849: .Ic underscore ,
                   4850: .Ic blink ,
                   4851: .Ic reverse ,
                   4852: .Ic hidden ,
                   4853: .Ic italics ,
1.649     nicm     4854: .Ic overline ,
1.623     nicm     4855: .Ic strikethrough ,
                   4856: .Ic double-underscore ,
                   4857: .Ic curly-underscore ,
                   4858: .Ic dotted-underscore ,
                   4859: .Ic dashed-underscore
                   4860: .Xc
                   4861: Set an attribute.
                   4862: Any of the attributes may be prefixed with
                   4863: .Ql no
                   4864: to unset.
1.752     nicm     4865: .Ic acs
                   4866: is the terminal alternate character set.
1.625     nicm     4867: .It Xo Ic align=left
                   4868: (or
                   4869: .Ic noalign ) ,
                   4870: .Ic align=centre ,
                   4871: .Ic align=right
                   4872: .Xc
                   4873: Align text to the left, centre or right of the available space if appropriate.
1.675     nicm     4874: .It Ic fill=colour
1.674     nicm     4875: Fill the available space with a background colour if appropriate.
1.625     nicm     4876: .It Xo Ic list=on ,
                   4877: .Ic list=focus ,
                   4878: .Ic list=left-marker ,
1.661     nicm     4879: .Ic list=right-marker ,
1.625     nicm     4880: .Ic nolist
                   4881: .Xc
                   4882: Mark the position of the various window list components in the
                   4883: .Ic status-format
                   4884: option:
                   4885: .Ic list=on
                   4886: marks the start of the list;
                   4887: .Ic list=focus
                   4888: is the part of the list that should be kept in focus if the entire list won't fit
                   4889: in the available space (typically the current window);
                   4890: .Ic list=left-marker
                   4891: and
                   4892: .Ic list=right-marker
                   4893: mark the text to be used to mark that text has been trimmed from the left or
                   4894: right of the list if there is not enough space.
1.688     nicm     4895: .It Xo Ic push-default ,
                   4896: .Ic pop-default
                   4897: .Xc
                   4898: Store the current colours and attributes as the default or reset to the previous
                   4899: default.
                   4900: A
                   4901: .Ic push-default
                   4902: affects any subsequent use of the
                   4903: .Ic default
                   4904: term until a
                   4905: .Ic pop-default .
                   4906: Only one default may be pushed (each
                   4907: .Ic push-default
                   4908: replaces the previous saved default).
1.625     nicm     4909: .It Xo Ic range=left ,
                   4910: .Ic range=right ,
                   4911: .Ic range=window|X ,
                   4912: .Ic norange
                   4913: .Xc
                   4914: Mark a range in the
1.651     nicm     4915: .Ic status-format
1.625     nicm     4916: option.
                   4917: .Ic range=left
                   4918: and
                   4919: .Ic range=right
                   4920: are the text used for the
                   4921: .Ql StatusLeft
                   4922: and
                   4923: .Ql StatusRight
                   4924: mouse keys.
                   4925: .Ic range=window|X
                   4926: is the range for a window passed to the
                   4927: .Ql Status
                   4928: mouse key, where
                   4929: .Ql X
                   4930: is a window index.
1.623     nicm     4931: .El
                   4932: .Pp
                   4933: Examples are:
                   4934: .Bd -literal -offset indent
1.630     nicm     4935: fg=yellow bold underscore blink
1.623     nicm     4936: bg=black,fg=default,noreverse
                   4937: .Ed
1.261     nicm     4938: .Sh NAMES AND TITLES
                   4939: .Nm
                   4940: distinguishes between names and titles.
                   4941: Windows and sessions have names, which may be used to specify them in targets
                   4942: and are displayed in the status line and various lists: the name is the
                   4943: .Nm
                   4944: identifier for a window or session.
                   4945: Only panes have titles.
1.577     nicm     4946: A pane's title is typically set by the program running inside the pane using
                   4947: an escape sequence (like it would set the
1.261     nicm     4948: .Xr xterm 1
1.577     nicm     4949: window title in
1.578     nicm     4950: .Xr X 7 ) .
1.268     nicm     4951: Windows themselves do not have titles - a window's title is the title of its
1.261     nicm     4952: active pane.
                   4953: .Nm
                   4954: itself may set the title of the terminal in which the client is running, see
                   4955: the
                   4956: .Ic set-titles
                   4957: option.
                   4958: .Pp
                   4959: A session's name is set with the
                   4960: .Ic new-session
                   4961: and
                   4962: .Ic rename-session
                   4963: commands.
                   4964: A window's name is set with one of:
                   4965: .Bl -enum -width Ds
                   4966: .It
                   4967: A command argument (such as
                   4968: .Fl n
                   4969: for
                   4970: .Ic new-window
                   4971: or
                   4972: .Ic new-session ) .
                   4973: .It
1.597     nicm     4974: An escape sequence (if the
                   4975: .Ic allow-rename
                   4976: option is turned on):
1.261     nicm     4977: .Bd -literal -offset indent
                   4978: $ printf '\e033kWINDOW_NAME\e033\e\e'
                   4979: .Ed
                   4980: .It
                   4981: Automatic renaming, which sets the name to the active command in the window's
                   4982: active pane.
                   4983: See the
                   4984: .Ic automatic-rename
                   4985: option.
                   4986: .El
                   4987: .Pp
                   4988: When a pane is first created, its title is the hostname.
1.612     nicm     4989: A pane's title can be set via the title setting escape sequence, for example:
1.261     nicm     4990: .Bd -literal -offset indent
                   4991: $ printf '\e033]2;My Title\e033\e\e'
                   4992: .Ed
1.577     nicm     4993: .Pp
                   4994: It can also be modified with the
                   4995: .Ic select-pane
                   4996: .Fl T
                   4997: command.
1.644     schwarze 4998: .Sh GLOBAL AND SESSION ENVIRONMENT
1.63      nicm     4999: When the server is started,
                   5000: .Nm
                   5001: copies the environment into the
                   5002: .Em global environment ;
                   5003: in addition, each session has a
                   5004: .Em session environment .
1.193     nicm     5005: When a window is created, the session and global environments are merged.
                   5006: If a variable exists in both, the value from the session environment is used.
                   5007: The result is the initial environment passed to the new process.
1.63      nicm     5008: .Pp
                   5009: The
                   5010: .Ic update-environment
                   5011: session option may be used to update the session environment from the client
                   5012: when a new session is created or an old reattached.
                   5013: .Nm
                   5014: also initialises the
                   5015: .Ev TMUX
                   5016: variable with some internal information to allow commands to be executed
                   5017: from inside, and the
                   5018: .Ev TERM
                   5019: variable with the correct terminal setting of
                   5020: .Ql screen .
                   5021: .Pp
1.728     nicm     5022: Variables in both session and global environments may be marked as hidden.
                   5023: Hidden variables are not passed into the environment of new processes and
                   5024: instead can only be used by tmux itself (for example in formats, see the
                   5025: .Sx FORMATS
                   5026: section).
                   5027: .Pp
1.63      nicm     5028: Commands to alter and view the environment are:
                   5029: .Bl -tag -width Ds
                   5030: .It Xo Ic set-environment
1.728     nicm     5031: .Op Fl hgru
1.63      nicm     5032: .Op Fl t Ar target-session
                   5033: .Ar name Op Ar value
                   5034: .Xc
1.115     nicm     5035: .D1 (alias: Ic setenv )
1.63      nicm     5036: Set or unset an environment variable.
                   5037: If
                   5038: .Fl g
                   5039: is used, the change is made in the global environment; otherwise, it is applied
                   5040: to the session environment for
                   5041: .Ar target-session .
                   5042: The
                   5043: .Fl u
                   5044: flag unsets a variable.
                   5045: .Fl r
                   5046: indicates the variable is to be removed from the environment before starting a
                   5047: new process.
1.728     nicm     5048: .Fl h
                   5049: marks the variable as hidden.
1.63      nicm     5050: .It Xo Ic show-environment
1.728     nicm     5051: .Op Fl hgs
1.63      nicm     5052: .Op Fl t Ar target-session
1.286     nicm     5053: .Op Ar variable
1.63      nicm     5054: .Xc
1.115     nicm     5055: .D1 (alias: Ic showenv )
1.63      nicm     5056: Display the environment for
                   5057: .Ar target-session
                   5058: or the global environment with
                   5059: .Fl g .
1.286     nicm     5060: If
                   5061: .Ar variable
                   5062: is omitted, all variables are shown.
1.63      nicm     5063: Variables removed from the environment are prefixed with
                   5064: .Ql - .
1.442     nicm     5065: If
                   5066: .Fl s
                   5067: is used, the output is formatted as a set of Bourne shell commands.
1.728     nicm     5068: .Fl h
                   5069: shows hidden variables (omitted by default).
1.57      jmc      5070: .El
                   5071: .Sh STATUS LINE
                   5072: .Nm
                   5073: includes an optional status line which is displayed in the bottom line of each
                   5074: terminal.
1.626     nicm     5075: .Pp
                   5076: By default, the status line is enabled and one line in height (it may be
                   5077: disabled or made multiple lines with the
1.57      jmc      5078: .Ic status
                   5079: session option) and contains, from left-to-right: the name of the current
1.261     nicm     5080: session in square brackets; the window list; the title of the active pane
                   5081: in double quotes; and the time and date.
1.57      jmc      5082: .Pp
1.626     nicm     5083: Each line of the status line is configured with the
                   5084: .Ic status-format
                   5085: option.
                   5086: The default is made of three parts: configurable left and right sections (which
                   5087: may contain dynamic content such as the time or output from a shell command,
                   5088: see the
1.57      jmc      5089: .Ic status-left ,
                   5090: .Ic status-left-length ,
                   5091: .Ic status-right ,
                   5092: and
                   5093: .Ic status-right-length
                   5094: options below), and a central window list.
1.125     nicm     5095: By default, the window list shows the index, name and (if any) flag of the
                   5096: windows present in the current session in ascending numerical order.
                   5097: It may be customised with the
                   5098: .Ar window-status-format
                   5099: and
                   5100: .Ar window-status-current-format
                   5101: options.
1.57      jmc      5102: The flag is one of the following symbols appended to the window name:
                   5103: .Bl -column "Symbol" "Meaning" -offset indent
                   5104: .It Sy "Symbol" Ta Sy "Meaning"
                   5105: .It Li "*" Ta "Denotes the current window."
                   5106: .It Li "-" Ta "Marks the last window (previously selected)."
1.574     nicm     5107: .It Li "#" Ta "Window activity is monitored and activity has been detected."
                   5108: .It Li "\&!" Ta "Window bells are monitored and a bell has occurred in the window."
1.192     nicm     5109: .It Li "~" Ta "The window has been silent for the monitor-silence interval."
1.432     nicm     5110: .It Li "M" Ta "The window contains the marked pane."
1.349     nicm     5111: .It Li "Z" Ta "The window's active pane is zoomed."
1.57      jmc      5112: .El
                   5113: .Pp
                   5114: The # symbol relates to the
                   5115: .Ic monitor-activity
1.388     nicm     5116: window option.
1.57      jmc      5117: The window name is printed in inverted colours if an alert (bell, activity or
1.388     nicm     5118: silence) is present.
1.57      jmc      5119: .Pp
1.131     nicm     5120: The colour and attributes of the status line may be configured, the entire
                   5121: status line using the
1.378     nicm     5122: .Ic status-style
                   5123: session option and individual windows using the
                   5124: .Ic window-status-style
                   5125: window option.
1.57      jmc      5126: .Pp
1.131     nicm     5127: The status line is automatically refreshed at interval if it has changed, the
                   5128: interval may be controlled with the
1.57      jmc      5129: .Ic status-interval
                   5130: session option.
                   5131: .Pp
                   5132: Commands related to the status line are as follows:
                   5133: .Bl -tag -width Ds
                   5134: .It Xo Ic command-prompt
1.758     nicm     5135: .Op Fl 1ikNTW
1.235     nicm     5136: .Op Fl I Ar inputs
1.73      nicm     5137: .Op Fl p Ar prompts
1.57      jmc      5138: .Op Fl t Ar target-client
                   5139: .Op Ar template
                   5140: .Xc
                   5141: Open the command prompt in a client.
                   5142: This may be used from inside
                   5143: .Nm
                   5144: to execute commands interactively.
1.231     nicm     5145: .Pp
1.57      jmc      5146: If
                   5147: .Ar template
1.73      nicm     5148: is specified, it is used as the command.
1.235     nicm     5149: If present,
                   5150: .Fl I
                   5151: is a comma-separated list of the initial text for each prompt.
1.73      nicm     5152: If
                   5153: .Fl p
                   5154: is given,
                   5155: .Ar prompts
                   5156: is a comma-separated list of prompts which are displayed in order; otherwise
                   5157: a single prompt is displayed, constructed from
                   5158: .Ar template
                   5159: if it is present, or
                   5160: .Ql \&:
                   5161: if not.
1.231     nicm     5162: .Pp
1.73      nicm     5163: Before the command is executed, the first occurrence of the string
                   5164: .Ql %%
1.74      jmc      5165: and all occurrences of
1.73      nicm     5166: .Ql %1
1.492     nicm     5167: are replaced by the response to the first prompt, all
1.73      nicm     5168: .Ql %2
                   5169: are replaced with the response to the second prompt, and so on for further
1.74      jmc      5170: prompts.
                   5171: Up to nine prompt responses may be replaced
                   5172: .Po
                   5173: .Ql %1
1.73      nicm     5174: to
1.74      jmc      5175: .Ql %9
                   5176: .Pc .
1.513     nicm     5177: .Ql %%%
                   5178: is like
                   5179: .Ql %%
                   5180: but any quotation marks are escaped.
1.497     nicm     5181: .Pp
                   5182: .Fl 1
                   5183: makes the prompt only accept one key press, in this case the resulting input
                   5184: is a single character.
1.706     nicm     5185: .Fl k
                   5186: is like
                   5187: .Fl 1
                   5188: but the key press is translated to a key name.
1.678     nicm     5189: .Fl N
                   5190: makes the prompt only accept numeric key presses.
1.517     nicm     5191: .Fl i
                   5192: executes the command every time the prompt input changes instead of when the
                   5193: user exits the command prompt.
1.758     nicm     5194: .Fl T
                   5195: tells
                   5196: .Nm
                   5197: that the prompt is for a target which affects what completions are offered when
                   5198: .Em Tab
                   5199: is pressed;
                   5200: .Fl W
                   5201: is similar but indicates the prompt is for a window.
1.500     nicm     5202: .Pp
                   5203: The following keys have a special meaning in the command prompt, depending
                   5204: on the value of the
                   5205: .Ic status-keys
                   5206: option:
                   5207: .Bl -column "FunctionXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXX" "emacsX" -offset indent
                   5208: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
1.715     nicm     5209: .It Li "Cancel command prompt" Ta "q" Ta "Escape"
1.678     nicm     5210: .It Li "Delete from cursor to start of word" Ta "" Ta "C-w"
1.500     nicm     5211: .It Li "Delete entire command" Ta "d" Ta "C-u"
                   5212: .It Li "Delete from cursor to end" Ta "D" Ta "C-k"
                   5213: .It Li "Execute command" Ta "Enter" Ta "Enter"
                   5214: .It Li "Get next command from history" Ta "" Ta "Down"
                   5215: .It Li "Get previous command from history" Ta "" Ta "Up"
                   5216: .It Li "Insert top paste buffer" Ta "p" Ta "C-y"
                   5217: .It Li "Look for completions" Ta "Tab" Ta "Tab"
                   5218: .It Li "Move cursor left" Ta "h" Ta "Left"
                   5219: .It Li "Move cursor right" Ta "l" Ta "Right"
                   5220: .It Li "Move cursor to end" Ta "$" Ta "C-e"
                   5221: .It Li "Move cursor to next word" Ta "w" Ta "M-f"
                   5222: .It Li "Move cursor to previous word" Ta "b" Ta "M-b"
                   5223: .It Li "Move cursor to start" Ta "0" Ta "C-a"
                   5224: .It Li "Transpose characters" Ta "" Ta "C-t"
                   5225: .El
1.57      jmc      5226: .It Xo Ic confirm-before
1.238     nicm     5227: .Op Fl p Ar prompt
1.57      jmc      5228: .Op Fl t Ar target-client
                   5229: .Ar command
                   5230: .Xc
                   5231: .D1 (alias: Ic confirm )
                   5232: Ask for confirmation before executing
                   5233: .Ar command .
1.238     nicm     5234: If
                   5235: .Fl p
                   5236: is given,
                   5237: .Ar prompt
                   5238: is the prompt to display; otherwise a prompt is constructed from
                   5239: .Ar command .
                   5240: It may contain the special character sequences supported by the
                   5241: .Ic status-left
                   5242: option.
                   5243: .Pp
1.57      jmc      5244: This command works only from inside
                   5245: .Nm .
1.646     nicm     5246: .It Xo Ic display-menu
                   5247: .Op Fl c Ar target-client
                   5248: .Op Fl t Ar target-pane
                   5249: .Op Fl T Ar title
                   5250: .Op Fl x Ar position
                   5251: .Op Fl y Ar position
1.657     nicm     5252: .Ar name
                   5253: .Ar key
                   5254: .Ar command
                   5255: .Ar ...
1.646     nicm     5256: .Xc
1.651     nicm     5257: .D1 (alias: Ic menu )
1.646     nicm     5258: Display a menu on
                   5259: .Ar target-client .
                   5260: .Ar target-pane
                   5261: gives the target for any commands run from the menu.
                   5262: .Pp
1.657     nicm     5263: A menu is passed as a series of arguments: first the menu item name,
                   5264: second the key shortcut (or empty for none) and third the command
                   5265: to run when the menu item is chosen.
                   5266: The name and command are formats, see the
1.646     nicm     5267: .Sx FORMATS
                   5268: and
                   5269: .Sx STYLES
                   5270: sections.
1.658     nicm     5271: If the name begins with a hyphen (-), then the item is disabled (shown dim) and
                   5272: may not be chosen.
1.657     nicm     5273: The name may be empty for a separator line, in which case both the key and
                   5274: command should be omitted.
1.646     nicm     5275: .Pp
                   5276: .Fl T
                   5277: is a format for the menu title (see
                   5278: .Sx FORMATS ) .
                   5279: .Pp
                   5280: .Fl x
                   5281: and
                   5282: .Fl y
                   5283: give the position of the menu.
                   5284: Both may be a row or column number, or one of the following special values:
                   5285: .Bl -column "XXXXX" "XXXX" -offset indent
                   5286: .It Sy "Value" Ta Sy "Flag" Ta Sy "Meaning"
1.719     nicm     5287: .It Li "C" Ta "Both" Ta "The centre of the terminal"
1.646     nicm     5288: .It Li "R" Ta Fl x Ta "The right side of the terminal"
                   5289: .It Li "P" Ta "Both" Ta "The bottom left of the pane"
                   5290: .It Li "M" Ta "Both" Ta "The mouse position"
1.730     nicm     5291: .It Li "W" Ta "Both" Ta "The window position on the status line"
1.646     nicm     5292: .It Li "S" Ta Fl y Ta "The line above or below the status line"
                   5293: .El
                   5294: .Pp
                   5295: Each menu consists of items followed by a key shortcut shown in brackets.
                   5296: If the menu is too large to fit on the terminal, it is not displayed.
                   5297: Pressing the key shortcut chooses the corresponding item.
                   5298: If the mouse is enabled and the menu is opened from a mouse key binding, releasing
                   5299: the mouse button with an item selected will choose that item.
                   5300: The following keys are also available:
                   5301: .Bl -column "Key" "Function" -offset indent
                   5302: .It Sy "Key" Ta Sy "Function"
                   5303: .It Li "Enter" Ta "Choose selected item"
                   5304: .It Li "Up" Ta "Select previous item"
                   5305: .It Li "Down" Ta "Select next item"
                   5306: .It Li "q" Ta "Exit menu"
                   5307: .El
1.57      jmc      5308: .It Xo Ic display-message
1.643     nicm     5309: .Op Fl aIpv
1.215     nicm     5310: .Op Fl c Ar target-client
                   5311: .Op Fl t Ar target-pane
1.57      jmc      5312: .Op Ar message
                   5313: .Xc
                   5314: .D1 (alias: Ic display )
1.127     nicm     5315: Display a message.
                   5316: If
                   5317: .Fl p
                   5318: is given, the output is printed to stdout, otherwise it is displayed in the
                   5319: .Ar target-client
                   5320: status line.
1.122     nicm     5321: The format of
1.124     jmc      5322: .Ar message
1.275     nicm     5323: is described in the
                   5324: .Sx FORMATS
                   5325: section; information is taken from
1.215     nicm     5326: .Ar target-pane
                   5327: if
                   5328: .Fl t
1.678     nicm     5329: is given, otherwise the active pane.
1.622     nicm     5330: .Pp
1.624     nicm     5331: .Fl v
                   5332: prints verbose logging as the format is parsed and
                   5333: .Fl a
                   5334: lists the format variables and their values.
1.643     nicm     5335: .Pp
                   5336: .Fl I
                   5337: forwards any input read from stdin to the empty pane given by
                   5338: .Ar target-pane .
1.721     nicm     5339: .It Xo Ic display-popup
                   5340: .Op Fl CEK
                   5341: .Op Fl c Ar target-client
                   5342: .Op Fl d Ar start-directory
                   5343: .Op Fl h Ar height
                   5344: .Op Fl R Ar shell-command
                   5345: .Op Fl t Ar target-pane
                   5346: .Op Fl w Ar width
                   5347: .Op Fl x Ar position
                   5348: .Op Fl y Ar position
                   5349: .Op Ar command Ar line Ar ...
                   5350: .Xc
                   5351: .D1 (alias: Ic popup )
                   5352: Display a popup on
                   5353: .Ar target-client .
                   5354: A popup is a rectangular box drawn over the top of any panes.
                   5355: Panes are not updated while a popup is present.
                   5356: The popup content may be given in two ways:
                   5357: .Bl -enum -offset Ds
                   5358: .It
                   5359: A set of lines as arguments.
                   5360: Each line is a format which is expanded using
                   5361: .Ar target-pane
                   5362: as the target.
                   5363: If a line contains newlines it is split into multiple lines.
                   5364: Lines may use styles, see the
                   5365: .Sx STYLES
                   5366: section.
                   5367: .It
                   5368: A shell command given by
                   5369: .Fl R
                   5370: which is run and any output shown in the pane.
                   5371: .El
                   5372: .Pp
                   5373: The first argument,
                   5374: .Ar command ,
                   5375: is a
                   5376: .Nm
                   5377: command which is run when a key is pressed.
                   5378: The key is available in the
                   5379: .Ql popup_key
                   5380: format.
                   5381: After
                   5382: .Ar command
                   5383: is run, the popup is closed.
                   5384: It may be empty to discard any key presses.
                   5385: If
                   5386: .Fl K
                   5387: is given together with
1.722     nicm     5388: .Fl R ,
1.721     nicm     5389: key presses are instead passed to the
                   5390: .Fl R
                   5391: shell command.
                   5392: .Fl E
                   5393: closes the popup automatically when
                   5394: .Ar shell-command
                   5395: exits.
1.723     nicm     5396: Two
                   5397: .Fl E
                   5398: closes the popup only if
                   5399: .Ar shell-command
                   5400: exited with success.
1.721     nicm     5401: With
                   5402: .Fl K ,
                   5403: .Ql Escape
                   5404: and
                   5405: .Ql C-c
                   5406: close the popup unless
                   5407: .Fl E
                   5408: is also given.
                   5409: .Pp
                   5410: .Fl x
                   5411: and
                   5412: .Fl y
                   5413: give the position of the popup, they have the same meaning as for the
                   5414: .Ic display-menu
                   5415: command.
                   5416: .Fl w
                   5417: and
                   5418: .Fl h
                   5419: give the width and height - both may be a percentage (followed by
                   5420: .Ql % ) .
                   5421: If omitted, without
                   5422: .Fl R
                   5423: they are calculated from the given lines and with
                   5424: .Fl R
                   5425: they use half the terminal size.
                   5426: .Pp
                   5427: The
                   5428: .Fl C
                   5429: flag closes any popup on the client.
1.57      jmc      5430: .El
                   5431: .Sh BUFFERS
                   5432: .Nm
1.392     nicm     5433: maintains a set of named
1.199     nicm     5434: .Em paste buffers .
1.392     nicm     5435: Each buffer may be either explicitly or automatically named.
                   5436: Explicitly named buffers are named when created with the
                   5437: .Ic set-buffer
                   5438: or
                   5439: .Ic load-buffer
                   5440: commands, or by renaming an automatically named buffer with
                   5441: .Ic set-buffer
                   5442: .Fl n .
                   5443: Automatically named buffers are given a name such as
                   5444: .Ql buffer0001 ,
                   5445: .Ql buffer0002
                   5446: and so on.
                   5447: When the
                   5448: .Ic buffer-limit
                   5449: option is reached, the oldest automatically named buffer is deleted.
1.493     nicm     5450: Explicitly named buffers are not subject to
1.57      jmc      5451: .Ic buffer-limit
1.709     nicm     5452: and may be deleted with the
1.392     nicm     5453: .Ic delete-buffer
                   5454: command.
                   5455: .Pp
1.57      jmc      5456: Buffers may be added using
                   5457: .Ic copy-mode
                   5458: or the
                   5459: .Ic set-buffer
1.392     nicm     5460: and
                   5461: .Ic load-buffer
                   5462: commands, and pasted into a window using the
1.57      jmc      5463: .Ic paste-buffer
                   5464: command.
1.392     nicm     5465: If a buffer command is used and no buffer is specified, the most
                   5466: recently added automatically named buffer is assumed.
1.57      jmc      5467: .Pp
                   5468: A configurable history buffer is also maintained for each window.
                   5469: By default, up to 2000 lines are kept; this can be altered with the
                   5470: .Ic history-limit
                   5471: option (see the
                   5472: .Ic set-option
                   5473: command above).
                   5474: .Pp
                   5475: The buffer commands are as follows:
                   5476: .Bl -tag -width Ds
1.178     nicm     5477: .It Xo
                   5478: .Ic choose-buffer
1.682     nicm     5479: .Op Fl NZr
1.572     nicm     5480: .Op Fl F Ar format
1.562     nicm     5481: .Op Fl f Ar filter
1.561     nicm     5482: .Op Fl O Ar sort-order
1.555     nicm     5483: .Op Fl t Ar target-pane
1.178     nicm     5484: .Op Ar template
                   5485: .Xc
1.555     nicm     5486: Put a pane into buffer mode, where a buffer may be chosen interactively from
                   5487: a list.
1.593     nicm     5488: .Fl Z
                   5489: zooms the pane.
1.555     nicm     5490: The following keys may be used in buffer mode:
                   5491: .Bl -column "Key" "Function" -offset indent
                   5492: .It Sy "Key" Ta Sy "Function"
1.582     nicm     5493: .It Li "Enter" Ta "Paste selected buffer"
1.555     nicm     5494: .It Li "Up" Ta "Select previous buffer"
                   5495: .It Li "Down" Ta "Select next buffer"
1.559     nicm     5496: .It Li "C-s" Ta "Search by name or content"
                   5497: .It Li "n" Ta "Repeat last search"
1.555     nicm     5498: .It Li "t" Ta "Toggle if buffer is tagged"
                   5499: .It Li "T" Ta "Tag no buffers"
                   5500: .It Li "C-t" Ta "Tag all buffers"
1.582     nicm     5501: .It Li "p" Ta "Paste selected buffer"
                   5502: .It Li "P" Ta "Paste tagged buffers"
1.555     nicm     5503: .It Li "d" Ta "Delete selected buffer"
                   5504: .It Li "D" Ta "Delete tagged buffers"
1.759     nicm     5505: .It Li "e" Ta "Open the buffer in an editor"
1.562     nicm     5506: .It Li "f" Ta "Enter a format to filter items"
1.682     nicm     5507: .It Li "O" Ta "Change sort field"
                   5508: .It Li "r" Ta "Reverse sort order"
1.576     nicm     5509: .It Li "v" Ta "Toggle preview"
1.555     nicm     5510: .It Li "q" Ta "Exit mode"
                   5511: .El
                   5512: .Pp
                   5513: After a buffer is chosen,
1.178     nicm     5514: .Ql %%
1.392     nicm     5515: is replaced by the buffer name in
1.178     nicm     5516: .Ar template
                   5517: and the result executed as a command.
                   5518: If
                   5519: .Ar template
                   5520: is not given, "paste-buffer -b '%%'" is used.
1.555     nicm     5521: .Pp
1.561     nicm     5522: .Fl O
1.682     nicm     5523: specifies the initial sort field: one of
1.561     nicm     5524: .Ql time ,
                   5525: .Ql name
                   5526: or
                   5527: .Ql size .
1.682     nicm     5528: .Fl r
                   5529: reverses the sort order.
1.562     nicm     5530: .Fl f
1.579     nicm     5531: specifies an initial filter: the filter is a format - if it evaluates to zero,
                   5532: the item in the list is not shown, otherwise it is shown.
                   5533: If a filter would lead to an empty list, it is ignored.
1.572     nicm     5534: .Fl F
                   5535: specifies the format for each item in the list.
1.576     nicm     5536: .Fl N
                   5537: starts without the preview.
1.314     nicm     5538: This command works only if at least one client is attached.
1.57      jmc      5539: .It Ic clear-history Op Fl t Ar target-pane
                   5540: .D1 (alias: Ic clearhist )
                   5541: Remove and free the history for the specified pane.
1.392     nicm     5542: .It Ic delete-buffer Op Fl b Ar buffer-name
1.57      jmc      5543: .D1 (alias: Ic deleteb )
1.392     nicm     5544: Delete the buffer named
                   5545: .Ar buffer-name ,
                   5546: or the most recently added automatically named buffer if not specified.
1.294     nicm     5547: .It Xo Ic list-buffers
                   5548: .Op Fl F Ar format
1.738     nicm     5549: .Op Fl f Ar filter
1.294     nicm     5550: .Xc
1.57      jmc      5551: .D1 (alias: Ic lsb )
1.198     nicm     5552: List the global buffers.
1.294     nicm     5553: .Fl F
1.738     nicm     5554: specifies the format of each line and
                   5555: .Fl f
                   5556: a filter.
                   5557: Only buffers for which the filter is true are shown.
                   5558: See the
1.294     nicm     5559: .Sx FORMATS
                   5560: section.
1.200     jmc      5561: .It Xo Ic load-buffer
1.392     nicm     5562: .Op Fl b Ar buffer-name
1.57      jmc      5563: .Ar path
                   5564: .Xc
                   5565: .D1 (alias: Ic loadb )
                   5566: Load the contents of the specified paste buffer from
                   5567: .Ar path .
                   5568: .It Xo Ic paste-buffer
1.278     nicm     5569: .Op Fl dpr
1.392     nicm     5570: .Op Fl b Ar buffer-name
1.170     nicm     5571: .Op Fl s Ar separator
1.158     nicm     5572: .Op Fl t Ar target-pane
1.57      jmc      5573: .Xc
                   5574: .D1 (alias: Ic pasteb )
1.158     nicm     5575: Insert the contents of a paste buffer into the specified pane.
                   5576: If not specified, paste into the current one.
1.57      jmc      5577: With
                   5578: .Fl d ,
1.392     nicm     5579: also delete the paste buffer.
1.57      jmc      5580: When output, any linefeed (LF) characters in the paste buffer are replaced with
1.170     nicm     5581: a separator, by default carriage return (CR).
                   5582: A custom separator may be specified using the
                   5583: .Fl s
                   5584: flag.
                   5585: The
1.57      jmc      5586: .Fl r
1.170     nicm     5587: flag means to do no replacement (equivalent to a separator of LF).
1.278     nicm     5588: If
                   5589: .Fl p
                   5590: is specified, paste bracket control codes are inserted around the
                   5591: buffer if the application has requested bracketed paste mode.
1.57      jmc      5592: .It Xo Ic save-buffer
                   5593: .Op Fl a
1.392     nicm     5594: .Op Fl b Ar buffer-name
1.57      jmc      5595: .Ar path
                   5596: .Xc
                   5597: .D1 (alias: Ic saveb )
                   5598: Save the contents of the specified paste buffer to
                   5599: .Ar path .
                   5600: The
                   5601: .Fl a
                   5602: option appends to rather than overwriting the file.
                   5603: .It Xo Ic set-buffer
1.383     nicm     5604: .Op Fl a
1.392     nicm     5605: .Op Fl b Ar buffer-name
                   5606: .Op Fl n Ar new-buffer-name
1.57      jmc      5607: .Ar data
                   5608: .Xc
                   5609: .D1 (alias: Ic setb )
                   5610: Set the contents of the specified buffer to
                   5611: .Ar data .
1.383     nicm     5612: The
                   5613: .Fl a
                   5614: option appends to rather than overwriting the buffer.
1.392     nicm     5615: The
                   5616: .Fl n
                   5617: option renames the buffer to
                   5618: .Ar new-buffer-name .
1.1       nicm     5619: .It Xo Ic show-buffer
1.392     nicm     5620: .Op Fl b Ar buffer-name
1.1       nicm     5621: .Xc
                   5622: .D1 (alias: Ic showb )
                   5623: Display the contents of the specified buffer.
1.57      jmc      5624: .El
                   5625: .Sh MISCELLANEOUS
                   5626: Miscellaneous commands are as follows:
                   5627: .Bl -tag -width Ds
1.72      nicm     5628: .It Ic clock-mode Op Fl t Ar target-pane
1.57      jmc      5629: Display a large clock.
1.334     nicm     5630: .It Xo Ic if-shell
1.410     nicm     5631: .Op Fl bF
1.334     nicm     5632: .Op Fl t Ar target-pane
                   5633: .Ar shell-command command
                   5634: .Op Ar command
                   5635: .Xc
1.57      jmc      5636: .D1 (alias: Ic if )
1.251     nicm     5637: Execute the first
1.57      jmc      5638: .Ar command
                   5639: if
                   5640: .Ar shell-command
1.251     nicm     5641: returns success or the second
                   5642: .Ar command
                   5643: otherwise.
1.410     nicm     5644: Before being executed,
                   5645: .Ar shell-command
                   5646: is expanded using the rules specified in the
1.334     nicm     5647: .Sx FORMATS
                   5648: section, including those relevant to
                   5649: .Ar target-pane .
1.335     nicm     5650: With
                   5651: .Fl b ,
                   5652: .Ar shell-command
                   5653: is run in the background.
1.410     nicm     5654: .Pp
                   5655: If
                   5656: .Fl F
                   5657: is given,
                   5658: .Ar shell-command
                   5659: is not executed but considered success if neither empty nor zero (after formats
                   5660: are expanded).
1.57      jmc      5661: .It Ic lock-server
                   5662: .D1 (alias: Ic lock )
1.90      nicm     5663: Lock each client individually by running the command specified by the
                   5664: .Ic lock-command
                   5665: option.
1.308     nicm     5666: .It Xo Ic run-shell
1.357     nicm     5667: .Op Fl b
1.717     nicm     5668: .Op Fl d Ar delay
1.308     nicm     5669: .Op Fl t Ar target-pane
1.718     nicm     5670: .Op Ar shell-command
1.308     nicm     5671: .Xc
1.87      nicm     5672: .D1 (alias: Ic run )
                   5673: Execute
1.153     nicm     5674: .Ar shell-command
1.106     nicm     5675: in the background without creating a window.
1.334     nicm     5676: Before being executed, shell-command is expanded using the rules specified in
                   5677: the
                   5678: .Sx FORMATS
                   5679: section.
1.335     nicm     5680: With
                   5681: .Fl b ,
                   5682: the command is run in the background.
1.717     nicm     5683: .Fl d
                   5684: waits for
                   5685: .Ar delay
                   5686: seconds before starting the command.
                   5687: After the command finishes, any output to stdout is displayed in view mode (in
                   5688: the pane specified by
1.308     nicm     5689: .Fl t
                   5690: or the current pane if omitted).
1.153     nicm     5691: If the command doesn't return success, the exit status is also displayed.
1.342     nicm     5692: .It Xo Ic wait-for
1.370     nicm     5693: .Op Fl L | S | U
1.342     nicm     5694: .Ar channel
                   5695: .Xc
                   5696: .D1 (alias: Ic wait )
1.343     nicm     5697: When used without options, prevents the client from exiting until woken using
1.342     nicm     5698: .Ic wait-for
                   5699: .Fl S
                   5700: with the same channel.
1.343     nicm     5701: When
                   5702: .Fl L
                   5703: is used, the channel is locked and any clients that try to lock the same
                   5704: channel are made to wait until the channel is unlocked with
                   5705: .Ic wait-for
                   5706: .Fl U .
1.703     nicm     5707: .El
                   5708: .Sh EXIT MESSAGES
                   5709: When a
                   5710: .Nm
                   5711: client detaches, it prints a message.
                   5712: This may be one of:
                   5713: .Bl -tag -width Ds
                   5714: .It [detached (from session ...)]
                   5715: The client was detached normally.
                   5716: .It [detached and SIGHUP]
                   5717: The client was detached and its parent sent the
                   5718: .Dv SIGHUP
                   5719: signal (for example with
                   5720: .Ic detach-client
                   5721: .Fl P ) .
                   5722: .It [lost tty]
                   5723: The client's
                   5724: .Xr tty 4
                   5725: or
                   5726: .Xr pty 4
                   5727: was unexpectedly destroyed.
                   5728: .It [terminated]
                   5729: The client was killed with
                   5730: .Dv SIGTERM .
                   5731: .It [exited]
                   5732: The server exited when it had no sessions.
                   5733: .It [server exited]
                   5734: The server exited when it received
                   5735: .Dv SIGTERM .
                   5736: .It [server exited unexpectedly]
                   5737: The server crashed or otherwise exited without telling the client the reason.
1.228     nicm     5738: .El
                   5739: .Sh TERMINFO EXTENSIONS
                   5740: .Nm
1.478     nicm     5741: understands some unofficial extensions to
1.746     nicm     5742: .Xr terminfo 5 .
1.744     nicm     5743: It is not normally necessary to set these manually, instead the
                   5744: .Ic terminal-features
                   5745: option should be used.
1.228     nicm     5746: .Bl -tag -width Ds
1.756     nicm     5747: .It Em \&AX
                   5748: An existing extension that tells
                   5749: .Nm
                   5750: the terminal supports default colours.
1.739     nicm     5751: .It Em \&Cs , Cr
1.233     nicm     5752: Set the cursor colour.
1.232     jmc      5753: The first takes a single string argument and is used to set the colour;
                   5754: the second takes no arguments and restores the default cursor colour.
                   5755: If set, a sequence such as this may be used
                   5756: to change the cursor colour from inside
                   5757: .Nm :
                   5758: .Bd -literal -offset indent
                   5759: $ printf '\e033]12;red\e033\e\e'
                   5760: .Ed
1.753     nicm     5761: .It Em \&Cmg, \&Clmg, \&Dsmg , \&Enmg
                   5762: Set, clear, disable or enable DECSLRM margins.
1.756     nicm     5763: These are set automatically if the terminal reports it is
                   5764: .Em VT420
                   5765: compatible.
1.755     nicm     5766: .It Em \&Dsbp , \&Enbp
                   5767: Disable and enable bracketed paste.
1.756     nicm     5768: These are set automatically if the
                   5769: .Em XT
                   5770: capability is present.
1.772     nicm     5771: .It Em \&Dseks , \&Eneks
                   5772: Disable and enable extended keys.
1.756     nicm     5773: .It Em \&Dsfcs , \&Enfcs
                   5774: Disable and enable focus reporting.
                   5775: These are set automatically if the
                   5776: .Em XT
                   5777: capability is present.
1.649     nicm     5778: .It Em \&Smol
                   5779: Enable the overline attribute.
1.611     nicm     5780: .It Em \&Smulx
1.672     nicm     5781: Set a styled underscore.
                   5782: The single parameter is one of: 0 for no underscore, 1 for normal
                   5783: underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted
                   5784: underscore and 5 for dashed underscore.
                   5785: .It Em \&Setulc
                   5786: Set the underscore colour.
                   5787: The argument is (red * 65536) + (green * 256) + blue where each is between 0
                   5788: and 255.
1.361     jmc      5789: .It Em \&Ss , Se
1.403     nicm     5790: Set or reset the cursor style.
1.232     jmc      5791: If set, a sequence such as this may be used
                   5792: to change the cursor to an underline:
1.230     nicm     5793: .Bd -literal -offset indent
                   5794: $ printf '\e033[4 q'
                   5795: .Ed
                   5796: .Pp
                   5797: If
1.403     nicm     5798: .Em Se
                   5799: is not set, \&Ss with argument 0 will be used to reset the cursor style instead.
1.741     nicm     5800: .It Em \&Sync
1.745     nicm     5801: Start (parameter is 1) or end (parameter is 2) a synchronized update.
1.478     nicm     5802: .It Em \&Tc
                   5803: Indicate that the terminal supports the
                   5804: .Ql direct colour
                   5805: RGB escape sequence (for example, \ee[38;2;255;255;255m).
1.518     nicm     5806: .Pp
1.612     nicm     5807: If supported, this is used for the initialize colour escape sequence (which
1.518     nicm     5808: may be enabled by adding the
                   5809: .Ql initc
                   5810: and
                   5811: .Ql ccc
                   5812: capabilities to the
                   5813: .Nm
                   5814: .Xr terminfo 5
                   5815: entry).
1.739     nicm     5816: .Pp
                   5817: This is equivalent to the
                   5818: .Em RGB
                   5819: .Xr terminfo 5
                   5820: capability.
1.232     jmc      5821: .It Em \&Ms
1.478     nicm     5822: Store the current buffer in the host terminal's selection (clipboard).
1.232     jmc      5823: See the
                   5824: .Em set-clipboard
                   5825: option above and the
                   5826: .Xr xterm 1
                   5827: man page.
1.756     nicm     5828: .It Em \&XT
                   5829: This is an existing extension capability that tmux uses to mean that the
                   5830: terminal supports the
                   5831: .Xr xterm 1
                   5832: title set sequences and to automatically set some of the capabilities above.
1.345     nicm     5833: .El
                   5834: .Sh CONTROL MODE
                   5835: .Nm
                   5836: offers a textual interface called
                   5837: .Em control mode .
                   5838: This allows applications to communicate with
                   5839: .Nm
                   5840: using a simple text-only protocol.
                   5841: .Pp
                   5842: In control mode, a client sends
                   5843: .Nm
                   5844: commands or command sequences terminated by newlines on standard input.
                   5845: Each command will produce one block of output on standard output.
                   5846: An output block consists of a
                   5847: .Em %begin
                   5848: line followed by the output (which may be empty).
                   5849: The output block ends with a
                   5850: .Em %end
                   5851: or
                   5852: .Em %error .
                   5853: .Em %begin
                   5854: and matching
                   5855: .Em %end
                   5856: or
                   5857: .Em %error
                   5858: have two arguments: an integer time (as seconds from epoch) and command number.
                   5859: For example:
                   5860: .Bd -literal -offset indent
                   5861: %begin 1363006971 2
                   5862: 0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
                   5863: %end 1363006971 2
                   5864: .Ed
1.535     nicm     5865: .Pp
                   5866: The
                   5867: .Ic refresh-client
                   5868: .Fl C
                   5869: command may be used to set the size of a client in control mode.
1.345     nicm     5870: .Pp
                   5871: In control mode,
                   5872: .Nm
                   5873: outputs notifications.
                   5874: A notification will never occur inside an output block.
                   5875: .Pp
                   5876: The following notifications are defined:
                   5877: .Bl -tag -width Ds
1.750     jmc      5878: .It Ic %client-session-changed Ar client session-id name
1.547     nicm     5879: The client is now attached to the session with ID
                   5880: .Ar session-id ,
                   5881: which is named
                   5882: .Ar name .
1.345     nicm     5883: .It Ic %exit Op Ar reason
                   5884: The
                   5885: .Nm
                   5886: client is exiting immediately, either because it is not attached to any session
                   5887: or an error occurred.
                   5888: If present,
                   5889: .Ar reason
                   5890: describes why the client exited.
1.460     nicm     5891: .It Ic %layout-change Ar window-id Ar window-layout Ar window-visible-layout Ar window-flags
1.345     nicm     5892: The layout of a window with ID
                   5893: .Ar window-id
                   5894: changed.
                   5895: The new layout is
                   5896: .Ar window-layout .
1.460     nicm     5897: The window's visible layout is
                   5898: .Ar window-visible-layout
                   5899: and the window flags are
                   5900: .Ar window-flags .
1.347     nicm     5901: .It Ic %output Ar pane-id Ar value
                   5902: A window pane produced output.
1.345     nicm     5903: .Ar value
1.350     nicm     5904: escapes non-printable characters and backslash as octal \\xxx.
1.547     nicm     5905: .It Ic %pane-mode-changed Ar pane-id
                   5906: The pane with ID
                   5907: .Ar pane-id
                   5908: has changed mode.
1.345     nicm     5909: .It Ic %session-changed Ar session-id Ar name
                   5910: The client is now attached to the session with ID
                   5911: .Ar session-id ,
                   5912: which is named
                   5913: .Ar name .
                   5914: .It Ic %session-renamed Ar name
                   5915: The current session was renamed to
                   5916: .Ar name .
1.547     nicm     5917: .It Ic %session-window-changed Ar session-id Ar window-id
                   5918: The session with ID
                   5919: .Ar session-id
                   5920: changed its active window to the window with ID
                   5921: .Ar window-id .
1.345     nicm     5922: .It Ic %sessions-changed
                   5923: A session was created or destroyed.
                   5924: .It Ic %unlinked-window-add Ar window-id
                   5925: The window with ID
                   5926: .Ar window-id
                   5927: was created but is not linked to the current session.
                   5928: .It Ic %window-add Ar window-id
                   5929: The window with ID
                   5930: .Ar window-id
                   5931: was linked to the current session.
                   5932: .It Ic %window-close Ar window-id
                   5933: The window with ID
                   5934: .Ar window-id
                   5935: closed.
1.547     nicm     5936: .It Ic %window-pane-changed Ar window-id Ar pane-id
                   5937: The active pane in the window with ID
                   5938: .Ar window-id
                   5939: changed to the pane with ID
                   5940: .Ar pane-id .
1.345     nicm     5941: .It Ic %window-renamed Ar window-id Ar name
                   5942: The window with ID
                   5943: .Ar window-id
                   5944: was renamed to
                   5945: .Ar name .
1.644     schwarze 5946: .El
                   5947: .Sh ENVIRONMENT
                   5948: When
                   5949: .Nm
                   5950: is started, it inspects the following environment variables:
                   5951: .Bl -tag -width LC_CTYPE
                   5952: .It Ev EDITOR
                   5953: If the command specified in this variable contains the string
                   5954: .Ql vi
                   5955: and
                   5956: .Ev VISUAL
                   5957: is unset, use vi-style key bindings.
                   5958: Overridden by the
                   5959: .Ic mode-keys
                   5960: and
                   5961: .Ic status-keys
                   5962: options.
                   5963: .It Ev HOME
                   5964: The user's login directory.
                   5965: If unset, the
                   5966: .Xr passwd 5
                   5967: database is consulted.
                   5968: .It Ev LC_CTYPE
                   5969: The character encoding
                   5970: .Xr locale 1 .
                   5971: It is used for two separate purposes.
                   5972: For output to the terminal, UTF-8 is used if the
                   5973: .Fl u
                   5974: option is given or if
                   5975: .Ev LC_CTYPE
                   5976: contains
                   5977: .Qq UTF-8
                   5978: or
                   5979: .Qq UTF8 .
                   5980: Otherwise, only ASCII characters are written and non-ASCII characters
                   5981: are replaced with underscores
                   5982: .Pq Ql _ .
                   5983: For input,
                   5984: .Nm
                   5985: always runs with a UTF-8 locale.
                   5986: If en_US.UTF-8 is provided by the operating system it is used and
                   5987: .Ev LC_CTYPE
                   5988: is ignored for input.
                   5989: Otherwise,
                   5990: .Ev LC_CTYPE
                   5991: tells
                   5992: .Nm
                   5993: what the UTF-8 locale is called on the current system.
                   5994: If the locale specified by
                   5995: .Ev LC_CTYPE
                   5996: is not available or is not a UTF-8 locale,
                   5997: .Nm
                   5998: exits with an error message.
                   5999: .It Ev LC_TIME
                   6000: The date and time format
                   6001: .Xr locale 1 .
                   6002: It is used for locale-dependent
                   6003: .Xr strftime 3
                   6004: format specifiers.
                   6005: .It Ev PWD
                   6006: The current working directory to be set in the global environment.
                   6007: This may be useful if it contains symbolic links.
                   6008: If the value of the variable does not match the current working
                   6009: directory, the variable is ignored and the result of
                   6010: .Xr getcwd 3
                   6011: is used instead.
                   6012: .It Ev SHELL
                   6013: The absolute path to the default shell for new windows.
                   6014: See the
                   6015: .Ic default-shell
                   6016: option for details.
                   6017: .It Ev TMUX_TMPDIR
                   6018: The parent directory of the directory containing the server sockets.
                   6019: See the
                   6020: .Fl L
                   6021: option for details.
                   6022: .It Ev VISUAL
                   6023: If the command specified in this variable contains the string
                   6024: .Ql vi ,
                   6025: use vi-style key bindings.
                   6026: Overridden by the
                   6027: .Ic mode-keys
                   6028: and
                   6029: .Ic status-keys
                   6030: options.
1.1       nicm     6031: .El
                   6032: .Sh FILES
1.26      nicm     6033: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1       nicm     6034: .It Pa ~/.tmux.conf
1.6       jmc      6035: Default
1.1       nicm     6036: .Nm
1.6       jmc      6037: configuration file.
1.26      nicm     6038: .It Pa /etc/tmux.conf
                   6039: System-wide configuration file.
1.1       nicm     6040: .El
1.57      jmc      6041: .Sh EXAMPLES
                   6042: To create a new
                   6043: .Nm
                   6044: session running
                   6045: .Xr vi 1 :
                   6046: .Pp
                   6047: .Dl $ tmux new-session vi
                   6048: .Pp
                   6049: Most commands have a shorter form, known as an alias.
                   6050: For new-session, this is
                   6051: .Ic new :
                   6052: .Pp
                   6053: .Dl $ tmux new vi
                   6054: .Pp
                   6055: Alternatively, the shortest unambiguous form of a command is accepted.
                   6056: If there are several options, they are listed:
                   6057: .Bd -literal -offset indent
                   6058: $ tmux n
                   6059: ambiguous command: n, could be: new-session, new-window, next-window
                   6060: .Ed
                   6061: .Pp
                   6062: Within an active session, a new window may be created by typing
                   6063: .Ql C-b c
                   6064: (Ctrl
                   6065: followed by the
                   6066: .Ql b
                   6067: key
                   6068: followed by the
                   6069: .Ql c
                   6070: key).
                   6071: .Pp
                   6072: Windows may be navigated with:
                   6073: .Ql C-b 0
                   6074: (to select window 0),
                   6075: .Ql C-b 1
                   6076: (to select window 1), and so on;
                   6077: .Ql C-b n
                   6078: to select the next window; and
                   6079: .Ql C-b p
                   6080: to select the previous window.
                   6081: .Pp
                   6082: A session may be detached using
                   6083: .Ql C-b d
1.64      nicm     6084: (or by an external event such as
                   6085: .Xr ssh 1
                   6086: disconnection) and reattached with:
1.57      jmc      6087: .Pp
                   6088: .Dl $ tmux attach-session
                   6089: .Pp
                   6090: Typing
                   6091: .Ql C-b \&?
                   6092: lists the current key bindings in the current window; up and down may be used
                   6093: to navigate the list or
                   6094: .Ql q
                   6095: to exit from it.
                   6096: .Pp
                   6097: Commands to be run when the
                   6098: .Nm
                   6099: server is started may be placed in the
                   6100: .Pa ~/.tmux.conf
                   6101: configuration file.
                   6102: Common examples include:
                   6103: .Pp
                   6104: Changing the default prefix key:
                   6105: .Bd -literal -offset indent
                   6106: set-option -g prefix C-a
                   6107: unbind-key C-b
                   6108: bind-key C-a send-prefix
                   6109: .Ed
                   6110: .Pp
                   6111: Turning the status line off, or changing its colour:
                   6112: .Bd -literal -offset indent
                   6113: set-option -g status off
1.378     nicm     6114: set-option -g status-style bg=blue
1.57      jmc      6115: .Ed
                   6116: .Pp
                   6117: Setting other options, such as the default command,
                   6118: or locking after 30 minutes of inactivity:
                   6119: .Bd -literal -offset indent
                   6120: set-option -g default-command "exec /bin/ksh"
                   6121: set-option -g lock-after-time 1800
                   6122: .Ed
                   6123: .Pp
                   6124: Creating new key bindings:
                   6125: .Bd -literal -offset indent
                   6126: bind-key b set-option status
                   6127: bind-key / command-prompt "split-window 'exec man %%'"
1.73      nicm     6128: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57      jmc      6129: .Ed
1.1       nicm     6130: .Sh SEE ALSO
                   6131: .Xr pty 4
                   6132: .Sh AUTHORS
1.477     nicm     6133: .An Nicholas Marriott Aq Mt nicholas.marriott@gmail.com