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

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