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

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