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

1.777   ! nicm        1: .\" $OpenBSD: tmux.1,v 1.776 2020/06/04 07:12:05 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.777   ! nicm       17: .Dd $Mdocdate: June 4 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
1.777   ! nicm     2522: is not given, the command used when the pane was created or last respawned is
        !          2523: executed.
1.234     nicm     2524: The pane must be already inactive, unless
                   2525: .Fl k
                   2526: is given, in which case any existing command is killed.
1.568     nicm     2527: .Fl c
                   2528: specifies a new working directory for the pane.
1.641     nicm     2529: The
                   2530: .Fl e
                   2531: option has the same meaning as for the
                   2532: .Ic new-window
                   2533: command.
1.57      jmc      2534: .It Xo Ic respawn-window
1.641     nicm     2535: .Op Fl k
1.568     nicm     2536: .Op Fl c Ar start-directory
1.641     nicm     2537: .Op Fl e Ar environment
1.57      jmc      2538: .Op Fl t Ar target-window
1.153     nicm     2539: .Op Ar shell-command
1.57      jmc      2540: .Xc
                   2541: .D1 (alias: Ic respawnw )
1.153     nicm     2542: Reactivate a window in which the command has exited (see the
1.57      jmc      2543: .Ic remain-on-exit
                   2544: window option).
                   2545: If
1.153     nicm     2546: .Ar shell-command
1.777   ! nicm     2547: is not given, the command used when the window was created or last respawned is
        !          2548: executed.
1.57      jmc      2549: The window must be already inactive, unless
                   2550: .Fl k
                   2551: is given, in which case any existing command is killed.
1.568     nicm     2552: .Fl c
                   2553: specifies a new working directory for the window.
1.641     nicm     2554: The
                   2555: .Fl e
                   2556: option has the same meaning as for the
                   2557: .Ic new-window
                   2558: command.
1.57      jmc      2559: .It Xo Ic rotate-window
1.681     nicm     2560: .Op Fl DUZ
1.57      jmc      2561: .Op Fl t Ar target-window
                   2562: .Xc
                   2563: .D1 (alias: Ic rotatew )
                   2564: Rotate the positions of the panes within a window, either upward (numerically
                   2565: lower) with
                   2566: .Fl U
                   2567: or downward (numerically higher).
1.681     nicm     2568: .Fl Z
                   2569: keeps the window zoomed if it was zoomed.
1.57      jmc      2570: .It Xo Ic select-layout
1.588     nicm     2571: .Op Fl Enop
                   2572: .Op Fl t Ar target-pane
1.57      jmc      2573: .Op Ar layout-name
                   2574: .Xc
1.176     nicm     2575: .D1 (alias: Ic selectl )
1.57      jmc      2576: Choose a specific layout for a window.
                   2577: If
                   2578: .Ar layout-name
1.181     nicm     2579: is not given, the last preset layout used (if any) is reapplied.
1.204     nicm     2580: .Fl n
                   2581: and
                   2582: .Fl p
                   2583: are equivalent to the
                   2584: .Ic next-layout
                   2585: and
                   2586: .Ic previous-layout
                   2587: commands.
1.424     nicm     2588: .Fl o
                   2589: applies the last set layout if possible (undoes the most recent layout change).
1.588     nicm     2590: .Fl E
                   2591: spreads the current pane and any panes next to it out evenly.
1.156     nicm     2592: .It Xo Ic select-pane
1.681     nicm     2593: .Op Fl DdeLlMmRUZ
1.577     nicm     2594: .Op Fl T Ar title
1.156     nicm     2595: .Op Fl t Ar target-pane
                   2596: .Xc
1.57      jmc      2597: .D1 (alias: Ic selectp )
                   2598: Make pane
                   2599: .Ar target-pane
1.774     nicm     2600: the active pane in its window.
1.156     nicm     2601: If one of
                   2602: .Fl D ,
                   2603: .Fl L ,
                   2604: .Fl R ,
                   2605: or
                   2606: .Fl U
                   2607: is used, respectively the pane below, to the left, to the right, or above the
                   2608: target pane is used.
1.681     nicm     2609: .Fl Z
                   2610: keeps the window zoomed if it was zoomed.
1.204     nicm     2611: .Fl l
                   2612: is the same as using the
                   2613: .Ic last-pane
                   2614: command.
1.398     nicm     2615: .Fl e
                   2616: enables or
                   2617: .Fl d
                   2618: disables input to the pane.
1.668     nicm     2619: .Fl T
                   2620: sets the pane title.
1.418     nicm     2621: .Pp
1.432     nicm     2622: .Fl m
                   2623: and
                   2624: .Fl M
                   2625: are used to set and clear the
                   2626: .Em marked pane .
                   2627: There is one marked pane at a time, setting a new marked pane clears the last.
                   2628: The marked pane is the default target for
                   2629: .Fl s
                   2630: to
                   2631: .Ic join-pane ,
                   2632: .Ic swap-pane
                   2633: and
                   2634: .Ic swap-window .
1.204     nicm     2635: .It Xo Ic select-window
1.310     nicm     2636: .Op Fl lnpT
1.204     nicm     2637: .Op Fl t Ar target-window
                   2638: .Xc
1.57      jmc      2639: .D1 (alias: Ic selectw )
                   2640: Select the window at
                   2641: .Ar target-window .
1.204     nicm     2642: .Fl l ,
                   2643: .Fl n
                   2644: and
                   2645: .Fl p
                   2646: are equivalent to the
                   2647: .Ic last-window ,
                   2648: .Ic next-window
                   2649: and
                   2650: .Ic previous-window
                   2651: commands.
1.310     nicm     2652: If
                   2653: .Fl T
                   2654: is given and the selected window is already the current window,
                   2655: the command behaves like
                   2656: .Ic last-window .
1.57      jmc      2657: .It Xo Ic split-window
1.643     nicm     2658: .Op Fl bdfhIvP
1.272     nicm     2659: .Op Fl c Ar start-directory
1.641     nicm     2660: .Op Fl e Ar environment
1.690     nicm     2661: .Op Fl l Ar size
1.136     nicm     2662: .Op Fl t Ar target-pane
1.153     nicm     2663: .Op Ar shell-command
1.279     nicm     2664: .Op Fl F Ar format
1.57      jmc      2665: .Xc
1.176     nicm     2666: .D1 (alias: Ic splitw )
1.136     nicm     2667: Create a new pane by splitting
                   2668: .Ar target-pane :
1.57      jmc      2669: .Fl h
                   2670: does a horizontal split and
                   2671: .Fl v
                   2672: a vertical split; if neither is specified,
                   2673: .Fl v
                   2674: is assumed.
                   2675: The
                   2676: .Fl l
1.690     nicm     2677: option specifies the size of the new pane in lines (for vertical split) or in
                   2678: columns (for horizontal split);
                   2679: .Ar size
                   2680: may be followed by
                   2681: .Ql %
                   2682: to specify a percentage of the available space.
1.408     nicm     2683: The
                   2684: .Fl b
                   2685: option causes the new pane to be created to the left of or above
                   2686: .Ar target-pane .
1.494     nicm     2687: The
                   2688: .Fl f
                   2689: option creates a new pane spanning the full window height (with
                   2690: .Fl h )
                   2691: or full window width (with
                   2692: .Fl v ) ,
                   2693: instead of splitting the active pane.
1.643     nicm     2694: .Pp
                   2695: An empty
                   2696: .Ar shell-command
                   2697: ('') will create a pane with no command running in it.
                   2698: Output can be sent to such a pane with the
                   2699: .Ic display-message
                   2700: command.
                   2701: The
                   2702: .Fl I
                   2703: flag (if
                   2704: .Ar shell-command
                   2705: is not specified or empty)
                   2706: will create an empty pane and forward any output from stdin to it.
                   2707: For example:
                   2708: .Bd -literal -offset indent
                   2709: $ make 2>&1|tmux splitw -dI &
                   2710: .Ed
                   2711: .Pp
1.136     nicm     2712: All other options have the same meaning as for the
1.57      jmc      2713: .Ic new-window
                   2714: command.
                   2715: .It Xo Ic swap-pane
1.681     nicm     2716: .Op Fl dDUZ
1.57      jmc      2717: .Op Fl s Ar src-pane
                   2718: .Op Fl t Ar dst-pane
                   2719: .Xc
                   2720: .D1 (alias: Ic swapp )
                   2721: Swap two panes.
                   2722: If
                   2723: .Fl U
                   2724: is used and no source pane is specified with
                   2725: .Fl s ,
                   2726: .Ar dst-pane
                   2727: is swapped with the previous pane (before it numerically);
                   2728: .Fl D
                   2729: swaps with the next pane (after it numerically).
1.138     nicm     2730: .Fl d
                   2731: instructs
                   2732: .Nm
1.681     nicm     2733: not to change the active pane and
                   2734: .Fl Z
                   2735: keeps the window zoomed if it was zoomed.
1.432     nicm     2736: .Pp
                   2737: If
                   2738: .Fl s
                   2739: is omitted and a marked pane is present (see
                   2740: .Ic select-pane
                   2741: .Fl m ) ,
                   2742: the marked pane is used rather than the current pane.
1.57      jmc      2743: .It Xo Ic swap-window
                   2744: .Op Fl d
                   2745: .Op Fl s Ar src-window
                   2746: .Op Fl t Ar dst-window
                   2747: .Xc
                   2748: .D1 (alias: Ic swapw )
                   2749: This is similar to
                   2750: .Ic link-window ,
                   2751: except the source and destination windows are swapped.
                   2752: It is an error if no window exists at
                   2753: .Ar src-window .
1.705     nicm     2754: If
                   2755: .Fl d
                   2756: is given, the new window does not become the current window.
1.432     nicm     2757: .Pp
1.705     nicm     2758: If
1.432     nicm     2759: .Fl s
                   2760: is omitted and a marked pane is present (see
                   2761: .Ic select-pane
                   2762: .Fl m ) ,
                   2763: the window containing the marked pane is used rather than the current window.
1.57      jmc      2764: .It Xo Ic unlink-window
1.1       nicm     2765: .Op Fl k
                   2766: .Op Fl t Ar target-window
                   2767: .Xc
1.57      jmc      2768: .D1 (alias: Ic unlinkw )
                   2769: Unlink
                   2770: .Ar target-window .
                   2771: Unless
                   2772: .Fl k
                   2773: is given, a window may be unlinked only if it is linked to multiple sessions -
                   2774: windows may not be linked to no sessions;
                   2775: if
1.1       nicm     2776: .Fl k
1.57      jmc      2777: is specified and the window is linked to only one session, it is unlinked and
                   2778: destroyed.
                   2779: .El
                   2780: .Sh KEY BINDINGS
1.93      nicm     2781: .Nm
                   2782: allows a command to be bound to most keys, with or without a prefix key.
                   2783: When specifying keys, most represent themselves (for example
                   2784: .Ql A
                   2785: to
1.95      jmc      2786: .Ql Z ) .
1.93      nicm     2787: Ctrl keys may be prefixed with
                   2788: .Ql C-
                   2789: or
1.95      jmc      2790: .Ql ^ ,
                   2791: and Alt (meta) with
1.93      nicm     2792: .Ql M- .
                   2793: In addition, the following special key names are accepted:
1.126     nicm     2794: .Em Up ,
                   2795: .Em Down ,
                   2796: .Em Left ,
                   2797: .Em Right ,
1.93      nicm     2798: .Em BSpace ,
                   2799: .Em BTab ,
                   2800: .Em DC
                   2801: (Delete),
                   2802: .Em End ,
                   2803: .Em Enter ,
                   2804: .Em Escape ,
                   2805: .Em F1
                   2806: to
1.402     nicm     2807: .Em F12 ,
1.93      nicm     2808: .Em Home ,
                   2809: .Em IC
                   2810: (Insert),
1.254     nicm     2811: .Em NPage/PageDown/PgDn ,
                   2812: .Em PPage/PageUp/PgUp ,
1.93      nicm     2813: .Em Space ,
                   2814: and
                   2815: .Em Tab .
                   2816: Note that to bind the
                   2817: .Ql \&"
                   2818: or
                   2819: .Ql '
                   2820: keys, quotation marks are necessary, for example:
                   2821: .Bd -literal -offset indent
                   2822: bind-key '"' split-window
1.167     nicm     2823: bind-key "'" new-window
1.93      nicm     2824: .Ed
1.693     nicm     2825: .Pp
                   2826: A command bound to the
                   2827: .Em Any
                   2828: key will execute for all keys which do not have a more specific binding.
1.93      nicm     2829: .Pp
1.57      jmc      2830: Commands related to key bindings are as follows:
                   2831: .Bl -tag -width Ds
                   2832: .It Xo Ic bind-key
1.501     nicm     2833: .Op Fl nr
1.706     nicm     2834: .Op Fl N Ar note
1.421     nicm     2835: .Op Fl T Ar key-table
1.750     jmc      2836: .Ar key command Op Ar arguments
1.1       nicm     2837: .Xc
1.57      jmc      2838: .D1 (alias: Ic bind )
                   2839: Bind key
                   2840: .Ar key
                   2841: to
                   2842: .Ar command .
1.421     nicm     2843: Keys are bound in a key table.
                   2844: By default (without -T), the key is bound in
                   2845: the
                   2846: .Em prefix
                   2847: key table.
                   2848: This table is used for keys pressed after the prefix key (for example,
                   2849: by default
                   2850: .Ql c
                   2851: is bound to
                   2852: .Ic new-window
                   2853: in the
                   2854: .Em prefix
                   2855: table, so
                   2856: .Ql C-b c
                   2857: creates a new window).
                   2858: The
                   2859: .Em root
                   2860: table is used for keys pressed without the prefix key: binding
                   2861: .Ql c
                   2862: to
                   2863: .Ic new-window
                   2864: in the
                   2865: .Em root
                   2866: table (not recommended) means a plain
                   2867: .Ql c
                   2868: will create a new window.
1.57      jmc      2869: .Fl n
1.421     nicm     2870: is an alias
                   2871: for
                   2872: .Fl T Ar root .
                   2873: Keys may also be bound in custom key tables and the
                   2874: .Ic switch-client
                   2875: .Fl T
                   2876: command used to switch to them from a key binding.
1.1       nicm     2877: The
1.57      jmc      2878: .Fl r
                   2879: flag indicates this key may repeat, see the
                   2880: .Ic repeat-time
                   2881: option.
1.706     nicm     2882: .Fl N
                   2883: attaches a note to the key (shown with
                   2884: .Ic list-keys
                   2885: .Fl N ) .
1.57      jmc      2886: .Pp
                   2887: To view the default bindings and possible commands, see the
                   2888: .Ic list-keys
                   2889: command.
1.421     nicm     2890: .It Xo Ic list-keys
1.712     nicm     2891: .Op Fl 1aN
1.706     nicm     2892: .Op Fl P Ar prefix-string Fl T Ar key-table
1.731     nicm     2893: .Op Ar key
1.421     nicm     2894: .Xc
1.57      jmc      2895: .D1 (alias: Ic lsk )
1.710     nicm     2896: List key bindings.
                   2897: There are two forms: the default lists keys as
1.706     nicm     2898: .Ic bind-key
1.710     nicm     2899: commands;
                   2900: .Fl N
                   2901: lists only keys with attached notes and shows only the key and note for each
                   2902: key.
                   2903: .Pp
                   2904: With the default form, all key tables are listed by default.
                   2905: .Fl T
                   2906: lists only keys in
                   2907: .Ar key-table .
                   2908: .Pp
                   2909: With the
1.706     nicm     2910: .Fl N
1.710     nicm     2911: form, only keys in the
1.706     nicm     2912: .Em root
                   2913: and
                   2914: .Em prefix
1.710     nicm     2915: key tables are listed by default;
                   2916: .Fl T
                   2917: also lists only keys in
                   2918: .Ar key-table .
1.706     nicm     2919: .Fl P
1.710     nicm     2920: specifies a prefix to print before each key and
1.706     nicm     2921: .Fl 1
1.710     nicm     2922: lists only the first matching key.
1.712     nicm     2923: .Fl a
                   2924: lists the command for keys that do have a note rather than skipping them.
1.57      jmc      2925: .It Xo Ic send-keys
1.694     nicm     2926: .Op Fl FHlMRX
1.497     nicm     2927: .Op Fl N Ar repeat-count
1.72      nicm     2928: .Op Fl t Ar target-pane
1.57      jmc      2929: .Ar key Ar ...
1.1       nicm     2930: .Xc
1.57      jmc      2931: .D1 (alias: Ic send )
                   2932: Send a key or keys to a window.
                   2933: Each argument
                   2934: .Ar key
                   2935: is the name of the key (such as
                   2936: .Ql C-a
                   2937: or
1.523     nicm     2938: .Ql NPage )
                   2939: to send; if the string is not recognised as a key, it is sent as a series of
1.57      jmc      2940: characters.
1.676     nicm     2941: All arguments are sent sequentially from first to last.
                   2942: .Pp
1.273     nicm     2943: The
                   2944: .Fl l
1.676     nicm     2945: flag disables key name lookup and processes the keys as literal UTF-8
                   2946: characters.
                   2947: The
                   2948: .Fl H
                   2949: flag expects each key to be a hexadecimal number for an ASCII character.
                   2950: .Pp
1.265     nicm     2951: The
                   2952: .Fl R
                   2953: flag causes the terminal state to be reset.
1.419     nicm     2954: .Pp
                   2955: .Fl M
                   2956: passes through a mouse event (only valid if bound to a mouse key binding, see
1.420     jmc      2957: .Sx MOUSE SUPPORT ) .
1.497     nicm     2958: .Pp
                   2959: .Fl X
                   2960: is used to send a command into copy mode - see
                   2961: the
                   2962: .Sx WINDOWS AND PANES
                   2963: section.
                   2964: .Fl N
1.694     nicm     2965: specifies a repeat count and
                   2966: .Fl F
                   2967: expands formats in arguments where appropriate.
1.267     nicm     2968: .It Xo Ic send-prefix
                   2969: .Op Fl 2
                   2970: .Op Fl t Ar target-pane
                   2971: .Xc
                   2972: Send the prefix key, or with
                   2973: .Fl 2
                   2974: the secondary prefix key, to a window as if it was pressed.
1.57      jmc      2975: .It Xo Ic unbind-key
1.501     nicm     2976: .Op Fl an
1.421     nicm     2977: .Op Fl T Ar key-table
1.57      jmc      2978: .Ar key
1.2       nicm     2979: .Xc
1.57      jmc      2980: .D1 (alias: Ic unbind )
                   2981: Unbind the command bound to
                   2982: .Ar key .
1.530     nicm     2983: .Fl n
                   2984: and
1.421     nicm     2985: .Fl T
                   2986: are the same as for
                   2987: .Ic bind-key .
1.189     nicm     2988: If
                   2989: .Fl a
                   2990: is present, all key bindings are removed.
1.57      jmc      2991: .El
                   2992: .Sh OPTIONS
                   2993: The appearance and behaviour of
                   2994: .Nm
                   2995: may be modified by changing the value of various options.
1.668     nicm     2996: There are four types of option:
1.133     nicm     2997: .Em server options ,
1.57      jmc      2998: .Em session options
1.668     nicm     2999: .Em window options
1.57      jmc      3000: and
1.668     nicm     3001: .Em pane options .
1.57      jmc      3002: .Pp
1.133     nicm     3003: The
                   3004: .Nm
1.686     nicm     3005: server has a set of global server options which do not apply to any particular
1.668     nicm     3006: window or session or pane.
1.133     nicm     3007: These are altered with the
                   3008: .Ic set-option
                   3009: .Fl s
                   3010: command, or displayed with the
                   3011: .Ic show-options
                   3012: .Fl s
                   3013: command.
                   3014: .Pp
                   3015: In addition, each individual session may have a set of session options, and
                   3016: there is a separate set of global session options.
1.57      jmc      3017: Sessions which do not have a particular option configured inherit the value
                   3018: from the global session options.
                   3019: Session options are set or unset with the
                   3020: .Ic set-option
                   3021: command and may be listed with the
                   3022: .Ic show-options
                   3023: command.
1.133     nicm     3024: The available server and session options are listed under the
1.57      jmc      3025: .Ic set-option
                   3026: command.
                   3027: .Pp
1.668     nicm     3028: Similarly, a set of window options is attached to each window and a set of pane
                   3029: options to each pane.
                   3030: Pane options inherit from window options.
                   3031: This means any pane option may be set as a window option to apply the option to
                   3032: all panes in the window without the option set, for example these commands will
                   3033: set the background colour to red for all panes except pane 0:
                   3034: .Bd -literal -offset indent
                   3035: set -w window-style bg=red
                   3036: set -pt:.0 window-style bg=blue
                   3037: .Ed
                   3038: .Pp
                   3039: There is also a set of global window options from which any unset window or
                   3040: pane options are inherited.
                   3041: Window and pane options are altered with
                   3042: .Ic set-option
                   3043: .Fl w
                   3044: and
                   3045: .Fl p
                   3046: commands and displayed with
                   3047: .Ic show-option
                   3048: .Fl w
                   3049: and
                   3050: .Fl p .
1.318     nicm     3051: .Pp
                   3052: .Nm
                   3053: also supports user options which are prefixed with a
                   3054: .Ql \&@ .
1.321     jmc      3055: User options may have any name, so long as they are prefixed with
                   3056: .Ql \&@ ,
1.318     nicm     3057: and be set to any string.
1.418     nicm     3058: For example:
1.318     nicm     3059: .Bd -literal -offset indent
1.774     nicm     3060: $ tmux set -wq @foo "abc123"
                   3061: $ tmux show -wv @foo
1.318     nicm     3062: abc123
                   3063: .Ed
1.57      jmc      3064: .Pp
                   3065: Commands which set options are as follows:
                   3066: .Bl -tag -width Ds
1.1       nicm     3067: .It Xo Ic set-option
1.668     nicm     3068: .Op Fl aFgopqsuw
                   3069: .Op Fl t Ar target-pane
1.1       nicm     3070: .Ar option Ar value
                   3071: .Xc
                   3072: .D1 (alias: Ic set )
1.668     nicm     3073: Set a pane option with
                   3074: .Fl p ,
                   3075: a window option with
                   3076: .Fl w ,
1.133     nicm     3077: a server option with
                   3078: .Fl s ,
                   3079: otherwise a session option.
1.637     nicm     3080: If the option is not a user option,
                   3081: .Fl w
1.668     nicm     3082: or
1.637     nicm     3083: .Fl s
1.668     nicm     3084: may be unnecessary -
1.637     nicm     3085: .Nm
1.668     nicm     3086: will infer the type from the option name, assuming
                   3087: .Fl w
                   3088: for pane options.
1.133     nicm     3089: If
                   3090: .Fl g
1.433     nicm     3091: is given, the global session or window option is set.
1.637     nicm     3092: .Pp
1.550     nicm     3093: .Fl F
                   3094: expands formats in the option value.
1.1       nicm     3095: The
                   3096: .Fl u
                   3097: flag unsets an option, so a session inherits the option from the global
1.433     nicm     3098: options (or with
                   3099: .Fl g ,
                   3100: restores a global option to the default).
1.336     nicm     3101: .Pp
                   3102: The
                   3103: .Fl o
1.446     nicm     3104: flag prevents setting an option that is already set and the
1.281     nicm     3105: .Fl q
1.446     nicm     3106: flag suppresses errors about unknown or ambiguous options.
1.281     nicm     3107: .Pp
1.378     nicm     3108: With
                   3109: .Fl a ,
                   3110: and if the option expects a string or a style,
                   3111: .Ar value
                   3112: is appended to the existing setting.
                   3113: For example:
                   3114: .Bd -literal -offset indent
                   3115: set -g status-left "foo"
                   3116: set -ag status-left "bar"
                   3117: .Ed
                   3118: .Pp
                   3119: Will result in
                   3120: .Ql foobar .
                   3121: And:
                   3122: .Bd -literal -offset indent
                   3123: set -g status-style "bg=red"
                   3124: set -ag status-style "fg=blue"
                   3125: .Ed
                   3126: .Pp
                   3127: Will result in a red background
                   3128: .Em and
                   3129: blue foreground.
                   3130: Without
                   3131: .Fl a ,
                   3132: the result would be the default background and a blue foreground.
1.668     nicm     3133: .It Xo Ic show-options
                   3134: .Op Fl AgHpqsvw
                   3135: .Op Fl t Ar target-pane
                   3136: .Op Ar option
                   3137: .Xc
                   3138: .D1 (alias: Ic show )
                   3139: Show the pane options (or a single option if
                   3140: .Ar option
                   3141: is provided) with
                   3142: .Fl p ,
                   3143: the window options with
                   3144: .Fl w ,
                   3145: the server options with
                   3146: .Fl s ,
                   3147: otherwise the session options.
                   3148: If the option is not a user option,
                   3149: .Fl w
                   3150: or
                   3151: .Fl s
                   3152: may be unnecessary -
                   3153: .Nm
                   3154: will infer the type from the option name, assuming
                   3155: .Fl w
                   3156: for pane options.
                   3157: Global session or window options are listed if
                   3158: .Fl g
                   3159: is used.
                   3160: .Fl v
                   3161: shows only the option value, not the name.
                   3162: If
                   3163: .Fl q
                   3164: is set, no error will be returned if
                   3165: .Ar option
                   3166: is unset.
                   3167: .Fl H
                   3168: includes hooks (omitted by default).
                   3169: .Fl A
                   3170: includes options inherited from a parent set of options, such options are
                   3171: marked with an asterisk.
1.274     nicm     3172: .Ar value
                   3173: depends on the option and may be a number, a string, or a flag (on, off, or
                   3174: omitted to toggle).
1.668     nicm     3175: .El
1.133     nicm     3176: .Pp
                   3177: Available server options are:
                   3178: .Bl -tag -width Ds
1.695     nicm     3179: .It Ic backspace Ar key
                   3180: Set the key sent by
                   3181: .Nm
                   3182: for backspace.
1.198     nicm     3183: .It Ic buffer-limit Ar number
                   3184: Set the number of buffers; as new buffers are added to the top of the stack,
                   3185: old ones are removed from the bottom if necessary to maintain this maximum
                   3186: length.
1.526     nicm     3187: .It Xo Ic command-alias[]
                   3188: .Ar name=value
                   3189: .Xc
                   3190: This is an array of custom aliases for commands.
                   3191: If an unknown command matches
                   3192: .Ar name ,
                   3193: it is replaced with
                   3194: .Ar value .
                   3195: For example, after:
                   3196: .Pp
1.565     nicm     3197: .Dl set -s command-alias[100] zoom='resize-pane -Z'
1.526     nicm     3198: .Pp
                   3199: Using:
                   3200: .Pp
                   3201: .Dl zoom -t:.1
                   3202: .Pp
                   3203: Is equivalent to:
                   3204: .Pp
                   3205: .Dl resize-pane -Z -t:.1
                   3206: .Pp
                   3207: Note that aliases are expanded when a command is parsed rather than when it is
                   3208: executed, so binding an alias with
                   3209: .Ic bind-key
                   3210: will bind the expanded form.
1.425     nicm     3211: .It Ic default-terminal Ar terminal
                   3212: Set the default terminal for new windows created in this session - the
                   3213: default value of the
                   3214: .Ev TERM
                   3215: environment variable.
                   3216: For
                   3217: .Nm
                   3218: to work correctly, this
                   3219: .Em must
                   3220: be set to
                   3221: .Ql screen ,
                   3222: .Ql tmux
                   3223: or a derivative of them.
1.742     nicm     3224: .It Ic copy-command Ar shell-command
                   3225: Give the command to pipe to if the
                   3226: .Ic copy-pipe
                   3227: copy mode command is used without arguments.
1.239     nicm     3228: .It Ic escape-time Ar time
                   3229: Set the time in milliseconds for which
                   3230: .Nm
                   3231: waits after an escape is input to determine if it is part of a function or meta
                   3232: key sequences.
                   3233: The default is 500 milliseconds.
1.759     nicm     3234: .It Ic editor Ar shell-command
                   3235: Set the command used when
                   3236: .Nm
                   3237: runs an editor.
1.592     nicm     3238: .It Xo Ic exit-empty
                   3239: .Op Ic on | off
                   3240: .Xc
                   3241: If enabled (the default), the server will exit when there are no active
                   3242: sessions.
1.239     nicm     3243: .It Xo Ic exit-unattached
                   3244: .Op Ic on | off
                   3245: .Xc
                   3246: If enabled, the server will exit when there are no attached clients.
1.772     nicm     3247: .It Xo Ic extended-keys
                   3248: .Op Ic on | off
                   3249: .Xc
                   3250: When enabled, extended keys are requested from the terminal and if supported
                   3251: are recognised by
                   3252: .Nm .
1.362     nicm     3253: .It Xo Ic focus-events
                   3254: .Op Ic on | off
                   3255: .Xc
                   3256: When enabled, focus events are requested from the terminal if supported and
                   3257: passed through to applications running in
                   3258: .Nm .
                   3259: Attached clients should be detached and attached again after changing this
                   3260: option.
1.445     nicm     3261: .It Ic history-file Ar path
                   3262: If not empty, a file to which
                   3263: .Nm
                   3264: will write command prompt history on exit and load it from on start.
1.384     nicm     3265: .It Ic message-limit Ar number
                   3266: Set the number of error or information messages to save in the message log for
                   3267: each client.
                   3268: The default is 100.
1.228     nicm     3269: .It Xo Ic set-clipboard
1.556     nicm     3270: .Op Ic on | external | off
1.228     nicm     3271: .Xc
                   3272: Attempt to set the terminal clipboard content using the
                   3273: .Xr xterm 1
1.560     nicm     3274: escape sequence, if there is an
1.228     nicm     3275: .Em \&Ms
                   3276: entry in the
                   3277: .Xr terminfo 5
1.560     nicm     3278: description (see the
                   3279: .Sx TERMINFO EXTENSIONS
                   3280: section).
                   3281: .Pp
1.556     nicm     3282: If set to
                   3283: .Ic on ,
                   3284: .Nm
                   3285: will both accept the escape sequence to create a buffer and attempt to set
                   3286: the terminal clipboard.
                   3287: If set to
                   3288: .Ic external ,
                   3289: .Nm
                   3290: will attempt to set the terminal clipboard but ignore attempts
                   3291: by applications to set
                   3292: .Nm
                   3293: buffers.
                   3294: If
                   3295: .Ic off ,
                   3296: .Nm
                   3297: will neither accept the clipboard escape sequence nor attempt to set the
                   3298: clipboard.
                   3299: .Pp
1.228     nicm     3300: Note that this feature needs to be enabled in
                   3301: .Xr xterm 1
                   3302: by setting the resource:
                   3303: .Bd -literal -offset indent
                   3304: disallowedWindowOps: 20,21,SetXprop
                   3305: .Ed
                   3306: .Pp
                   3307: Or changing this property from the
                   3308: .Xr xterm 1
                   3309: interactive menu when required.
1.744     nicm     3310: .It Ic terminal-features[] Ar string
                   3311: Set terminal features for terminal types read from
                   3312: .Xr terminfo 5 .
                   3313: .Nm
                   3314: has a set of named terminal features.
                   3315: Each will apply appropriate changes to the
                   3316: .Xr terminfo 5
                   3317: entry in use.
                   3318: .Pp
                   3319: .Nm
                   3320: can detect features for a few common terminals; this option can be used to
                   3321: easily tell tmux about features supported by terminals it cannot detect.
                   3322: The
                   3323: .Ic terminal-overrides
                   3324: option allows individual
                   3325: .Xr terminfo 5
                   3326: capabilities to be set instead,
                   3327: .Ic terminal-features
                   3328: is intended for classes of functionality supported in a standard way but not
                   3329: reported by
                   3330: .Xr terminfo 5 .
                   3331: Care must be taken only to configure this with features the terminal actually
                   3332: support.
                   3333: .Pp
                   3334: This is an array option where each entry is a colon-separated string made up
                   3335: of a terminal type pattern (matched using
                   3336: .Xr fnmatch 3 )
                   3337: followed by a list of terminal features.
                   3338: The available features are:
                   3339: .Bl -tag -width Ds
                   3340: .It 256
                   3341: Supports 256 colours with the SGR escape sequences.
                   3342: .It clipboard
                   3343: Allows setting the system clipboard.
                   3344: .It ccolour
                   3345: Allows setting the cursor colour.
                   3346: .It cstyle
                   3347: Allows setting the cursor style.
                   3348: .It margins
                   3349: Supports DECSLRM margins.
                   3350: .It overline
                   3351: Supports the overline SGR attribute.
                   3352: .It rectfill
                   3353: Supports the DECFRA rectangle fill escape sequence.
                   3354: .It RGB
                   3355: Supports RGB colour with the SGR escape sequences.
                   3356: .It sync
                   3357: Supports synchronized updates.
                   3358: .It title
                   3359: Supports
                   3360: .Xr xterm 1
                   3361: title setting.
                   3362: .It usstyle
                   3363: Allows underscore style and colour to be set.
                   3364: .It UTF-8
                   3365: Is able to handle UTF-8 output.
                   3366: .El
1.528     nicm     3367: .It Ic terminal-overrides[] Ar string
                   3368: Allow terminal descriptions read using
                   3369: .Xr terminfo 5
1.531     nicm     3370: to be overridden.
1.528     nicm     3371: Each entry is a colon-separated string made up of a terminal type pattern
                   3372: (matched using
1.381     nicm     3373: .Xr fnmatch 3 )
                   3374: and a set of
                   3375: .Em name=value
                   3376: entries.
                   3377: .Pp
                   3378: For example, to set the
                   3379: .Ql clear
                   3380: .Xr terminfo 5
                   3381: entry to
                   3382: .Ql \ee[H\ee[2J
1.528     nicm     3383: for all terminal types matching
                   3384: .Ql rxvt* :
                   3385: .Pp
                   3386: .Dl "rxvt*:clear=\ee[H\ee[2J"
1.381     nicm     3387: .Pp
                   3388: The terminal entry value is passed through
                   3389: .Xr strunvis 3
                   3390: before interpretation.
1.678     nicm     3391: .It Ic user-keys[] Ar key
                   3392: Set list of user-defined key escape sequences.
                   3393: Each item is associated with a key named
                   3394: .Ql User0 ,
                   3395: .Ql User1 ,
                   3396: and so on.
                   3397: .Pp
                   3398: For example:
                   3399: .Bd -literal -offset indent
                   3400: set -s user-keys[0] "\ee[5;30012~"
                   3401: bind User0 resize-pane -L 3
                   3402: .Ed
1.133     nicm     3403: .El
1.129     nicm     3404: .Pp
1.18      nicm     3405: Available session options are:
1.1       nicm     3406: .Bl -tag -width Ds
1.569     nicm     3407: .It Xo Ic activity-action
                   3408: .Op Ic any | none | current | other
                   3409: .Xc
                   3410: Set action on window activity when
                   3411: .Ic monitor-activity
                   3412: is on.
                   3413: .Ic any
                   3414: means activity in any window linked to a session causes a bell or message
                   3415: (depending on
                   3416: .Ic visual-activity )
                   3417: in the current window of that session,
                   3418: .Ic none
                   3419: means all activity is ignored (equivalent to
                   3420: .Ic monitor-activity
                   3421: being off),
                   3422: .Ic current
                   3423: means only activity in windows other than the current window are ignored and
                   3424: .Ic other
                   3425: means activity in the current window is ignored but not those in other windows.
1.312     nicm     3426: .It Ic assume-paste-time Ar milliseconds
                   3427: If keys are entered faster than one in
                   3428: .Ar milliseconds ,
                   3429: they are assumed to have been pasted rather than typed and
                   3430: .Nm
                   3431: key bindings are not processed.
                   3432: The default is one millisecond and zero disables.
1.69      nicm     3433: .It Ic base-index Ar index
                   3434: Set the base index from which an unused index should be searched when a new
                   3435: window is created.
                   3436: The default is zero.
1.1       nicm     3437: .It Xo Ic bell-action
1.429     nicm     3438: .Op Ic any | none | current | other
1.1       nicm     3439: .Xc
1.574     nicm     3440: Set action on a bell in a window when
                   3441: .Ic monitor-bell
                   3442: is on.
1.569     nicm     3443: The values are the same as those for
                   3444: .Ic activity-action .
1.153     nicm     3445: .It Ic default-command Ar shell-command
1.1       nicm     3446: Set the command used for new windows (if not specified when the window is
                   3447: created) to
1.153     nicm     3448: .Ar shell-command ,
1.79      nicm     3449: which may be any
                   3450: .Xr sh 1
                   3451: command.
1.19      nicm     3452: The default is an empty string, which instructs
                   3453: .Nm
1.79      nicm     3454: to create a login shell using the value of the
                   3455: .Ic default-shell
                   3456: option.
                   3457: .It Ic default-shell Ar path
                   3458: Specify the default shell.
                   3459: This is used as the login shell for new windows when the
                   3460: .Ic default-command
                   3461: option is set to empty, and must be the full path of the executable.
                   3462: When started
                   3463: .Nm
                   3464: tries to set a default value from the first suitable of the
1.19      nicm     3465: .Ev SHELL
1.79      nicm     3466: environment variable, the shell returned by
                   3467: .Xr getpwuid 3 ,
                   3468: or
                   3469: .Pa /bin/sh .
                   3470: This option should be configured when
                   3471: .Nm
                   3472: is used as a login shell.
1.629     nicm     3473: .It Ic default-size Ar XxY
1.642     nicm     3474: Set the default size of new windows when the
1.643     nicm     3475: .Ic window-size
1.642     nicm     3476: option is set to manual or when a session is created with
                   3477: .Ic new-session
                   3478: .Fl d .
                   3479: The value is the width and height separated by an
                   3480: .Ql x
                   3481: character.
                   3482: The default is 80x24.
1.206     nicm     3483: .It Xo Ic destroy-unattached
                   3484: .Op Ic on | off
                   3485: .Xc
1.185     nicm     3486: If enabled and the session is no longer attached to any clients, it is
                   3487: destroyed.
1.206     nicm     3488: .It Xo Ic detach-on-destroy
                   3489: .Op Ic on | off
                   3490: .Xc
1.184     nicm     3491: If on (the default), the client is detached when the session it is attached to
                   3492: is destroyed.
                   3493: If off, the client is switched to the most recently active of the remaining
                   3494: sessions.
1.145     nicm     3495: .It Ic display-panes-active-colour Ar colour
                   3496: Set the colour used by the
                   3497: .Ic display-panes
                   3498: command to show the indicator for the active pane.
1.78      nicm     3499: .It Ic display-panes-colour Ar colour
1.145     nicm     3500: Set the colour used by the
1.78      nicm     3501: .Ic display-panes
1.145     nicm     3502: command to show the indicators for inactive panes.
1.78      nicm     3503: .It Ic display-panes-time Ar time
                   3504: Set the time in milliseconds for which the indicators shown by the
                   3505: .Ic display-panes
                   3506: command appear.
1.21      nicm     3507: .It Ic display-time Ar time
1.78      nicm     3508: Set the amount of time for which status line messages and other on-screen
                   3509: indicators are displayed.
1.462     tim      3510: If set to 0, messages and indicators are displayed until a key is pressed.
1.21      nicm     3511: .Ar time
                   3512: is in milliseconds.
1.1       nicm     3513: .It Ic history-limit Ar lines
                   3514: Set the maximum number of lines held in window history.
                   3515: This setting applies only to new windows - existing window histories are not
                   3516: resized and retain the limit at the point they were created.
1.474     nicm     3517: .It Ic key-table Ar key-table
                   3518: Set the default key table to
                   3519: .Ar key-table
                   3520: instead of
                   3521: .Em root .
1.1       nicm     3522: .It Ic lock-after-time Ar number
1.100     nicm     3523: Lock the session (like the
                   3524: .Ic lock-session
1.90      nicm     3525: command) after
1.1       nicm     3526: .Ar number
1.448     nicm     3527: seconds of inactivity.
1.100     nicm     3528: The default is not to lock (set to 0).
1.153     nicm     3529: .It Ic lock-command Ar shell-command
1.90      nicm     3530: Command to run when locking each client.
                   3531: The default is to run
                   3532: .Xr lock 1
                   3533: with
                   3534: .Fl np .
1.378     nicm     3535: .It Ic message-command-style Ar style
1.623     nicm     3536: Set status line message command style.
1.737     nicm     3537: This is used for the command prompt with
                   3538: .Xr vi 1
                   3539: keys when in command mode.
1.623     nicm     3540: For how to specify
                   3541: .Ar style ,
                   3542: see the
                   3543: .Sx STYLES
                   3544: section.
1.378     nicm     3545: .It Ic message-style Ar style
                   3546: Set status line message style.
1.737     nicm     3547: This is used for messages and for the command prompt.
1.378     nicm     3548: For how to specify
                   3549: .Ar style ,
                   3550: see the
1.623     nicm     3551: .Sx STYLES
                   3552: section.
1.419     nicm     3553: .It Xo Ic mouse
1.226     nicm     3554: .Op Ic on | off
                   3555: .Xc
                   3556: If on,
                   3557: .Nm
1.419     nicm     3558: captures the mouse and allows mouse events to be bound as key bindings.
                   3559: See the
                   3560: .Sx MOUSE SUPPORT
                   3561: section for details.
1.267     nicm     3562: .It Ic prefix Ar key
                   3563: Set the key accepted as a prefix key.
1.473     nicm     3564: In addition to the standard keys described under
                   3565: .Sx KEY BINDINGS ,
                   3566: .Ic prefix
                   3567: can be set to the special key
                   3568: .Ql None
                   3569: to set no prefix.
1.267     nicm     3570: .It Ic prefix2 Ar key
                   3571: Set a secondary key accepted as a prefix key.
1.473     nicm     3572: Like
                   3573: .Ic prefix ,
                   3574: .Ic prefix2
                   3575: can be set to
                   3576: .Ql None .
1.291     nicm     3577: .It Xo Ic renumber-windows
                   3578: .Op Ic on | off
                   3579: .Xc
                   3580: If on, when a window is closed in a session, automatically renumber the other
                   3581: windows in numerical order.
                   3582: This respects the
                   3583: .Ic base-index
                   3584: option if it has been set.
                   3585: If off, do not renumber the windows.
1.21      nicm     3586: .It Ic repeat-time Ar time
1.1       nicm     3587: Allow multiple commands to be entered without pressing the prefix-key again
                   3588: in the specified
1.21      nicm     3589: .Ar time
1.1       nicm     3590: milliseconds (the default is 500).
                   3591: Whether a key repeats may be set when it is bound using the
                   3592: .Fl r
                   3593: flag to
                   3594: .Ic bind-key .
1.52      nicm     3595: Repeat is enabled for the default keys bound to the
                   3596: .Ic resize-pane
                   3597: command.
1.1       nicm     3598: .It Xo Ic set-titles
1.56      jmc      3599: .Op Ic on | off
1.1       nicm     3600: .Xc
1.261     nicm     3601: Attempt to set the client terminal title using the
                   3602: .Em tsl
                   3603: and
                   3604: .Em fsl
                   3605: .Xr terminfo 5
                   3606: entries if they exist.
                   3607: .Nm
1.444     nicm     3608: automatically sets these to the \ee]0;...\e007 sequence if
                   3609: the terminal appears to be
                   3610: .Xr xterm 1 .
1.11      nicm     3611: This option is off by default.
1.86      nicm     3612: .It Ic set-titles-string Ar string
1.678     nicm     3613: String used to set the client terminal title if
1.86      nicm     3614: .Ic set-titles
                   3615: is on.
1.414     nicm     3616: Formats are expanded, see the
                   3617: .Sx FORMATS
                   3618: section.
1.569     nicm     3619: .It Xo Ic silence-action
                   3620: .Op Ic any | none | current | other
                   3621: .Xc
                   3622: Set action on window silence when
                   3623: .Ic monitor-silence
                   3624: is on.
                   3625: The values are the same as those for
                   3626: .Ic activity-action .
1.1       nicm     3627: .It Xo Ic status
1.625     nicm     3628: .Op Ic off | on | 2 | 3 | 4 | 5
1.1       nicm     3629: .Xc
1.625     nicm     3630: Show or hide the status line or specify its size.
                   3631: Using
                   3632: .Ic on
                   3633: gives a status line one row in height;
                   3634: .Ic 2 ,
                   3635: .Ic 3 ,
                   3636: .Ic 4
                   3637: or
                   3638: .Ic 5
                   3639: more rows.
                   3640: .It Ic status-format[] Ar format
                   3641: Specify the format to be used for each line of the status line.
                   3642: The default builds the top status line from the various individual status
                   3643: options below.
1.1       nicm     3644: .It Ic status-interval Ar interval
1.538     nicm     3645: Update the status line every
1.1       nicm     3646: .Ar interval
                   3647: seconds.
                   3648: By default, updates will occur every 15 seconds.
                   3649: A setting of zero disables redrawing at interval.
1.41      nicm     3650: .It Xo Ic status-justify
1.56      jmc      3651: .Op Ic left | centre | right
1.41      nicm     3652: .Xc
                   3653: Set the position of the window list component of the status line: left, centre
                   3654: or right justified.
1.1       nicm     3655: .It Xo Ic status-keys
1.56      jmc      3656: .Op Ic vi | emacs
1.1       nicm     3657: .Xc
1.6       jmc      3658: Use vi or emacs-style
1.1       nicm     3659: key bindings in the status line, for example at the command prompt.
1.191     nicm     3660: The default is emacs, unless the
                   3661: .Ev VISUAL
                   3662: or
                   3663: .Ev EDITOR
                   3664: environment variables are set and contain the string
                   3665: .Ql vi .
1.1       nicm     3666: .It Ic status-left Ar string
                   3667: Display
                   3668: .Ar string
1.538     nicm     3669: (by default the session name) to the left of the status line.
1.1       nicm     3670: .Ar string
                   3671: will be passed through
1.623     nicm     3672: .Xr strftime 3 .
                   3673: Also see the
                   3674: .Sx FORMATS
                   3675: and
                   3676: .Sx STYLES
                   3677: sections.
1.83      nicm     3678: .Pp
1.263     nicm     3679: For details on how the names and titles can be set see the
1.261     nicm     3680: .Sx "NAMES AND TITLES"
                   3681: section.
1.109     nicm     3682: .Pp
1.83      nicm     3683: Examples are:
                   3684: .Bd -literal -offset indent
                   3685: #(sysctl vm.loadavg)
                   3686: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
                   3687: .Ed
1.10      nicm     3688: .Pp
1.405     nicm     3689: The default is
                   3690: .Ql "[#S] " .
1.1       nicm     3691: .It Ic status-left-length Ar length
                   3692: Set the maximum
                   3693: .Ar length
1.538     nicm     3694: of the left component of the status line.
1.1       nicm     3695: The default is 10.
1.378     nicm     3696: .It Ic status-left-style Ar style
                   3697: Set the style of the left part of the status line.
                   3698: For how to specify
                   3699: .Ar style ,
                   3700: see the
1.623     nicm     3701: .Sx STYLES
                   3702: section.
1.269     nicm     3703: .It Xo Ic status-position
                   3704: .Op Ic top | bottom
                   3705: .Xc
                   3706: Set the position of the status line.
1.1       nicm     3707: .It Ic status-right Ar string
                   3708: Display
                   3709: .Ar string
1.538     nicm     3710: to the right of the status line.
1.577     nicm     3711: By default, the current pane title in double quotes, the date and the time
1.151     nicm     3712: are shown.
1.1       nicm     3713: As with
                   3714: .Ic status-left ,
                   3715: .Ar string
                   3716: will be passed to
1.459     jmc      3717: .Xr strftime 3
                   3718: and character pairs are replaced.
1.1       nicm     3719: .It Ic status-right-length Ar length
                   3720: Set the maximum
                   3721: .Ar length
1.538     nicm     3722: of the right component of the status line.
1.1       nicm     3723: The default is 40.
1.378     nicm     3724: .It Ic status-right-style Ar style
                   3725: Set the style of the right part of the status line.
                   3726: For how to specify
                   3727: .Ar style ,
                   3728: see the
1.623     nicm     3729: .Sx STYLES
                   3730: section.
1.378     nicm     3731: .It Ic status-style Ar style
                   3732: Set status line style.
                   3733: For how to specify
                   3734: .Ar style ,
                   3735: see the
1.623     nicm     3736: .Sx STYLES
                   3737: section.
1.529     nicm     3738: .It Ic update-environment[] Ar variable
                   3739: Set list of environment variables to be copied into the session environment
                   3740: when a new session is created or an existing session is attached.
1.63      nicm     3741: Any variables that do not exist in the source environment are set to be
                   3742: removed from the session environment (as if
                   3743: .Fl r
                   3744: was given to the
                   3745: .Ic set-environment
                   3746: command).
1.37      nicm     3747: .It Xo Ic visual-activity
1.569     nicm     3748: .Op Ic on | off | both
1.37      nicm     3749: .Xc
1.569     nicm     3750: If on, display a message instead of sending a bell when activity occurs in a
                   3751: window for which the
1.37      nicm     3752: .Ic monitor-activity
                   3753: window option is enabled.
1.569     nicm     3754: If set to both, a bell and a message are produced.
1.37      nicm     3755: .It Xo Ic visual-bell
1.569     nicm     3756: .Op Ic on | off | both
1.37      nicm     3757: .Xc
1.574     nicm     3758: If on, a message is shown on a bell in a window for which the
                   3759: .Ic monitor-bell
                   3760: window option is enabled instead of it being passed through to the
1.569     nicm     3761: terminal (which normally makes a sound).
                   3762: If set to both, a bell and a message are produced.
1.37      nicm     3763: Also see the
                   3764: .Ic bell-action
                   3765: option.
1.192     nicm     3766: .It Xo Ic visual-silence
1.569     nicm     3767: .Op Ic on | off | both
1.192     nicm     3768: .Xc
                   3769: If
                   3770: .Ic monitor-silence
1.569     nicm     3771: is enabled, prints a message after the interval has expired on a given window
                   3772: instead of sending a bell.
                   3773: If set to both, a bell and a message are produced.
1.255     nicm     3774: .It Ic word-separators Ar string
                   3775: Sets the session's conception of what characters are considered word
                   3776: separators, for the purposes of the next and previous word commands in
                   3777: copy mode.
                   3778: The default is
                   3779: .Ql \ -_@ .
1.1       nicm     3780: .El
                   3781: .Pp
1.668     nicm     3782: Available window options are:
1.56      jmc      3783: .Pp
                   3784: .Bl -tag -width Ds -compact
1.1       nicm     3785: .It Xo Ic aggressive-resize
1.56      jmc      3786: .Op Ic on | off
1.1       nicm     3787: .Xc
                   3788: Aggressively resize the chosen window.
                   3789: This means that
                   3790: .Nm
1.642     nicm     3791: will resize the window to the size of the smallest or largest session
                   3792: (see the
                   3793: .Ic window-size
                   3794: option) for which it is the current window, rather than the session to
                   3795: which it is attached.
                   3796: The window may resize when the current window is changed on another
                   3797: session; this option is good for full-screen programs which support
1.6       jmc      3798: .Dv SIGWINCH
                   3799: and poor for interactive programs such as shells.
1.262     nicm     3800: .Pp
1.1       nicm     3801: .It Xo Ic automatic-rename
1.56      jmc      3802: .Op Ic on | off
1.1       nicm     3803: .Xc
                   3804: Control automatic window renaming.
                   3805: When this setting is enabled,
                   3806: .Nm
1.368     nicm     3807: will rename the window automatically using the format specified by
                   3808: .Ic automatic-rename-format .
1.1       nicm     3809: This flag is automatically disabled for an individual window when a name
                   3810: is specified at creation with
1.186     nicm     3811: .Ic new-window
                   3812: or
1.1       nicm     3813: .Ic new-session ,
                   3814: or later with
1.261     nicm     3815: .Ic rename-window ,
                   3816: or with a terminal escape sequence.
1.1       nicm     3817: It may be switched off globally with:
                   3818: .Bd -literal -offset indent
1.668     nicm     3819: set-option -wg automatic-rename off
1.1       nicm     3820: .Ed
1.368     nicm     3821: .Pp
                   3822: .It Ic automatic-rename-format Ar format
                   3823: The format (see
                   3824: .Sx FORMATS )
                   3825: used when the
                   3826: .Ic automatic-rename
                   3827: option is enabled.
1.56      jmc      3828: .Pp
1.1       nicm     3829: .It Ic clock-mode-colour Ar colour
                   3830: Set clock colour.
1.56      jmc      3831: .Pp
1.1       nicm     3832: .It Xo Ic clock-mode-style
1.56      jmc      3833: .Op Ic 12 | 24
1.1       nicm     3834: .Xc
                   3835: Set clock hour format.
1.56      jmc      3836: .Pp
1.196     nicm     3837: .It Ic main-pane-height Ar height
1.2       nicm     3838: .It Ic main-pane-width Ar width
                   3839: Set the width or height of the main (left or top) pane in the
                   3840: .Ic main-horizontal
                   3841: or
                   3842: .Ic main-vertical
                   3843: layouts.
1.747     nicm     3844: If suffixed by
                   3845: .Ql % ,
                   3846: this is a percentage of the window size.
1.757     nicm     3847: .Pp
                   3848: .It Ic copy-mode-match-style Ar style
                   3849: Set the style of search matches in copy mode.
1.768     nicm     3850: For how to specify
                   3851: .Ar style ,
                   3852: see the
                   3853: .Sx STYLES
                   3854: section.
                   3855: .Pp
                   3856: .It Ic copy-mode-mark-style Ar style
                   3857: Set the style of the line containing the mark in copy mode.
1.757     nicm     3858: For how to specify
                   3859: .Ar style ,
                   3860: see the
                   3861: .Sx STYLES
                   3862: section.
                   3863: .Pp
                   3864: .It Ic copy-mode-current-match-style Ar style
                   3865: Set the style of the current search match in copy mode.
                   3866: For how to specify
                   3867: .Ar style ,
                   3868: see the
                   3869: .Sx STYLES
                   3870: section.
1.56      jmc      3871: .Pp
1.1       nicm     3872: .It Xo Ic mode-keys
1.56      jmc      3873: .Op Ic vi | emacs
1.1       nicm     3874: .Xc
1.500     nicm     3875: Use vi or emacs-style key bindings in copy mode.
                   3876: The default is emacs, unless
1.191     nicm     3877: .Ev VISUAL
                   3878: or
                   3879: .Ev EDITOR
                   3880: contains
                   3881: .Ql vi .
1.56      jmc      3882: .Pp
1.378     nicm     3883: .It Ic mode-style Ar style
                   3884: Set window modes style.
                   3885: For how to specify
                   3886: .Ar style ,
                   3887: see the
1.623     nicm     3888: .Sx STYLES
                   3889: section.
1.378     nicm     3890: .Pp
1.1       nicm     3891: .It Xo Ic monitor-activity
1.56      jmc      3892: .Op Ic on | off
1.1       nicm     3893: .Xc
                   3894: Monitor for activity in the window.
                   3895: Windows with activity are highlighted in the status line.
1.56      jmc      3896: .Pp
1.574     nicm     3897: .It Xo Ic monitor-bell
                   3898: .Op Ic on | off
                   3899: .Xc
                   3900: Monitor for a bell in the window.
                   3901: Windows with a bell are highlighted in the status line.
                   3902: .Pp
1.192     nicm     3903: .It Xo Ic monitor-silence
                   3904: .Op Ic interval
                   3905: .Xc
                   3906: Monitor for silence (no activity) in the window within
                   3907: .Ic interval
                   3908: seconds.
                   3909: Windows that have been silent for the interval are highlighted in the
                   3910: status line.
                   3911: An interval of zero disables the monitoring.
1.195     nicm     3912: .Pp
                   3913: .It Ic other-pane-height Ar height
                   3914: Set the height of the other panes (not the main pane) in the
                   3915: .Ic main-horizontal
                   3916: layout.
                   3917: If this option is set to 0 (the default), it will have no effect.
                   3918: If both the
                   3919: .Ic main-pane-height
                   3920: and
                   3921: .Ic other-pane-height
                   3922: options are set, the main pane will grow taller to make the other panes the
                   3923: specified height, but will never shrink to do so.
1.747     nicm     3924: If suffixed by
                   3925: .Ql % ,
                   3926: this is a percentage of the window size.
1.195     nicm     3927: .Pp
                   3928: .It Ic other-pane-width Ar width
                   3929: Like
                   3930: .Ic other-pane-height ,
                   3931: but set the width of other panes in the
                   3932: .Ic main-vertical
                   3933: layout.
1.243     nicm     3934: .Pp
1.413     nicm     3935: .It Ic pane-active-border-style Ar style
                   3936: Set the pane border style for the currently active pane.
                   3937: For how to specify
                   3938: .Ar style ,
                   3939: see the
1.623     nicm     3940: .Sx STYLES
                   3941: section.
1.413     nicm     3942: Attributes are ignored.
                   3943: .Pp
1.243     nicm     3944: .It Ic pane-base-index Ar index
                   3945: Like
                   3946: .Ic base-index ,
                   3947: but set the starting index for pane numbers.
1.484     nicm     3948: .Pp
                   3949: .It Ic pane-border-format Ar format
                   3950: Set the text shown in pane border status lines.
1.770     nicm     3951: .Pp
                   3952: .It Ic pane-border-lines Ar type
                   3953: Set the type of characters used for drawing pane borders.
                   3954: .Ar type
                   3955: may be one of:
                   3956: .Bl -tag -width Ds
                   3957: .It single
                   3958: single lines using ACS or UTF-8 characters
                   3959: .It double
                   3960: double lines using UTF-8 characters
                   3961: .It heavy
                   3962: heavy lines using UTF-8 characters
                   3963: .It simple
                   3964: simple ASCII characters
                   3965: .It number
                   3966: the pane number
                   3967: .El
                   3968: .Pp
                   3969: .Ql double
                   3970: and
                   3971: .Ql heavy
                   3972: will fall back to standard ACS line drawing when UTF-8 is not supported.
1.484     nicm     3973: .Pp
                   3974: .It Xo Ic pane-border-status
                   3975: .Op Ic off | top | bottom
                   3976: .Xc
                   3977: Turn pane border status lines off or set their position.
1.413     nicm     3978: .Pp
                   3979: .It Ic pane-border-style Ar style
                   3980: Set the pane border style for panes aside from the active pane.
                   3981: For how to specify
                   3982: .Ar style ,
                   3983: see the
1.623     nicm     3984: .Sx STYLES
                   3985: section.
1.413     nicm     3986: Attributes are ignored.
1.192     nicm     3987: .Pp
1.99      nicm     3988: .It Xo Ic synchronize-panes
                   3989: .Op Ic on | off
                   3990: .Xc
1.164     nicm     3991: Duplicate input to any pane to all other panes in the same window (only
                   3992: for panes that are not in any special mode).
1.56      jmc      3993: .Pp
1.378     nicm     3994: .It Ic window-status-activity-style Ar style
                   3995: Set status line style for windows with an activity alert.
                   3996: For how to specify
                   3997: .Ar style ,
                   3998: see the
1.623     nicm     3999: .Sx STYLES
                   4000: section.
1.169     nicm     4001: .Pp
1.378     nicm     4002: .It Ic window-status-bell-style Ar style
                   4003: Set status line style for windows with a bell alert.
                   4004: For how to specify
                   4005: .Ar style ,
                   4006: see the
1.623     nicm     4007: .Sx STYLES
                   4008: section.
1.169     nicm     4009: .Pp
1.125     nicm     4010: .It Ic window-status-current-format Ar string
                   4011: Like
                   4012: .Ar window-status-format ,
                   4013: but is the format used when the window is the current window.
1.307     nicm     4014: .Pp
1.378     nicm     4015: .It Ic window-status-current-style Ar style
                   4016: Set status line style for the currently active window.
                   4017: For how to specify
                   4018: .Ar style ,
                   4019: see the
1.623     nicm     4020: .Sx STYLES
                   4021: section.
1.239     nicm     4022: .Pp
                   4023: .It Ic window-status-format Ar string
                   4024: Set the format in which the window is displayed in the status line window list.
                   4025: See the
1.623     nicm     4026: .Sx FORMATS
                   4027: and
                   4028: .Sx STYLES
                   4029: sections.
1.290     nicm     4030: .Pp
1.378     nicm     4031: .It Ic window-status-last-style Ar style
                   4032: Set status line style for the last active window.
                   4033: For how to specify
                   4034: .Ar style ,
                   4035: see the
1.623     nicm     4036: .Sx STYLES
                   4037: section.
1.378     nicm     4038: .Pp
1.290     nicm     4039: .It Ic window-status-separator Ar string
                   4040: Sets the separator drawn between windows in the status line.
                   4041: The default is a single space character.
1.125     nicm     4042: .Pp
1.378     nicm     4043: .It Ic window-status-style Ar style
                   4044: Set status line style for a single window.
1.418     nicm     4045: For how to specify
                   4046: .Ar style ,
                   4047: see the
1.623     nicm     4048: .Sx STYLES
                   4049: section.
1.418     nicm     4050: .Pp
1.642     nicm     4051: .It Xo Ic window-size
1.689     nicm     4052: .Ar largest | Ar smallest | Ar manual | Ar latest
1.642     nicm     4053: .Xc
                   4054: Configure how
                   4055: .Nm
                   4056: determines the window size.
                   4057: If set to
                   4058: .Ar largest ,
                   4059: the size of the largest attached session is used; if
                   4060: .Ar smallest ,
                   4061: the size of the smallest.
                   4062: If
                   4063: .Ar manual ,
                   4064: the size of a new window is set from the
                   4065: .Ic default-size
                   4066: option and windows are resized automatically.
1.689     nicm     4067: With
                   4068: .Ar latest ,
                   4069: .Nm
                   4070: uses the size of the client that had the most recent activity.
1.642     nicm     4071: See also the
                   4072: .Ic resize-window
                   4073: command and the
                   4074: .Ic aggressive-resize
                   4075: option.
                   4076: .Pp
1.512     nicm     4077: .It Xo Ic wrap-search
                   4078: .Op Ic on | off
                   4079: .Xc
                   4080: If this option is set, searches will wrap around the end of the pane contents.
                   4081: The default is on.
1.57      jmc      4082: .El
1.668     nicm     4083: .Pp
                   4084: Available pane options are:
                   4085: .Pp
                   4086: .Bl -tag -width Ds -compact
1.669     nicm     4087: .It Xo Ic allow-rename
                   4088: .Op Ic on | off
                   4089: .Xc
                   4090: Allow programs in the pane to change the window name using a terminal escape
                   4091: sequence (\eek...\ee\e\e).
                   4092: .Pp
                   4093: .It Xo Ic alternate-screen
                   4094: .Op Ic on | off
                   4095: .Xc
                   4096: This option configures whether programs running inside the pane may use the
                   4097: terminal alternate screen feature, which allows the
                   4098: .Em smcup
                   4099: and
                   4100: .Em rmcup
                   4101: .Xr terminfo 5
                   4102: capabilities.
                   4103: The alternate screen feature preserves the contents of the window when an
                   4104: interactive application starts and restores it on exit, so that any output
                   4105: visible before the application starts reappears unchanged after it exits.
                   4106: .Pp
1.668     nicm     4107: .It Xo Ic remain-on-exit
                   4108: .Op Ic on | off
1.57      jmc      4109: .Xc
1.668     nicm     4110: A pane with this flag set is not destroyed when the program running in it
                   4111: exits.
                   4112: The pane may be reactivated with the
                   4113: .Ic respawn-pane
                   4114: command.
                   4115: .Pp
                   4116: .It Ic window-active-style Ar style
                   4117: Set the pane style when it is the active pane.
                   4118: For how to specify
                   4119: .Ar style ,
                   4120: see the
                   4121: .Sx STYLES
                   4122: section.
                   4123: .Pp
                   4124: .It Ic window-style Ar style
                   4125: Set the pane style.
                   4126: For how to specify
                   4127: .Ar style ,
                   4128: see the
                   4129: .Sx STYLES
                   4130: section.
1.63      nicm     4131: .El
1.469     nicm     4132: .Sh HOOKS
                   4133: .Nm
                   4134: allows commands to run on various triggers, called
                   4135: .Em hooks .
1.505     nicm     4136: Most
1.483     nicm     4137: .Nm
1.505     nicm     4138: commands have an
1.483     nicm     4139: .Em after
                   4140: hook and there are a number of hooks not associated with commands.
                   4141: .Pp
1.640     nicm     4142: Hooks are stored as array options, members of the array are executed in
                   4143: order when the hook is triggered.
1.740     nicm     4144: Like options different hooks may be global or belong to a session, window or pane.
1.640     nicm     4145: Hooks may be configured with the
                   4146: .Ic set-hook
                   4147: or
                   4148: .Ic set-option
                   4149: commands and displayed with
                   4150: .Ic show-hooks
                   4151: or
                   4152: .Ic show-options
                   4153: .Fl H .
                   4154: The following two commands are equivalent:
                   4155: .Bd -literal -offset indent.
                   4156: set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red'
                   4157: set-option -g pane-mode-changed[42] 'set -g status-left-style bg=red'
                   4158: .Ed
                   4159: .Pp
                   4160: Setting a hook without specifying an array index clears the hook and sets the
                   4161: first member of the array.
                   4162: .Pp
1.505     nicm     4163: A command's after
                   4164: hook is run after it completes, except when the command is run as part of a hook
1.483     nicm     4165: itself.
1.505     nicm     4166: They are named with an
1.483     nicm     4167: .Ql after-
                   4168: prefix.
                   4169: For example, the following command adds a hook to select the even-vertical
                   4170: layout after every
                   4171: .Ic split-window :
                   4172: .Bd -literal -offset indent
1.640     nicm     4173: set-hook -g after-split-window "selectl even-vertical"
1.483     nicm     4174: .Ed
                   4175: .Pp
1.584     nicm     4176: All the notifications listed in the
                   4177: .Sx CONTROL MODE
                   4178: section are hooks (without any arguments), except
                   4179: .Ic %exit .
                   4180: The following additional hooks are available:
1.560     nicm     4181: .Bl -tag -width "XXXXXXXXXXXXXXXXXXXXXX"
1.476     nicm     4182: .It alert-activity
                   4183: Run when a window has activity.
                   4184: See
                   4185: .Ic monitor-activity .
                   4186: .It alert-bell
                   4187: Run when a window has received a bell.
1.574     nicm     4188: See
                   4189: .Ic monitor-bell .
1.476     nicm     4190: .It alert-silence
                   4191: Run when a window has been silent.
                   4192: See
                   4193: .Ic monitor-silence .
1.469     nicm     4194: .It client-attached
                   4195: Run when a client is attached.
                   4196: .It client-detached
                   4197: Run when a client is detached
                   4198: .It client-resized
                   4199: Run when a client is resized.
1.511     nicm     4200: .It client-session-changed
                   4201: Run when a client's attached session is changed.
1.475     nicm     4202: .It pane-died
                   4203: Run when the program running in a pane exits, but
                   4204: .Ic remain-on-exit
                   4205: is on so the pane has not closed.
                   4206: .It pane-exited
                   4207: Run when the program running in a pane exits.
1.603     nicm     4208: .It pane-focus-in
                   4209: Run when the focus enters a pane, if the
                   4210: .Ic focus-events
                   4211: option is on.
                   4212: .It pane-focus-out
                   4213: Run when the focus exits a pane, if the
                   4214: .Ic focus-events
                   4215: option is on.
1.560     nicm     4216: .It pane-set-clipboard
                   4217: Run when the terminal clipboard is set using the
                   4218: .Xr xterm 1
                   4219: escape sequence.
1.510     nicm     4220: .It session-created
                   4221: Run when a new session created.
                   4222: .It session-closed
                   4223: Run when a session closed.
1.507     nicm     4224: .It session-renamed
                   4225: Run when a session is renamed.
1.511     nicm     4226: .It window-linked
                   4227: Run when a window is linked into a session.
1.507     nicm     4228: .It window-renamed
                   4229: Run when a window is renamed.
1.511     nicm     4230: .It window-unlinked
                   4231: Run when a window is unlinked from a session.
1.469     nicm     4232: .El
                   4233: .Pp
                   4234: Hooks are managed with these commands:
                   4235: .Bl -tag -width Ds
                   4236: .It Xo Ic set-hook
1.740     nicm     4237: .Op Fl agpRuw
                   4238: .Op Fl t Ar target-pane
1.469     nicm     4239: .Ar hook-name
                   4240: .Ar command
                   4241: .Xc
1.604     nicm     4242: Without
1.605     jmc      4243: .Fl R ,
1.604     nicm     4244: sets (or with
1.496     nicm     4245: .Fl u
                   4246: unsets) hook
1.469     nicm     4247: .Ar hook-name
                   4248: to
                   4249: .Ar command .
1.740     nicm     4250: The flags are the same as for
                   4251: .Ic set-option .
1.604     nicm     4252: .Pp
                   4253: With
                   4254: .Fl R ,
                   4255: run
                   4256: .Ar hook-name
                   4257: immediately.
1.469     nicm     4258: .It Xo Ic show-hooks
1.740     nicm     4259: .Op Fl gpw
                   4260: .Op Fl t Ar target-pane
1.469     nicm     4261: .Xc
1.740     nicm     4262: Shows hooks.
                   4263: The flags are the same as for
                   4264: .Ic show-options .
1.470     jmc      4265: .El
1.419     nicm     4266: .Sh MOUSE SUPPORT
                   4267: If the
                   4268: .Ic mouse
                   4269: option is on (the default is off),
                   4270: .Nm
                   4271: allows mouse events to be bound as keys.
                   4272: The name of each key is made up of a mouse event (such as
                   4273: .Ql MouseUp1 )
1.632     nicm     4274: and a location suffix, one of the following:
                   4275: .Bl -column "XXXXXXXXXXXXX" -offset indent
                   4276: .It Li "Pane" Ta "the contents of a pane"
                   4277: .It Li "Border" Ta "a pane border"
                   4278: .It Li "Status" Ta "the status line window list"
                   4279: .It Li "StatusLeft" Ta "the left part of the status line"
                   4280: .It Li "StatusRight" Ta "the right part of the status line"
                   4281: .It Li "StatusDefault" Ta "any other part of the status line"
                   4282: .El
                   4283: .Pp
1.419     nicm     4284: The following mouse events are available:
                   4285: .Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent
1.498     nicm     4286: .It Li "WheelUp" Ta "WheelDown" Ta ""
1.481     nicm     4287: .It Li "MouseDown1" Ta "MouseUp1" Ta "MouseDrag1" Ta "MouseDragEnd1"
                   4288: .It Li "MouseDown2" Ta "MouseUp2" Ta "MouseDrag2" Ta "MouseDragEnd2"
                   4289: .It Li "MouseDown3" Ta "MouseUp3" Ta "MouseDrag3" Ta "MouseDragEnd3"
1.724     nicm     4290: .It Li "SecondClick1" Ta "SecondClick2" Ta "SecondClick3"
1.590     nicm     4291: .It Li "DoubleClick1" Ta "DoubleClick2" Ta "DoubleClick3"
                   4292: .It Li "TripleClick1" Ta "TripleClick2" Ta "TripleClick3"
1.419     nicm     4293: .El
1.724     nicm     4294: .Pp
                   4295: The
                   4296: .Ql SecondClick
                   4297: events are fired for the second click of a double click, even if there may be a
                   4298: third click which will fire
                   4299: .Ql TripleClick
                   4300: instead of
                   4301: .Ql DoubleClick .
1.419     nicm     4302: .Pp
                   4303: Each should be suffixed with a location, for example
                   4304: .Ql MouseDown1Status .
                   4305: .Pp
1.423     nicm     4306: The special token
                   4307: .Ql {mouse}
                   4308: or
1.419     nicm     4309: .Ql =
                   4310: may be used as
                   4311: .Ar target-window
                   4312: or
                   4313: .Ar target-pane
                   4314: in commands bound to mouse key bindings.
                   4315: It resolves to the window or pane over which the mouse event took place
                   4316: (for example, the window in the status line over which button 1 was released for a
                   4317: .Ql MouseUp1Status
                   4318: binding, or the pane over which the wheel was scrolled for a
                   4319: .Ql WheelDownPane
                   4320: binding).
                   4321: .Pp
                   4322: The
                   4323: .Ic send-keys
                   4324: .Fl M
                   4325: flag may be used to forward a mouse event to a pane.
                   4326: .Pp
                   4327: The default key bindings allow the mouse to be used to select and resize panes,
                   4328: to copy text and to change window using the status line.
                   4329: These take effect if the
                   4330: .Ic mouse
                   4331: option is turned on.
1.245     nicm     4332: .Sh FORMATS
1.294     nicm     4333: Certain commands accept the
1.245     nicm     4334: .Fl F
                   4335: flag with a
                   4336: .Ar format
                   4337: argument.
                   4338: This is a string which controls the output format of the command.
1.678     nicm     4339: Format variables are enclosed in
1.245     nicm     4340: .Ql #{
                   4341: and
                   4342: .Ql } ,
                   4343: for example
1.359     nicm     4344: .Ql #{session_name} .
1.409     nicm     4345: The possible variables are listed in the table below, or the name of a
                   4346: .Nm
                   4347: option may be used for an option's value.
                   4348: Some variables have a shorter alias such as
1.598     nicm     4349: .Ql #S ;
1.376     nicm     4350: .Ql ##
                   4351: is replaced by a single
1.598     nicm     4352: .Ql # ,
                   4353: .Ql #,
                   4354: by a
                   4355: .Ql \&,
                   4356: and
                   4357: .Ql #}
                   4358: by a
                   4359: .Ql } .
1.409     nicm     4360: .Pp
                   4361: Conditionals are available by prefixing with
1.246     jmc      4362: .Ql \&?
1.245     nicm     4363: and separating two alternatives with a comma;
                   4364: if the specified variable exists and is not zero, the first alternative
1.246     jmc      4365: is chosen, otherwise the second is used.
                   4366: For example
1.245     nicm     4367: .Ql #{?session_attached,attached,not attached}
                   4368: will include the string
                   4369: .Ql attached
                   4370: if the session is attached and the string
                   4371: .Ql not attached
1.409     nicm     4372: if it is unattached, or
                   4373: .Ql #{?automatic-rename,yes,no}
                   4374: will include
                   4375: .Ql yes
                   4376: if
                   4377: .Ic automatic-rename
                   4378: is enabled, or
                   4379: .Ql no
                   4380: if not.
1.599     nicm     4381: Conditionals can be nested arbitrarily.
                   4382: Inside a conditional,
                   4383: .Ql \&,
                   4384: and
                   4385: .Ql }
                   4386: must be escaped as
                   4387: .Ql #,
                   4388: and
                   4389: .Ql #} ,
                   4390: unless they are part of a
                   4391: .Ql #{...}
1.600     nicm     4392: replacement.
                   4393: For example:
1.599     nicm     4394: .Bd -literal -offset indent
                   4395: #{?pane_in_mode,#[fg=white#,bg=red],#[fg=red#,bg=white]}#W .
                   4396: .Ed
1.520     nicm     4397: .Pp
1.678     nicm     4398: String comparisons may be expressed by prefixing two comma-separated
1.520     nicm     4399: alternatives by
1.652     nicm     4400: .Ql == ,
                   4401: .Ql != ,
                   4402: .Ql < ,
                   4403: .Ql > ,
                   4404: .Ql <=
1.520     nicm     4405: or
1.652     nicm     4406: .Ql >=
1.520     nicm     4407: and a colon.
                   4408: For example
1.544     nicm     4409: .Ql #{==:#{host},myhost}
1.520     nicm     4410: will be replaced by
                   4411: .Ql 1
                   4412: if running on
                   4413: .Ql myhost ,
                   4414: otherwise by
1.554     nicm     4415: .Ql 0 .
                   4416: .Ql ||
                   4417: and
                   4418: .Ql &&
                   4419: evaluate to true if either or both of two comma-separated alternatives are
                   4420: true, for example
1.595     nicm     4421: .Ql #{||:#{pane_in_mode},#{alternate_on}} .
1.664     nicm     4422: .Pp
                   4423: An
                   4424: .Ql m
                   4425: specifies an
                   4426: .Xr fnmatch 3
                   4427: or regular expression comparison.
                   4428: The first argument is the pattern and the second the string to compare.
1.714     nicm     4429: An optional argument specifies flags:
1.664     nicm     4430: .Ql r
                   4431: means the pattern is a regular expression instead of the default
                   4432: .Xr fnmatch 3
                   4433: pattern, and
                   4434: .Ql i
                   4435: means to ignore case.
                   4436: For example:
                   4437: .Ql #{m:*foo*,#{host}}
                   4438: or
                   4439: .Ql #{m/ri:^A,MYVAR} .
1.554     nicm     4440: A
                   4441: .Ql C
                   4442: performs a search for an
                   4443: .Xr fnmatch 3
1.664     nicm     4444: pattern or regular expression in the pane content and evaluates to zero if not
                   4445: found, or a line number if found.
                   4446: Like
                   4447: .Ql m ,
1.665     jmc      4448: an
1.664     nicm     4449: .Ql r
                   4450: flag means search for a regular expression and
                   4451: .Ql i
                   4452: ignores case.
                   4453: For example:
                   4454: .Ql #{C/r:^Start}
1.714     nicm     4455: .Pp
                   4456: Numeric operators may be performed by prefixing two comma-separated alternatives with an
                   4457: .Ql e
                   4458: and an operator.
                   4459: An optional
                   4460: .Ql f
                   4461: flag may be given after the operator to use floating point numbers, otherwise integers are used.
                   4462: This may be followed by a number giving the number of decimal places to use for the result.
                   4463: The available operators are:
                   4464: addition
                   4465: .Ql + ,
                   4466: subtraction
                   4467: .Ql - ,
                   4468: multiplication
                   4469: .Ql * ,
                   4470: division
                   4471: .Ql / ,
                   4472: and modulus
                   4473: .Ql m
                   4474: or
                   4475: .Ql %
                   4476: (note that
                   4477: .Ql %
                   4478: must be escaped as
                   4479: .Ql %%
                   4480: in formats which are also expanded by
                   4481: .Xr strftime 3 ) .
                   4482: For example,
                   4483: .Ql #{e|*|f|4:5.5,3}
                   4484: multiplies 5.5 by 3 for a result with four decimal places and
                   4485: .Ql #{e|%%:7,3}
                   4486: returns the modulus of 7 and 3.
1.453     nicm     4487: .Pp
1.367     nicm     4488: A limit may be placed on the length of the resultant string by prefixing it
                   4489: by an
                   4490: .Ql = ,
1.479     nicm     4491: a number and a colon.
                   4492: Positive numbers count from the start of the string and negative from the end,
                   4493: so
                   4494: .Ql #{=5:pane_title}
1.653     nicm     4495: will include at most the first five characters of the pane title, or
1.479     nicm     4496: .Ql #{=-5:pane_title}
1.653     nicm     4497: the last five characters.
                   4498: A suffix or prefix may be given as a second argument - if provided then it is
                   4499: appended or prepended to the string if the length has been trimmed, for example
                   4500: .Ql #{=/5/...:pane_title}
                   4501: will append
                   4502: .Ql ...
                   4503: if the pane title is more than five characters.
1.698     nicm     4504: Similarly,
                   4505: .Ql p
                   4506: pads the string to a given width, for example
                   4507: .Ql #{p10:pane_title}
                   4508: will result in a width of at least 10 characters.
                   4509: A positive width pads on the left, a negative on the right.
1.653     nicm     4510: .Pp
1.453     nicm     4511: Prefixing a time variable with
1.683     nicm     4512: .Ql t:\&
1.453     nicm     4513: will convert it to a string, so if
                   4514: .Ql #{window_activity}
                   4515: gives
1.454     jmc      4516: .Ql 1445765102 ,
1.453     nicm     4517: .Ql #{t:window_activity}
                   4518: gives
                   4519: .Ql Sun Oct 25 09:25:02 2015 .
1.751     nicm     4520: Adding
                   4521: .Ql p (
                   4522: .Ql `t/p` )
                   4523: will use shorter but less accurate time format for times in the past.
1.765     nicm     4524: A custom format may be given using an
                   4525: .Ql f
                   4526: suffix (note that
                   4527: .Ql %
                   4528: must be escaped as
                   4529: .Ql %%
                   4530: if the format is separately being passed through
                   4531: .Xr strftime 3 ,
                   4532: for example in the
                   4533: .Ic status-left
                   4534: option):
                   4535: .Ql #{t/f/%%H#:%%M:window_activity} ,
                   4536: see
                   4537: .Xr strftime 3 .
                   4538: .Pp
1.453     nicm     4539: The
1.683     nicm     4540: .Ql b:\&
1.453     nicm     4541: and
1.683     nicm     4542: .Ql d:\&
1.453     nicm     4543: prefixes are
                   4544: .Xr basename 3
                   4545: and
                   4546: .Xr dirname 3
                   4547: of the variable respectively.
1.683     nicm     4548: .Ql q:\&
1.610     nicm     4549: will escape
                   4550: .Xr sh 1
                   4551: special characters.
1.683     nicm     4552: .Ql E:\&
1.617     nicm     4553: will expand the format twice, for example
                   4554: .Ql #{E:status-left}
                   4555: is the result of expanding the content of the
                   4556: .Ic status-left
1.671     nicm     4557: option rather than the option itself.
1.683     nicm     4558: .Ql T:\&
1.620     nicm     4559: is like
1.683     nicm     4560: .Ql E:\&
1.620     nicm     4561: but also expands
                   4562: .Xr strftime 3
                   4563: specifiers.
1.683     nicm     4564: .Ql S:\& ,
                   4565: .Ql W:\&
1.618     nicm     4566: or
1.683     nicm     4567: .Ql P:\&
1.618     nicm     4568: will loop over each session, window or pane and insert the format once
1.619     nicm     4569: for each.
                   4570: For windows and panes, two comma-separated formats may be given:
                   4571: the second is used for the current window or active pane.
                   4572: For example, to get a list of windows formatted like the status line:
1.618     nicm     4573: .Bd -literal -offset indent
                   4574: #{W:#{E:window-status-format} ,#{E:window-status-current-format} }
                   4575: .Ed
1.625     nicm     4576: .Pp
1.461     nicm     4577: A prefix of the form
1.683     nicm     4578: .Ql s/foo/bar/:\&
1.461     nicm     4579: will substitute
                   4580: .Ql foo
                   4581: with
                   4582: .Ql bar
                   4583: throughout.
1.664     nicm     4584: The first argument may be an extended regular expression and a final argument may be
                   4585: .Ql i
                   4586: to ignore case, for example
1.683     nicm     4587: .Ql s/a(.)/\e1x/i:\&
1.664     nicm     4588: would change
                   4589: .Ql abABab
                   4590: into
                   4591: .Ql bxBxbx .
1.431     nicm     4592: .Pp
1.671     nicm     4593: In addition, the last line of a shell command's output may be inserted using
1.431     nicm     4594: .Ql #() .
                   4595: For example,
                   4596: .Ql #(uptime)
                   4597: will insert the system's uptime.
                   4598: When constructing formats,
                   4599: .Nm
                   4600: does not wait for
                   4601: .Ql #()
                   4602: commands to finish; instead, the previous result from running the same command is used,
                   4603: or a placeholder if the command has not been run before.
1.543     nicm     4604: If the command hasn't exited, the most recent line of output will be used, but the status
                   4605: line will not be updated more than once a second.
1.431     nicm     4606: Commands are executed with the
                   4607: .Nm
                   4608: global environment set (see the
1.644     schwarze 4609: .Sx GLOBAL AND SESSION ENVIRONMENT
1.431     nicm     4610: section).
1.671     nicm     4611: .Pp
                   4612: An
                   4613: .Ql l
                   4614: specifies that a string should be interpreted literally and not expanded.
                   4615: For example
                   4616: .Ql #{l:#{?pane_in_mode,yes,no}}
                   4617: will be replaced by
                   4618: .Ql #{?pane_in_mode,yes,no} .
1.245     nicm     4619: .Pp
                   4620: The following variables are available, where appropriate:
1.359     nicm     4621: .Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX"
                   4622: .It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with"
1.678     nicm     4623: .It Li "alternate_on" Ta "" Ta "1 if pane is in alternate screen"
1.359     nicm     4624: .It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen"
                   4625: .It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen"
1.572     nicm     4626: .It Li "buffer_created" Ta "" Ta "Time buffer created"
1.490     nicm     4627: .It Li "buffer_name" Ta "" Ta "Name of buffer"
1.386     nicm     4628: .It Li "buffer_sample" Ta "" Ta "Sample of start of buffer"
1.359     nicm     4629: .It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes"
1.572     nicm     4630: .It Li "client_activity" Ta "" Ta "Time client last had activity"
1.699     nicm     4631: .It Li "client_cell_height" Ta "" Ta "Height of each client cell in pixels"
                   4632: .It Li "client_cell_width" Ta "" Ta "Width of each client cell in pixels"
1.646     nicm     4633: .It Li "client_control_mode" Ta "" Ta "1 if client is in control mode"
1.572     nicm     4634: .It Li "client_created" Ta "" Ta "Time client created"
1.542     nicm     4635: .It Li "client_discarded" Ta "" Ta "Bytes discarded when client behind"
1.762     nicm     4636: .It Li "client_flags" Ta "" Ta "List of client flags"
1.359     nicm     4637: .It Li "client_height" Ta "" Ta "Height of client"
1.451     nicm     4638: .It Li "client_key_table" Ta "" Ta "Current key table"
1.359     nicm     4639: .It Li "client_last_session" Ta "" Ta "Name of the client's last session"
1.540     nicm     4640: .It Li "client_name" Ta "" Ta "Name of client"
1.437     nicm     4641: .It Li "client_pid" Ta "" Ta "PID of client process"
1.359     nicm     4642: .It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed"
                   4643: .It Li "client_readonly" Ta "" Ta "1 if client is readonly"
                   4644: .It Li "client_session" Ta "" Ta "Name of the client's session"
                   4645: .It Li "client_termname" Ta "" Ta "Terminal name of client"
1.754     nicm     4646: .It Li "client_termtype" Ta "" Ta "Terminal type of client, if available"
                   4647: .It Li "client_termfeatures" Ta "" Ta "Terminal features of client, if any"
1.359     nicm     4648: .It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
1.699     nicm     4649: .It Li "client_utf8" Ta "" Ta "1 if client supports UTF-8"
1.359     nicm     4650: .It Li "client_width" Ta "" Ta "Width of client"
1.541     nicm     4651: .It Li "client_written" Ta "" Ta "Bytes written to client"
1.509     nicm     4652: .It Li "command" Ta "" Ta "Name of command in use, if any"
1.646     nicm     4653: .It Li "command_list_alias" Ta "" Ta "Command alias if listing commands"
1.489     nicm     4654: .It Li "command_list_name" Ta "" Ta "Command name if listing commands"
                   4655: .It Li "command_list_usage" Ta "" Ta "Command usage if listing commands"
1.692     nicm     4656: .It Li "copy_cursor_line" Ta "" Ta "Line the cursor is on in copy mode"
                   4657: .It Li "copy_cursor_word" Ta "" Ta "Word under cursor in copy mode"
1.691     nicm     4658: .It Li "copy_cursor_x" Ta "" Ta "Cursor X position in copy mode"
                   4659: .It Li "copy_cursor_y" Ta "" Ta "Cursor Y position in copy mode"
1.646     nicm     4660: .It Li "cursor_character" Ta "" Ta "Character at cursor in pane"
1.359     nicm     4661: .It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
                   4662: .It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
                   4663: .It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"
                   4664: .It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
                   4665: .It Li "history_limit" Ta "" Ta "Maximum window history lines"
1.581     nicm     4666: .It Li "history_size" Ta "" Ta "Size of history in lines"
1.509     nicm     4667: .It Li "hook" Ta "" Ta "Name of running hook, if any"
1.511     nicm     4668: .It Li "hook_pane" Ta "" Ta "ID of pane where hook was run, if any"
1.510     nicm     4669: .It Li "hook_session" Ta "" Ta "ID of session where hook was run, if any"
                   4670: .It Li "hook_session_name" Ta "" Ta "Name of session where hook was run, if any"
                   4671: .It Li "hook_window" Ta "" Ta "ID of window where hook was run, if any"
                   4672: .It Li "hook_window_name" Ta "" Ta "Name of window where hook was run, if any"
1.359     nicm     4673: .It Li "host" Ta "#H" Ta "Hostname of local host"
                   4674: .It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)"
                   4675: .It Li "insert_flag" Ta "" Ta "Pane insert flag"
                   4676: .It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag"
                   4677: .It Li "keypad_flag" Ta "" Ta "Pane keypad flag"
                   4678: .It Li "line" Ta "" Ta "Line number in the list"
1.646     nicm     4679: .It Li "mouse_all_flag" Ta "" Ta "Pane mouse all flag"
1.359     nicm     4680: .It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag"
                   4681: .It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag"
1.676     nicm     4682: .It Li "mouse_line" Ta "" Ta "Line under mouse, if any"
                   4683: .It Li "mouse_sgr_flag" Ta "" Ta "Pane mouse SGR flag"
1.359     nicm     4684: .It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
1.676     nicm     4685: .It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
                   4686: .It Li "mouse_word" Ta "" Ta "Word under mouse, if any"
1.654     nicm     4687: .It Li "mouse_x" Ta "" Ta "Mouse X position, if any"
                   4688: .It Li "mouse_y" Ta "" Ta "Mouse Y position, if any"
1.676     nicm     4689: .It Li "origin_flag" Ta "" Ta "Pane origin flag"
1.359     nicm     4690: .It Li "pane_active" Ta "" Ta "1 if active pane"
1.570     nicm     4691: .It Li "pane_at_bottom" Ta "" Ta "1 if pane is at the bottom of window"
                   4692: .It Li "pane_at_left" Ta "" Ta "1 if pane is at the left of window"
                   4693: .It Li "pane_at_right" Ta "" Ta "1 if pane is at the right of window"
                   4694: .It Li "pane_at_top" Ta "" Ta "1 if pane is at the top of window"
1.396     nicm     4695: .It Li "pane_bottom" Ta "" Ta "Bottom of pane"
1.359     nicm     4696: .It Li "pane_current_command" Ta "" Ta "Current command if available"
1.733     nicm     4697: .It Li "pane_current_path" Ta "" Ta "Current path if available"
1.359     nicm     4698: .It Li "pane_dead" Ta "" Ta "1 if pane is dead"
1.411     nicm     4699: .It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane"
1.696     nicm     4700: .It Li "pane_format" Ta "" Ta "1 if format is for a pane"
1.359     nicm     4701: .It Li "pane_height" Ta "" Ta "Height of pane"
                   4702: .It Li "pane_id" Ta "#D" Ta "Unique pane ID"
1.678     nicm     4703: .It Li "pane_in_mode" Ta "" Ta "1 if pane is in a mode"
1.646     nicm     4704: .It Li "pane_index" Ta "#P" Ta "Index of pane"
1.678     nicm     4705: .It Li "pane_input_off" Ta "" Ta "1 if input to pane is disabled"
1.396     nicm     4706: .It Li "pane_left" Ta "" Ta "Left of pane"
1.650     nicm     4707: .It Li "pane_marked" Ta "" Ta "1 if this is the marked pane"
                   4708: .It Li "pane_marked_set" Ta "" Ta "1 if a marked pane is set"
1.678     nicm     4709: .It Li "pane_mode" Ta "" Ta "Name of pane mode, if any"
1.761     nicm     4710: .It Li "pane_path" Ta "" Ta "Path of pane (can be set by application)"
1.359     nicm     4711: .It Li "pane_pid" Ta "" Ta "PID of first process in pane"
1.567     nicm     4712: .It Li "pane_pipe" Ta "" Ta "1 if pane is being piped"
1.396     nicm     4713: .It Li "pane_right" Ta "" Ta "Right of pane"
1.546     nicm     4714: .It Li "pane_search_string" Ta "" Ta "Last search string in copy mode"
1.743     nicm     4715: .It Li "pane_skipped" Ta "" Ta "Bytes skipped as not visible in pane"
1.359     nicm     4716: .It Li "pane_start_command" Ta "" Ta "Command pane started with"
1.678     nicm     4717: .It Li "pane_synchronized" Ta "" Ta "1 if pane is synchronized"
1.359     nicm     4718: .It Li "pane_tabs" Ta "" Ta "Pane tab positions"
1.696     nicm     4719: .It Li "pane_title" Ta "#T" Ta "Title of pane (can be set by application)"
1.396     nicm     4720: .It Li "pane_top" Ta "" Ta "Top of pane"
1.359     nicm     4721: .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
                   4722: .It Li "pane_width" Ta "" Ta "Width of pane"
1.743     nicm     4723: .It Li "pane_written" Ta "" Ta "Bytes written by pane (aside from redrawing)"
1.721     nicm     4724: .It Li "pid" Ta "" Ta "Server PID"
                   4725: .It Li "popup_key" Ta "" Ta "Key pressed in popup"
                   4726: .It Li "popup_mouse_x" Ta "" Ta "Mouse X position in popup"
                   4727: .It Li "popup_mouse_y" Ta "" Ta "Mouse Y position in popup"
1.606     nicm     4728: .It Li "rectangle_toggle" Ta "" Ta "1 if rectangle selection is activated"
1.646     nicm     4729: .It Li "scroll_position" Ta "" Ta "Scroll position in copy mode"
1.359     nicm     4730: .It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
                   4731: .It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
1.713     nicm     4732: .It Li "selection_active" Ta "" Ta "1 if selection started and changes with the cursor in copy mode"
1.691     nicm     4733: .It Li "selection_end_x" Ta "" Ta "X position of the end of the selection"
                   4734: .It Li "selection_end_y" Ta "" Ta "Y position of the end of the selection"
1.571     nicm     4735: .It Li "selection_present" Ta "" Ta "1 if selection started in copy mode"
1.691     nicm     4736: .It Li "selection_start_x" Ta "" Ta "X position of the start of the selection"
                   4737: .It Li "selection_start_y" Ta "" Ta "Y position of the start of the selection"
1.646     nicm     4738: .It Li "session_activity" Ta "" Ta "Time of session last activity"
1.430     nicm     4739: .It Li "session_alerts" Ta "" Ta "List of window indexes with alerts"
1.382     nicm     4740: .It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
1.702     nicm     4741: .It Li "session_attached_list" Ta "" Ta "List of clients session is attached to"
1.572     nicm     4742: .It Li "session_created" Ta "" Ta "Time session created"
1.696     nicm     4743: .It Li "session_format" Ta "" Ta "1 if format is for a session"
1.536     nicm     4744: .It Li "session_group" Ta "" Ta "Name of session group"
1.702     nicm     4745: .It Li "session_group_attached" Ta "" Ta "Number of clients sessions in group are attached to"
                   4746: .It Li "session_group_attached_list" Ta "" Ta "List of clients sessions in group are attached to"
1.646     nicm     4747: .It Li "session_group_list" Ta "" Ta "List of sessions in group"
1.702     nicm     4748: .It Li "session_group_many_attached" Ta "" Ta "1 if multiple clients attached to sessions in group"
1.586     nicm     4749: .It Li "session_group_size" Ta "" Ta "Size of session group"
1.359     nicm     4750: .It Li "session_grouped" Ta "" Ta "1 if session in a group"
                   4751: .It Li "session_id" Ta "" Ta "Unique session ID"
1.646     nicm     4752: .It Li "session_last_attached" Ta "" Ta "Time session last attached"
1.382     nicm     4753: .It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached"
1.748     nicm     4754: .It Li "session_marked" Ta "" Ta "1 if this session contains the marked pane"
1.359     nicm     4755: .It Li "session_name" Ta "#S" Ta "Name of session"
1.725     nicm     4756: .It Li "session_path" Ta "" Ta "Working directory of session"
1.548     nicm     4757: .It Li "session_stack" Ta "" Ta "Window indexes in most recent order"
1.359     nicm     4758: .It Li "session_windows" Ta "" Ta "Number of windows in session"
1.487     nicm     4759: .It Li "socket_path" Ta "" Ta "Server socket path"
1.465     nicm     4760: .It Li "start_time" Ta "" Ta "Server start time"
1.708     nicm     4761: .It Li "version" Ta "" Ta "Server version"
1.646     nicm     4762: .It Li "window_active" Ta "" Ta "1 if window active"
1.702     nicm     4763: .It Li "window_active_clients" Ta "" Ta "Number of clients viewing this window"
                   4764: .It Li "window_active_clients_list" Ta "" Ta "List of clients viewing this window"
                   4765: .It Li "window_active_sessions" Ta "" Ta "Number of sessions on which this window is active"
                   4766: .It Li "window_active_sessions_list" Ta "" Ta "List of sessions on which this window is active"
1.572     nicm     4767: .It Li "window_activity" Ta "" Ta "Time of window last activity"
1.487     nicm     4768: .It Li "window_activity_flag" Ta "" Ta "1 if window has activity"
1.366     nicm     4769: .It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
1.642     nicm     4770: .It Li "window_bigger" Ta "" Ta "1 if window is larger than client"
1.700     nicm     4771: .It Li "window_cell_height" Ta "" Ta "Height of each cell in pixels"
                   4772: .It Li "window_cell_width" Ta "" Ta "Width of each cell in pixels"
1.621     nicm     4773: .It Li "window_end_flag" Ta "" Ta "1 if window has the highest index"
1.359     nicm     4774: .It Li "window_flags" Ta "#F" Ta "Window flags"
1.696     nicm     4775: .It Li "window_format" Ta "" Ta "1 if format is for a window"
1.359     nicm     4776: .It Li "window_height" Ta "" Ta "Height of window"
                   4777: .It Li "window_id" Ta "" Ta "Unique window ID"
                   4778: .It Li "window_index" Ta "#I" Ta "Index of window"
1.400     nicm     4779: .It Li "window_last_flag" Ta "" Ta "1 if window is the last used"
1.460     nicm     4780: .It Li "window_layout" Ta "" Ta "Window layout description, ignoring zoomed window panes"
1.426     nicm     4781: .It Li "window_linked" Ta "" Ta "1 if window is linked across sessions"
1.702     nicm     4782: .It Li "window_linked_sessions" Ta "" Ta "Number of sessions this window is linked to"
                   4783: .It Li "window_linked_sessions_list" Ta "" Ta "List of sessions this window is linked to"
1.687     nicm     4784: .It Li "window_marked_flag" Ta "" Ta "1 if window contains the marked pane"
1.359     nicm     4785: .It Li "window_name" Ta "#W" Ta "Name of window"
1.642     nicm     4786: .It Li "window_offset_x" Ta "" Ta "X offset into window if larger than client"
                   4787: .It Li "window_offset_y" Ta "" Ta "Y offset into window if larger than client"
1.359     nicm     4788: .It Li "window_panes" Ta "" Ta "Number of panes in window"
1.366     nicm     4789: .It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
1.548     nicm     4790: .It Li "window_stack_index" Ta "" Ta "Index in session most recent stack"
1.621     nicm     4791: .It Li "window_start_flag" Ta "" Ta "1 if window has the lowest index"
1.460     nicm     4792: .It Li "window_visible_layout" Ta "" Ta "Window layout description, respecting zoomed window panes"
1.359     nicm     4793: .It Li "window_width" Ta "" Ta "Width of window"
1.400     nicm     4794: .It Li "window_zoomed_flag" Ta "" Ta "1 if window is zoomed"
1.359     nicm     4795: .It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
1.245     nicm     4796: .El
1.623     nicm     4797: .Sh STYLES
                   4798: .Nm
                   4799: offers various options to specify the colour and attributes of aspects of the
                   4800: interface, for example
                   4801: .Ic status-style
                   4802: for the status line.
                   4803: In addition, embedded styles may be specified in format options, such as
1.701     nicm     4804: .Ic status-left ,
1.623     nicm     4805: by enclosing them in
                   4806: .Ql #[
                   4807: and
1.639     nicm     4808: .Ql \&] .
1.623     nicm     4809: .Pp
                   4810: A style may be the single term
                   4811: .Ql default
1.688     nicm     4812: to specify the default style (which may come from an option, for example
                   4813: .Ic status-style
                   4814: in the status line) or a space
1.630     nicm     4815: or comma separated list of the following:
1.623     nicm     4816: .Bl -tag -width Ds
                   4817: .It Ic fg=colour
                   4818: Set the foreground colour.
                   4819: The colour is one of:
                   4820: .Ic black ,
                   4821: .Ic red ,
                   4822: .Ic green ,
                   4823: .Ic yellow ,
                   4824: .Ic blue ,
                   4825: .Ic magenta ,
                   4826: .Ic cyan ,
                   4827: .Ic white ;
                   4828: if supported the bright variants
                   4829: .Ic brightred ,
                   4830: .Ic brightgreen ,
                   4831: .Ic brightyellow ;
                   4832: .Ic colour0
                   4833: to
                   4834: .Ic colour255
                   4835: from the 256-colour set;
                   4836: .Ic default
                   4837: for the default colour;
                   4838: .Ic terminal
                   4839: for the terminal default colour; or a hexadecimal RGB string such as
                   4840: .Ql #ffffff .
                   4841: .It Ic bg=colour
                   4842: Set the background colour.
                   4843: .It Ic none
                   4844: Set no attributes (turn off any active attributes).
1.752     nicm     4845: .It Xo Ic acs ,
                   4846: .Ic bright
1.625     nicm     4847: (or
                   4848: .Ic bold ) ,
1.623     nicm     4849: .Ic dim ,
                   4850: .Ic underscore ,
                   4851: .Ic blink ,
                   4852: .Ic reverse ,
                   4853: .Ic hidden ,
                   4854: .Ic italics ,
1.649     nicm     4855: .Ic overline ,
1.623     nicm     4856: .Ic strikethrough ,
                   4857: .Ic double-underscore ,
                   4858: .Ic curly-underscore ,
                   4859: .Ic dotted-underscore ,
                   4860: .Ic dashed-underscore
                   4861: .Xc
                   4862: Set an attribute.
                   4863: Any of the attributes may be prefixed with
                   4864: .Ql no
                   4865: to unset.
1.752     nicm     4866: .Ic acs
                   4867: is the terminal alternate character set.
1.625     nicm     4868: .It Xo Ic align=left
                   4869: (or
                   4870: .Ic noalign ) ,
                   4871: .Ic align=centre ,
                   4872: .Ic align=right
                   4873: .Xc
                   4874: Align text to the left, centre or right of the available space if appropriate.
1.675     nicm     4875: .It Ic fill=colour
1.674     nicm     4876: Fill the available space with a background colour if appropriate.
1.625     nicm     4877: .It Xo Ic list=on ,
                   4878: .Ic list=focus ,
                   4879: .Ic list=left-marker ,
1.661     nicm     4880: .Ic list=right-marker ,
1.625     nicm     4881: .Ic nolist
                   4882: .Xc
                   4883: Mark the position of the various window list components in the
                   4884: .Ic status-format
                   4885: option:
                   4886: .Ic list=on
                   4887: marks the start of the list;
                   4888: .Ic list=focus
                   4889: is the part of the list that should be kept in focus if the entire list won't fit
                   4890: in the available space (typically the current window);
                   4891: .Ic list=left-marker
                   4892: and
                   4893: .Ic list=right-marker
                   4894: mark the text to be used to mark that text has been trimmed from the left or
                   4895: right of the list if there is not enough space.
1.688     nicm     4896: .It Xo Ic push-default ,
                   4897: .Ic pop-default
                   4898: .Xc
                   4899: Store the current colours and attributes as the default or reset to the previous
                   4900: default.
                   4901: A
                   4902: .Ic push-default
                   4903: affects any subsequent use of the
                   4904: .Ic default
                   4905: term until a
                   4906: .Ic pop-default .
                   4907: Only one default may be pushed (each
                   4908: .Ic push-default
                   4909: replaces the previous saved default).
1.625     nicm     4910: .It Xo Ic range=left ,
                   4911: .Ic range=right ,
                   4912: .Ic range=window|X ,
                   4913: .Ic norange
                   4914: .Xc
                   4915: Mark a range in the
1.651     nicm     4916: .Ic status-format
1.625     nicm     4917: option.
                   4918: .Ic range=left
                   4919: and
                   4920: .Ic range=right
                   4921: are the text used for the
                   4922: .Ql StatusLeft
                   4923: and
                   4924: .Ql StatusRight
                   4925: mouse keys.
                   4926: .Ic range=window|X
                   4927: is the range for a window passed to the
                   4928: .Ql Status
                   4929: mouse key, where
                   4930: .Ql X
                   4931: is a window index.
1.623     nicm     4932: .El
                   4933: .Pp
                   4934: Examples are:
                   4935: .Bd -literal -offset indent
1.630     nicm     4936: fg=yellow bold underscore blink
1.623     nicm     4937: bg=black,fg=default,noreverse
                   4938: .Ed
1.261     nicm     4939: .Sh NAMES AND TITLES
                   4940: .Nm
                   4941: distinguishes between names and titles.
                   4942: Windows and sessions have names, which may be used to specify them in targets
                   4943: and are displayed in the status line and various lists: the name is the
                   4944: .Nm
                   4945: identifier for a window or session.
                   4946: Only panes have titles.
1.577     nicm     4947: A pane's title is typically set by the program running inside the pane using
                   4948: an escape sequence (like it would set the
1.261     nicm     4949: .Xr xterm 1
1.577     nicm     4950: window title in
1.578     nicm     4951: .Xr X 7 ) .
1.268     nicm     4952: Windows themselves do not have titles - a window's title is the title of its
1.261     nicm     4953: active pane.
                   4954: .Nm
                   4955: itself may set the title of the terminal in which the client is running, see
                   4956: the
                   4957: .Ic set-titles
                   4958: option.
                   4959: .Pp
                   4960: A session's name is set with the
                   4961: .Ic new-session
                   4962: and
                   4963: .Ic rename-session
                   4964: commands.
                   4965: A window's name is set with one of:
                   4966: .Bl -enum -width Ds
                   4967: .It
                   4968: A command argument (such as
                   4969: .Fl n
                   4970: for
                   4971: .Ic new-window
                   4972: or
                   4973: .Ic new-session ) .
                   4974: .It
1.597     nicm     4975: An escape sequence (if the
                   4976: .Ic allow-rename
                   4977: option is turned on):
1.261     nicm     4978: .Bd -literal -offset indent
                   4979: $ printf '\e033kWINDOW_NAME\e033\e\e'
                   4980: .Ed
                   4981: .It
                   4982: Automatic renaming, which sets the name to the active command in the window's
                   4983: active pane.
                   4984: See the
                   4985: .Ic automatic-rename
                   4986: option.
                   4987: .El
                   4988: .Pp
                   4989: When a pane is first created, its title is the hostname.
1.612     nicm     4990: A pane's title can be set via the title setting escape sequence, for example:
1.261     nicm     4991: .Bd -literal -offset indent
                   4992: $ printf '\e033]2;My Title\e033\e\e'
                   4993: .Ed
1.577     nicm     4994: .Pp
                   4995: It can also be modified with the
                   4996: .Ic select-pane
                   4997: .Fl T
                   4998: command.
1.644     schwarze 4999: .Sh GLOBAL AND SESSION ENVIRONMENT
1.63      nicm     5000: When the server is started,
                   5001: .Nm
                   5002: copies the environment into the
                   5003: .Em global environment ;
                   5004: in addition, each session has a
                   5005: .Em session environment .
1.193     nicm     5006: When a window is created, the session and global environments are merged.
                   5007: If a variable exists in both, the value from the session environment is used.
                   5008: The result is the initial environment passed to the new process.
1.63      nicm     5009: .Pp
                   5010: The
                   5011: .Ic update-environment
                   5012: session option may be used to update the session environment from the client
                   5013: when a new session is created or an old reattached.
                   5014: .Nm
                   5015: also initialises the
                   5016: .Ev TMUX
                   5017: variable with some internal information to allow commands to be executed
                   5018: from inside, and the
                   5019: .Ev TERM
                   5020: variable with the correct terminal setting of
                   5021: .Ql screen .
                   5022: .Pp
1.728     nicm     5023: Variables in both session and global environments may be marked as hidden.
                   5024: Hidden variables are not passed into the environment of new processes and
                   5025: instead can only be used by tmux itself (for example in formats, see the
                   5026: .Sx FORMATS
                   5027: section).
                   5028: .Pp
1.63      nicm     5029: Commands to alter and view the environment are:
                   5030: .Bl -tag -width Ds
                   5031: .It Xo Ic set-environment
1.728     nicm     5032: .Op Fl hgru
1.63      nicm     5033: .Op Fl t Ar target-session
                   5034: .Ar name Op Ar value
                   5035: .Xc
1.115     nicm     5036: .D1 (alias: Ic setenv )
1.63      nicm     5037: Set or unset an environment variable.
                   5038: If
                   5039: .Fl g
                   5040: is used, the change is made in the global environment; otherwise, it is applied
                   5041: to the session environment for
                   5042: .Ar target-session .
                   5043: The
                   5044: .Fl u
                   5045: flag unsets a variable.
                   5046: .Fl r
                   5047: indicates the variable is to be removed from the environment before starting a
                   5048: new process.
1.728     nicm     5049: .Fl h
                   5050: marks the variable as hidden.
1.63      nicm     5051: .It Xo Ic show-environment
1.728     nicm     5052: .Op Fl hgs
1.63      nicm     5053: .Op Fl t Ar target-session
1.286     nicm     5054: .Op Ar variable
1.63      nicm     5055: .Xc
1.115     nicm     5056: .D1 (alias: Ic showenv )
1.63      nicm     5057: Display the environment for
                   5058: .Ar target-session
                   5059: or the global environment with
                   5060: .Fl g .
1.286     nicm     5061: If
                   5062: .Ar variable
                   5063: is omitted, all variables are shown.
1.63      nicm     5064: Variables removed from the environment are prefixed with
                   5065: .Ql - .
1.442     nicm     5066: If
                   5067: .Fl s
                   5068: is used, the output is formatted as a set of Bourne shell commands.
1.728     nicm     5069: .Fl h
                   5070: shows hidden variables (omitted by default).
1.57      jmc      5071: .El
                   5072: .Sh STATUS LINE
                   5073: .Nm
                   5074: includes an optional status line which is displayed in the bottom line of each
                   5075: terminal.
1.626     nicm     5076: .Pp
                   5077: By default, the status line is enabled and one line in height (it may be
                   5078: disabled or made multiple lines with the
1.57      jmc      5079: .Ic status
                   5080: session option) and contains, from left-to-right: the name of the current
1.261     nicm     5081: session in square brackets; the window list; the title of the active pane
                   5082: in double quotes; and the time and date.
1.57      jmc      5083: .Pp
1.626     nicm     5084: Each line of the status line is configured with the
                   5085: .Ic status-format
                   5086: option.
                   5087: The default is made of three parts: configurable left and right sections (which
                   5088: may contain dynamic content such as the time or output from a shell command,
                   5089: see the
1.57      jmc      5090: .Ic status-left ,
                   5091: .Ic status-left-length ,
                   5092: .Ic status-right ,
                   5093: and
                   5094: .Ic status-right-length
                   5095: options below), and a central window list.
1.125     nicm     5096: By default, the window list shows the index, name and (if any) flag of the
                   5097: windows present in the current session in ascending numerical order.
                   5098: It may be customised with the
                   5099: .Ar window-status-format
                   5100: and
                   5101: .Ar window-status-current-format
                   5102: options.
1.57      jmc      5103: The flag is one of the following symbols appended to the window name:
                   5104: .Bl -column "Symbol" "Meaning" -offset indent
                   5105: .It Sy "Symbol" Ta Sy "Meaning"
                   5106: .It Li "*" Ta "Denotes the current window."
                   5107: .It Li "-" Ta "Marks the last window (previously selected)."
1.574     nicm     5108: .It Li "#" Ta "Window activity is monitored and activity has been detected."
                   5109: .It Li "\&!" Ta "Window bells are monitored and a bell has occurred in the window."
1.192     nicm     5110: .It Li "~" Ta "The window has been silent for the monitor-silence interval."
1.432     nicm     5111: .It Li "M" Ta "The window contains the marked pane."
1.349     nicm     5112: .It Li "Z" Ta "The window's active pane is zoomed."
1.57      jmc      5113: .El
                   5114: .Pp
                   5115: The # symbol relates to the
                   5116: .Ic monitor-activity
1.388     nicm     5117: window option.
1.57      jmc      5118: The window name is printed in inverted colours if an alert (bell, activity or
1.388     nicm     5119: silence) is present.
1.57      jmc      5120: .Pp
1.131     nicm     5121: The colour and attributes of the status line may be configured, the entire
                   5122: status line using the
1.378     nicm     5123: .Ic status-style
                   5124: session option and individual windows using the
                   5125: .Ic window-status-style
                   5126: window option.
1.57      jmc      5127: .Pp
1.131     nicm     5128: The status line is automatically refreshed at interval if it has changed, the
                   5129: interval may be controlled with the
1.57      jmc      5130: .Ic status-interval
                   5131: session option.
                   5132: .Pp
                   5133: Commands related to the status line are as follows:
                   5134: .Bl -tag -width Ds
                   5135: .It Xo Ic command-prompt
1.758     nicm     5136: .Op Fl 1ikNTW
1.235     nicm     5137: .Op Fl I Ar inputs
1.73      nicm     5138: .Op Fl p Ar prompts
1.57      jmc      5139: .Op Fl t Ar target-client
                   5140: .Op Ar template
                   5141: .Xc
                   5142: Open the command prompt in a client.
                   5143: This may be used from inside
                   5144: .Nm
                   5145: to execute commands interactively.
1.231     nicm     5146: .Pp
1.57      jmc      5147: If
                   5148: .Ar template
1.73      nicm     5149: is specified, it is used as the command.
1.235     nicm     5150: If present,
                   5151: .Fl I
                   5152: is a comma-separated list of the initial text for each prompt.
1.73      nicm     5153: If
                   5154: .Fl p
                   5155: is given,
                   5156: .Ar prompts
                   5157: is a comma-separated list of prompts which are displayed in order; otherwise
                   5158: a single prompt is displayed, constructed from
                   5159: .Ar template
                   5160: if it is present, or
                   5161: .Ql \&:
                   5162: if not.
1.231     nicm     5163: .Pp
1.73      nicm     5164: Before the command is executed, the first occurrence of the string
                   5165: .Ql %%
1.74      jmc      5166: and all occurrences of
1.73      nicm     5167: .Ql %1
1.492     nicm     5168: are replaced by the response to the first prompt, all
1.73      nicm     5169: .Ql %2
                   5170: are replaced with the response to the second prompt, and so on for further
1.74      jmc      5171: prompts.
                   5172: Up to nine prompt responses may be replaced
                   5173: .Po
                   5174: .Ql %1
1.73      nicm     5175: to
1.74      jmc      5176: .Ql %9
                   5177: .Pc .
1.513     nicm     5178: .Ql %%%
                   5179: is like
                   5180: .Ql %%
                   5181: but any quotation marks are escaped.
1.497     nicm     5182: .Pp
                   5183: .Fl 1
                   5184: makes the prompt only accept one key press, in this case the resulting input
                   5185: is a single character.
1.706     nicm     5186: .Fl k
                   5187: is like
                   5188: .Fl 1
                   5189: but the key press is translated to a key name.
1.678     nicm     5190: .Fl N
                   5191: makes the prompt only accept numeric key presses.
1.517     nicm     5192: .Fl i
                   5193: executes the command every time the prompt input changes instead of when the
                   5194: user exits the command prompt.
1.758     nicm     5195: .Fl T
                   5196: tells
                   5197: .Nm
                   5198: that the prompt is for a target which affects what completions are offered when
                   5199: .Em Tab
                   5200: is pressed;
                   5201: .Fl W
                   5202: is similar but indicates the prompt is for a window.
1.500     nicm     5203: .Pp
                   5204: The following keys have a special meaning in the command prompt, depending
                   5205: on the value of the
                   5206: .Ic status-keys
                   5207: option:
                   5208: .Bl -column "FunctionXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXX" "emacsX" -offset indent
                   5209: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
1.715     nicm     5210: .It Li "Cancel command prompt" Ta "q" Ta "Escape"
1.678     nicm     5211: .It Li "Delete from cursor to start of word" Ta "" Ta "C-w"
1.500     nicm     5212: .It Li "Delete entire command" Ta "d" Ta "C-u"
                   5213: .It Li "Delete from cursor to end" Ta "D" Ta "C-k"
                   5214: .It Li "Execute command" Ta "Enter" Ta "Enter"
                   5215: .It Li "Get next command from history" Ta "" Ta "Down"
                   5216: .It Li "Get previous command from history" Ta "" Ta "Up"
                   5217: .It Li "Insert top paste buffer" Ta "p" Ta "C-y"
                   5218: .It Li "Look for completions" Ta "Tab" Ta "Tab"
                   5219: .It Li "Move cursor left" Ta "h" Ta "Left"
                   5220: .It Li "Move cursor right" Ta "l" Ta "Right"
                   5221: .It Li "Move cursor to end" Ta "$" Ta "C-e"
                   5222: .It Li "Move cursor to next word" Ta "w" Ta "M-f"
                   5223: .It Li "Move cursor to previous word" Ta "b" Ta "M-b"
                   5224: .It Li "Move cursor to start" Ta "0" Ta "C-a"
                   5225: .It Li "Transpose characters" Ta "" Ta "C-t"
                   5226: .El
1.57      jmc      5227: .It Xo Ic confirm-before
1.238     nicm     5228: .Op Fl p Ar prompt
1.57      jmc      5229: .Op Fl t Ar target-client
                   5230: .Ar command
                   5231: .Xc
                   5232: .D1 (alias: Ic confirm )
                   5233: Ask for confirmation before executing
                   5234: .Ar command .
1.238     nicm     5235: If
                   5236: .Fl p
                   5237: is given,
                   5238: .Ar prompt
                   5239: is the prompt to display; otherwise a prompt is constructed from
                   5240: .Ar command .
                   5241: It may contain the special character sequences supported by the
                   5242: .Ic status-left
                   5243: option.
                   5244: .Pp
1.57      jmc      5245: This command works only from inside
                   5246: .Nm .
1.646     nicm     5247: .It Xo Ic display-menu
                   5248: .Op Fl c Ar target-client
                   5249: .Op Fl t Ar target-pane
                   5250: .Op Fl T Ar title
                   5251: .Op Fl x Ar position
                   5252: .Op Fl y Ar position
1.657     nicm     5253: .Ar name
                   5254: .Ar key
                   5255: .Ar command
                   5256: .Ar ...
1.646     nicm     5257: .Xc
1.651     nicm     5258: .D1 (alias: Ic menu )
1.646     nicm     5259: Display a menu on
                   5260: .Ar target-client .
                   5261: .Ar target-pane
                   5262: gives the target for any commands run from the menu.
                   5263: .Pp
1.657     nicm     5264: A menu is passed as a series of arguments: first the menu item name,
                   5265: second the key shortcut (or empty for none) and third the command
                   5266: to run when the menu item is chosen.
                   5267: The name and command are formats, see the
1.646     nicm     5268: .Sx FORMATS
                   5269: and
                   5270: .Sx STYLES
                   5271: sections.
1.658     nicm     5272: If the name begins with a hyphen (-), then the item is disabled (shown dim) and
                   5273: may not be chosen.
1.657     nicm     5274: The name may be empty for a separator line, in which case both the key and
                   5275: command should be omitted.
1.646     nicm     5276: .Pp
                   5277: .Fl T
                   5278: is a format for the menu title (see
                   5279: .Sx FORMATS ) .
                   5280: .Pp
                   5281: .Fl x
                   5282: and
                   5283: .Fl y
                   5284: give the position of the menu.
                   5285: Both may be a row or column number, or one of the following special values:
                   5286: .Bl -column "XXXXX" "XXXX" -offset indent
                   5287: .It Sy "Value" Ta Sy "Flag" Ta Sy "Meaning"
1.719     nicm     5288: .It Li "C" Ta "Both" Ta "The centre of the terminal"
1.646     nicm     5289: .It Li "R" Ta Fl x Ta "The right side of the terminal"
                   5290: .It Li "P" Ta "Both" Ta "The bottom left of the pane"
                   5291: .It Li "M" Ta "Both" Ta "The mouse position"
1.730     nicm     5292: .It Li "W" Ta "Both" Ta "The window position on the status line"
1.646     nicm     5293: .It Li "S" Ta Fl y Ta "The line above or below the status line"
                   5294: .El
                   5295: .Pp
                   5296: Each menu consists of items followed by a key shortcut shown in brackets.
                   5297: If the menu is too large to fit on the terminal, it is not displayed.
                   5298: Pressing the key shortcut chooses the corresponding item.
                   5299: If the mouse is enabled and the menu is opened from a mouse key binding, releasing
                   5300: the mouse button with an item selected will choose that item.
                   5301: The following keys are also available:
                   5302: .Bl -column "Key" "Function" -offset indent
                   5303: .It Sy "Key" Ta Sy "Function"
                   5304: .It Li "Enter" Ta "Choose selected item"
                   5305: .It Li "Up" Ta "Select previous item"
                   5306: .It Li "Down" Ta "Select next item"
                   5307: .It Li "q" Ta "Exit menu"
                   5308: .El
1.57      jmc      5309: .It Xo Ic display-message
1.643     nicm     5310: .Op Fl aIpv
1.215     nicm     5311: .Op Fl c Ar target-client
                   5312: .Op Fl t Ar target-pane
1.57      jmc      5313: .Op Ar message
                   5314: .Xc
                   5315: .D1 (alias: Ic display )
1.127     nicm     5316: Display a message.
                   5317: If
                   5318: .Fl p
                   5319: is given, the output is printed to stdout, otherwise it is displayed in the
                   5320: .Ar target-client
                   5321: status line.
1.122     nicm     5322: The format of
1.124     jmc      5323: .Ar message
1.275     nicm     5324: is described in the
                   5325: .Sx FORMATS
                   5326: section; information is taken from
1.215     nicm     5327: .Ar target-pane
                   5328: if
                   5329: .Fl t
1.678     nicm     5330: is given, otherwise the active pane.
1.622     nicm     5331: .Pp
1.624     nicm     5332: .Fl v
                   5333: prints verbose logging as the format is parsed and
                   5334: .Fl a
                   5335: lists the format variables and their values.
1.643     nicm     5336: .Pp
                   5337: .Fl I
                   5338: forwards any input read from stdin to the empty pane given by
                   5339: .Ar target-pane .
1.721     nicm     5340: .It Xo Ic display-popup
                   5341: .Op Fl CEK
                   5342: .Op Fl c Ar target-client
                   5343: .Op Fl d Ar start-directory
                   5344: .Op Fl h Ar height
                   5345: .Op Fl R Ar shell-command
                   5346: .Op Fl t Ar target-pane
                   5347: .Op Fl w Ar width
                   5348: .Op Fl x Ar position
                   5349: .Op Fl y Ar position
                   5350: .Op Ar command Ar line Ar ...
                   5351: .Xc
                   5352: .D1 (alias: Ic popup )
                   5353: Display a popup on
                   5354: .Ar target-client .
                   5355: A popup is a rectangular box drawn over the top of any panes.
                   5356: Panes are not updated while a popup is present.
                   5357: The popup content may be given in two ways:
                   5358: .Bl -enum -offset Ds
                   5359: .It
                   5360: A set of lines as arguments.
                   5361: Each line is a format which is expanded using
                   5362: .Ar target-pane
                   5363: as the target.
                   5364: If a line contains newlines it is split into multiple lines.
                   5365: Lines may use styles, see the
                   5366: .Sx STYLES
                   5367: section.
                   5368: .It
                   5369: A shell command given by
                   5370: .Fl R
                   5371: which is run and any output shown in the pane.
                   5372: .El
                   5373: .Pp
                   5374: The first argument,
                   5375: .Ar command ,
                   5376: is a
                   5377: .Nm
                   5378: command which is run when a key is pressed.
                   5379: The key is available in the
                   5380: .Ql popup_key
                   5381: format.
                   5382: After
                   5383: .Ar command
                   5384: is run, the popup is closed.
                   5385: It may be empty to discard any key presses.
                   5386: If
                   5387: .Fl K
                   5388: is given together with
1.722     nicm     5389: .Fl R ,
1.721     nicm     5390: key presses are instead passed to the
                   5391: .Fl R
                   5392: shell command.
                   5393: .Fl E
                   5394: closes the popup automatically when
                   5395: .Ar shell-command
                   5396: exits.
1.723     nicm     5397: Two
                   5398: .Fl E
                   5399: closes the popup only if
                   5400: .Ar shell-command
                   5401: exited with success.
1.721     nicm     5402: With
                   5403: .Fl K ,
                   5404: .Ql Escape
                   5405: and
                   5406: .Ql C-c
                   5407: close the popup unless
                   5408: .Fl E
                   5409: is also given.
                   5410: .Pp
                   5411: .Fl x
                   5412: and
                   5413: .Fl y
                   5414: give the position of the popup, they have the same meaning as for the
                   5415: .Ic display-menu
                   5416: command.
                   5417: .Fl w
                   5418: and
                   5419: .Fl h
                   5420: give the width and height - both may be a percentage (followed by
                   5421: .Ql % ) .
                   5422: If omitted, without
                   5423: .Fl R
                   5424: they are calculated from the given lines and with
                   5425: .Fl R
                   5426: they use half the terminal size.
                   5427: .Pp
                   5428: The
                   5429: .Fl C
                   5430: flag closes any popup on the client.
1.57      jmc      5431: .El
                   5432: .Sh BUFFERS
                   5433: .Nm
1.392     nicm     5434: maintains a set of named
1.199     nicm     5435: .Em paste buffers .
1.392     nicm     5436: Each buffer may be either explicitly or automatically named.
                   5437: Explicitly named buffers are named when created with the
                   5438: .Ic set-buffer
                   5439: or
                   5440: .Ic load-buffer
                   5441: commands, or by renaming an automatically named buffer with
                   5442: .Ic set-buffer
                   5443: .Fl n .
                   5444: Automatically named buffers are given a name such as
                   5445: .Ql buffer0001 ,
                   5446: .Ql buffer0002
                   5447: and so on.
                   5448: When the
                   5449: .Ic buffer-limit
                   5450: option is reached, the oldest automatically named buffer is deleted.
1.493     nicm     5451: Explicitly named buffers are not subject to
1.57      jmc      5452: .Ic buffer-limit
1.709     nicm     5453: and may be deleted with the
1.392     nicm     5454: .Ic delete-buffer
                   5455: command.
                   5456: .Pp
1.57      jmc      5457: Buffers may be added using
                   5458: .Ic copy-mode
                   5459: or the
                   5460: .Ic set-buffer
1.392     nicm     5461: and
                   5462: .Ic load-buffer
                   5463: commands, and pasted into a window using the
1.57      jmc      5464: .Ic paste-buffer
                   5465: command.
1.392     nicm     5466: If a buffer command is used and no buffer is specified, the most
                   5467: recently added automatically named buffer is assumed.
1.57      jmc      5468: .Pp
                   5469: A configurable history buffer is also maintained for each window.
                   5470: By default, up to 2000 lines are kept; this can be altered with the
                   5471: .Ic history-limit
                   5472: option (see the
                   5473: .Ic set-option
                   5474: command above).
                   5475: .Pp
                   5476: The buffer commands are as follows:
                   5477: .Bl -tag -width Ds
1.178     nicm     5478: .It Xo
                   5479: .Ic choose-buffer
1.682     nicm     5480: .Op Fl NZr
1.572     nicm     5481: .Op Fl F Ar format
1.562     nicm     5482: .Op Fl f Ar filter
1.561     nicm     5483: .Op Fl O Ar sort-order
1.555     nicm     5484: .Op Fl t Ar target-pane
1.178     nicm     5485: .Op Ar template
                   5486: .Xc
1.555     nicm     5487: Put a pane into buffer mode, where a buffer may be chosen interactively from
                   5488: a list.
1.593     nicm     5489: .Fl Z
                   5490: zooms the pane.
1.555     nicm     5491: The following keys may be used in buffer mode:
                   5492: .Bl -column "Key" "Function" -offset indent
                   5493: .It Sy "Key" Ta Sy "Function"
1.582     nicm     5494: .It Li "Enter" Ta "Paste selected buffer"
1.555     nicm     5495: .It Li "Up" Ta "Select previous buffer"
                   5496: .It Li "Down" Ta "Select next buffer"
1.559     nicm     5497: .It Li "C-s" Ta "Search by name or content"
                   5498: .It Li "n" Ta "Repeat last search"
1.555     nicm     5499: .It Li "t" Ta "Toggle if buffer is tagged"
                   5500: .It Li "T" Ta "Tag no buffers"
                   5501: .It Li "C-t" Ta "Tag all buffers"
1.582     nicm     5502: .It Li "p" Ta "Paste selected buffer"
                   5503: .It Li "P" Ta "Paste tagged buffers"
1.555     nicm     5504: .It Li "d" Ta "Delete selected buffer"
                   5505: .It Li "D" Ta "Delete tagged buffers"
1.759     nicm     5506: .It Li "e" Ta "Open the buffer in an editor"
1.562     nicm     5507: .It Li "f" Ta "Enter a format to filter items"
1.682     nicm     5508: .It Li "O" Ta "Change sort field"
                   5509: .It Li "r" Ta "Reverse sort order"
1.576     nicm     5510: .It Li "v" Ta "Toggle preview"
1.555     nicm     5511: .It Li "q" Ta "Exit mode"
                   5512: .El
                   5513: .Pp
                   5514: After a buffer is chosen,
1.178     nicm     5515: .Ql %%
1.392     nicm     5516: is replaced by the buffer name in
1.178     nicm     5517: .Ar template
                   5518: and the result executed as a command.
                   5519: If
                   5520: .Ar template
                   5521: is not given, "paste-buffer -b '%%'" is used.
1.555     nicm     5522: .Pp
1.561     nicm     5523: .Fl O
1.682     nicm     5524: specifies the initial sort field: one of
1.561     nicm     5525: .Ql time ,
                   5526: .Ql name
                   5527: or
                   5528: .Ql size .
1.682     nicm     5529: .Fl r
                   5530: reverses the sort order.
1.562     nicm     5531: .Fl f
1.579     nicm     5532: specifies an initial filter: the filter is a format - if it evaluates to zero,
                   5533: the item in the list is not shown, otherwise it is shown.
                   5534: If a filter would lead to an empty list, it is ignored.
1.572     nicm     5535: .Fl F
                   5536: specifies the format for each item in the list.
1.576     nicm     5537: .Fl N
                   5538: starts without the preview.
1.314     nicm     5539: This command works only if at least one client is attached.
1.57      jmc      5540: .It Ic clear-history Op Fl t Ar target-pane
                   5541: .D1 (alias: Ic clearhist )
                   5542: Remove and free the history for the specified pane.
1.392     nicm     5543: .It Ic delete-buffer Op Fl b Ar buffer-name
1.57      jmc      5544: .D1 (alias: Ic deleteb )
1.392     nicm     5545: Delete the buffer named
                   5546: .Ar buffer-name ,
                   5547: or the most recently added automatically named buffer if not specified.
1.294     nicm     5548: .It Xo Ic list-buffers
                   5549: .Op Fl F Ar format
1.738     nicm     5550: .Op Fl f Ar filter
1.294     nicm     5551: .Xc
1.57      jmc      5552: .D1 (alias: Ic lsb )
1.198     nicm     5553: List the global buffers.
1.294     nicm     5554: .Fl F
1.738     nicm     5555: specifies the format of each line and
                   5556: .Fl f
                   5557: a filter.
                   5558: Only buffers for which the filter is true are shown.
                   5559: See the
1.294     nicm     5560: .Sx FORMATS
                   5561: section.
1.200     jmc      5562: .It Xo Ic load-buffer
1.392     nicm     5563: .Op Fl b Ar buffer-name
1.57      jmc      5564: .Ar path
                   5565: .Xc
                   5566: .D1 (alias: Ic loadb )
                   5567: Load the contents of the specified paste buffer from
                   5568: .Ar path .
                   5569: .It Xo Ic paste-buffer
1.278     nicm     5570: .Op Fl dpr
1.392     nicm     5571: .Op Fl b Ar buffer-name
1.170     nicm     5572: .Op Fl s Ar separator
1.158     nicm     5573: .Op Fl t Ar target-pane
1.57      jmc      5574: .Xc
                   5575: .D1 (alias: Ic pasteb )
1.158     nicm     5576: Insert the contents of a paste buffer into the specified pane.
                   5577: If not specified, paste into the current one.
1.57      jmc      5578: With
                   5579: .Fl d ,
1.392     nicm     5580: also delete the paste buffer.
1.57      jmc      5581: When output, any linefeed (LF) characters in the paste buffer are replaced with
1.170     nicm     5582: a separator, by default carriage return (CR).
                   5583: A custom separator may be specified using the
                   5584: .Fl s
                   5585: flag.
                   5586: The
1.57      jmc      5587: .Fl r
1.170     nicm     5588: flag means to do no replacement (equivalent to a separator of LF).
1.278     nicm     5589: If
                   5590: .Fl p
                   5591: is specified, paste bracket control codes are inserted around the
                   5592: buffer if the application has requested bracketed paste mode.
1.57      jmc      5593: .It Xo Ic save-buffer
                   5594: .Op Fl a
1.392     nicm     5595: .Op Fl b Ar buffer-name
1.57      jmc      5596: .Ar path
                   5597: .Xc
                   5598: .D1 (alias: Ic saveb )
                   5599: Save the contents of the specified paste buffer to
                   5600: .Ar path .
                   5601: The
                   5602: .Fl a
                   5603: option appends to rather than overwriting the file.
                   5604: .It Xo Ic set-buffer
1.383     nicm     5605: .Op Fl a
1.392     nicm     5606: .Op Fl b Ar buffer-name
                   5607: .Op Fl n Ar new-buffer-name
1.57      jmc      5608: .Ar data
                   5609: .Xc
                   5610: .D1 (alias: Ic setb )
                   5611: Set the contents of the specified buffer to
                   5612: .Ar data .
1.383     nicm     5613: The
                   5614: .Fl a
                   5615: option appends to rather than overwriting the buffer.
1.392     nicm     5616: The
                   5617: .Fl n
                   5618: option renames the buffer to
                   5619: .Ar new-buffer-name .
1.1       nicm     5620: .It Xo Ic show-buffer
1.392     nicm     5621: .Op Fl b Ar buffer-name
1.1       nicm     5622: .Xc
                   5623: .D1 (alias: Ic showb )
                   5624: Display the contents of the specified buffer.
1.57      jmc      5625: .El
                   5626: .Sh MISCELLANEOUS
                   5627: Miscellaneous commands are as follows:
                   5628: .Bl -tag -width Ds
1.72      nicm     5629: .It Ic clock-mode Op Fl t Ar target-pane
1.57      jmc      5630: Display a large clock.
1.334     nicm     5631: .It Xo Ic if-shell
1.410     nicm     5632: .Op Fl bF
1.334     nicm     5633: .Op Fl t Ar target-pane
                   5634: .Ar shell-command command
                   5635: .Op Ar command
                   5636: .Xc
1.57      jmc      5637: .D1 (alias: Ic if )
1.251     nicm     5638: Execute the first
1.57      jmc      5639: .Ar command
                   5640: if
                   5641: .Ar shell-command
1.251     nicm     5642: returns success or the second
                   5643: .Ar command
                   5644: otherwise.
1.410     nicm     5645: Before being executed,
                   5646: .Ar shell-command
                   5647: is expanded using the rules specified in the
1.334     nicm     5648: .Sx FORMATS
                   5649: section, including those relevant to
                   5650: .Ar target-pane .
1.335     nicm     5651: With
                   5652: .Fl b ,
                   5653: .Ar shell-command
                   5654: is run in the background.
1.410     nicm     5655: .Pp
                   5656: If
                   5657: .Fl F
                   5658: is given,
                   5659: .Ar shell-command
                   5660: is not executed but considered success if neither empty nor zero (after formats
                   5661: are expanded).
1.57      jmc      5662: .It Ic lock-server
                   5663: .D1 (alias: Ic lock )
1.90      nicm     5664: Lock each client individually by running the command specified by the
                   5665: .Ic lock-command
                   5666: option.
1.308     nicm     5667: .It Xo Ic run-shell
1.357     nicm     5668: .Op Fl b
1.717     nicm     5669: .Op Fl d Ar delay
1.308     nicm     5670: .Op Fl t Ar target-pane
1.718     nicm     5671: .Op Ar shell-command
1.308     nicm     5672: .Xc
1.87      nicm     5673: .D1 (alias: Ic run )
                   5674: Execute
1.153     nicm     5675: .Ar shell-command
1.106     nicm     5676: in the background without creating a window.
1.334     nicm     5677: Before being executed, shell-command is expanded using the rules specified in
                   5678: the
                   5679: .Sx FORMATS
                   5680: section.
1.335     nicm     5681: With
                   5682: .Fl b ,
                   5683: the command is run in the background.
1.717     nicm     5684: .Fl d
                   5685: waits for
                   5686: .Ar delay
                   5687: seconds before starting the command.
                   5688: After the command finishes, any output to stdout is displayed in view mode (in
                   5689: the pane specified by
1.308     nicm     5690: .Fl t
                   5691: or the current pane if omitted).
1.153     nicm     5692: If the command doesn't return success, the exit status is also displayed.
1.342     nicm     5693: .It Xo Ic wait-for
1.370     nicm     5694: .Op Fl L | S | U
1.342     nicm     5695: .Ar channel
                   5696: .Xc
                   5697: .D1 (alias: Ic wait )
1.343     nicm     5698: When used without options, prevents the client from exiting until woken using
1.342     nicm     5699: .Ic wait-for
                   5700: .Fl S
                   5701: with the same channel.
1.343     nicm     5702: When
                   5703: .Fl L
                   5704: is used, the channel is locked and any clients that try to lock the same
                   5705: channel are made to wait until the channel is unlocked with
                   5706: .Ic wait-for
                   5707: .Fl U .
1.703     nicm     5708: .El
                   5709: .Sh EXIT MESSAGES
                   5710: When a
                   5711: .Nm
                   5712: client detaches, it prints a message.
                   5713: This may be one of:
                   5714: .Bl -tag -width Ds
                   5715: .It [detached (from session ...)]
                   5716: The client was detached normally.
                   5717: .It [detached and SIGHUP]
                   5718: The client was detached and its parent sent the
                   5719: .Dv SIGHUP
                   5720: signal (for example with
                   5721: .Ic detach-client
                   5722: .Fl P ) .
                   5723: .It [lost tty]
                   5724: The client's
                   5725: .Xr tty 4
                   5726: or
                   5727: .Xr pty 4
                   5728: was unexpectedly destroyed.
                   5729: .It [terminated]
                   5730: The client was killed with
                   5731: .Dv SIGTERM .
                   5732: .It [exited]
                   5733: The server exited when it had no sessions.
                   5734: .It [server exited]
                   5735: The server exited when it received
                   5736: .Dv SIGTERM .
                   5737: .It [server exited unexpectedly]
                   5738: The server crashed or otherwise exited without telling the client the reason.
1.228     nicm     5739: .El
                   5740: .Sh TERMINFO EXTENSIONS
                   5741: .Nm
1.478     nicm     5742: understands some unofficial extensions to
1.746     nicm     5743: .Xr terminfo 5 .
1.744     nicm     5744: It is not normally necessary to set these manually, instead the
                   5745: .Ic terminal-features
                   5746: option should be used.
1.228     nicm     5747: .Bl -tag -width Ds
1.756     nicm     5748: .It Em \&AX
                   5749: An existing extension that tells
                   5750: .Nm
                   5751: the terminal supports default colours.
1.739     nicm     5752: .It Em \&Cs , Cr
1.233     nicm     5753: Set the cursor colour.
1.232     jmc      5754: The first takes a single string argument and is used to set the colour;
                   5755: the second takes no arguments and restores the default cursor colour.
                   5756: If set, a sequence such as this may be used
                   5757: to change the cursor colour from inside
                   5758: .Nm :
                   5759: .Bd -literal -offset indent
                   5760: $ printf '\e033]12;red\e033\e\e'
                   5761: .Ed
1.753     nicm     5762: .It Em \&Cmg, \&Clmg, \&Dsmg , \&Enmg
                   5763: Set, clear, disable or enable DECSLRM margins.
1.756     nicm     5764: These are set automatically if the terminal reports it is
                   5765: .Em VT420
                   5766: compatible.
1.755     nicm     5767: .It Em \&Dsbp , \&Enbp
                   5768: Disable and enable bracketed paste.
1.756     nicm     5769: These are set automatically if the
                   5770: .Em XT
                   5771: capability is present.
1.772     nicm     5772: .It Em \&Dseks , \&Eneks
                   5773: Disable and enable extended keys.
1.756     nicm     5774: .It Em \&Dsfcs , \&Enfcs
                   5775: Disable and enable focus reporting.
                   5776: These are set automatically if the
                   5777: .Em XT
                   5778: capability is present.
1.649     nicm     5779: .It Em \&Smol
                   5780: Enable the overline attribute.
1.611     nicm     5781: .It Em \&Smulx
1.672     nicm     5782: Set a styled underscore.
                   5783: The single parameter is one of: 0 for no underscore, 1 for normal
                   5784: underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted
                   5785: underscore and 5 for dashed underscore.
                   5786: .It Em \&Setulc
                   5787: Set the underscore colour.
                   5788: The argument is (red * 65536) + (green * 256) + blue where each is between 0
                   5789: and 255.
1.361     jmc      5790: .It Em \&Ss , Se
1.403     nicm     5791: Set or reset the cursor style.
1.232     jmc      5792: If set, a sequence such as this may be used
                   5793: to change the cursor to an underline:
1.230     nicm     5794: .Bd -literal -offset indent
                   5795: $ printf '\e033[4 q'
                   5796: .Ed
                   5797: .Pp
                   5798: If
1.403     nicm     5799: .Em Se
                   5800: is not set, \&Ss with argument 0 will be used to reset the cursor style instead.
1.741     nicm     5801: .It Em \&Sync
1.745     nicm     5802: Start (parameter is 1) or end (parameter is 2) a synchronized update.
1.478     nicm     5803: .It Em \&Tc
                   5804: Indicate that the terminal supports the
                   5805: .Ql direct colour
                   5806: RGB escape sequence (for example, \ee[38;2;255;255;255m).
1.518     nicm     5807: .Pp
1.612     nicm     5808: If supported, this is used for the initialize colour escape sequence (which
1.518     nicm     5809: may be enabled by adding the
                   5810: .Ql initc
                   5811: and
                   5812: .Ql ccc
                   5813: capabilities to the
                   5814: .Nm
                   5815: .Xr terminfo 5
                   5816: entry).
1.739     nicm     5817: .Pp
                   5818: This is equivalent to the
                   5819: .Em RGB
                   5820: .Xr terminfo 5
                   5821: capability.
1.232     jmc      5822: .It Em \&Ms
1.478     nicm     5823: Store the current buffer in the host terminal's selection (clipboard).
1.232     jmc      5824: See the
                   5825: .Em set-clipboard
                   5826: option above and the
                   5827: .Xr xterm 1
                   5828: man page.
1.756     nicm     5829: .It Em \&XT
                   5830: This is an existing extension capability that tmux uses to mean that the
                   5831: terminal supports the
                   5832: .Xr xterm 1
                   5833: title set sequences and to automatically set some of the capabilities above.
1.345     nicm     5834: .El
                   5835: .Sh CONTROL MODE
                   5836: .Nm
                   5837: offers a textual interface called
                   5838: .Em control mode .
                   5839: This allows applications to communicate with
                   5840: .Nm
                   5841: using a simple text-only protocol.
                   5842: .Pp
                   5843: In control mode, a client sends
                   5844: .Nm
                   5845: commands or command sequences terminated by newlines on standard input.
                   5846: Each command will produce one block of output on standard output.
                   5847: An output block consists of a
                   5848: .Em %begin
                   5849: line followed by the output (which may be empty).
                   5850: The output block ends with a
                   5851: .Em %end
                   5852: or
                   5853: .Em %error .
                   5854: .Em %begin
                   5855: and matching
                   5856: .Em %end
                   5857: or
                   5858: .Em %error
                   5859: have two arguments: an integer time (as seconds from epoch) and command number.
                   5860: For example:
                   5861: .Bd -literal -offset indent
                   5862: %begin 1363006971 2
                   5863: 0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
                   5864: %end 1363006971 2
                   5865: .Ed
1.535     nicm     5866: .Pp
                   5867: The
                   5868: .Ic refresh-client
                   5869: .Fl C
                   5870: command may be used to set the size of a client in control mode.
1.345     nicm     5871: .Pp
                   5872: In control mode,
                   5873: .Nm
                   5874: outputs notifications.
                   5875: A notification will never occur inside an output block.
                   5876: .Pp
                   5877: The following notifications are defined:
                   5878: .Bl -tag -width Ds
1.750     jmc      5879: .It Ic %client-session-changed Ar client session-id name
1.547     nicm     5880: The client is now attached to the session with ID
                   5881: .Ar session-id ,
                   5882: which is named
                   5883: .Ar name .
1.345     nicm     5884: .It Ic %exit Op Ar reason
                   5885: The
                   5886: .Nm
                   5887: client is exiting immediately, either because it is not attached to any session
                   5888: or an error occurred.
                   5889: If present,
                   5890: .Ar reason
                   5891: describes why the client exited.
1.460     nicm     5892: .It Ic %layout-change Ar window-id Ar window-layout Ar window-visible-layout Ar window-flags
1.345     nicm     5893: The layout of a window with ID
                   5894: .Ar window-id
                   5895: changed.
                   5896: The new layout is
                   5897: .Ar window-layout .
1.460     nicm     5898: The window's visible layout is
                   5899: .Ar window-visible-layout
                   5900: and the window flags are
                   5901: .Ar window-flags .
1.347     nicm     5902: .It Ic %output Ar pane-id Ar value
                   5903: A window pane produced output.
1.345     nicm     5904: .Ar value
1.350     nicm     5905: escapes non-printable characters and backslash as octal \\xxx.
1.547     nicm     5906: .It Ic %pane-mode-changed Ar pane-id
                   5907: The pane with ID
                   5908: .Ar pane-id
                   5909: has changed mode.
1.345     nicm     5910: .It Ic %session-changed Ar session-id Ar name
                   5911: The client is now attached to the session with ID
                   5912: .Ar session-id ,
                   5913: which is named
                   5914: .Ar name .
                   5915: .It Ic %session-renamed Ar name
                   5916: The current session was renamed to
                   5917: .Ar name .
1.547     nicm     5918: .It Ic %session-window-changed Ar session-id Ar window-id
                   5919: The session with ID
                   5920: .Ar session-id
                   5921: changed its active window to the window with ID
                   5922: .Ar window-id .
1.345     nicm     5923: .It Ic %sessions-changed
                   5924: A session was created or destroyed.
                   5925: .It Ic %unlinked-window-add Ar window-id
                   5926: The window with ID
                   5927: .Ar window-id
                   5928: was created but is not linked to the current session.
                   5929: .It Ic %window-add Ar window-id
                   5930: The window with ID
                   5931: .Ar window-id
                   5932: was linked to the current session.
                   5933: .It Ic %window-close Ar window-id
                   5934: The window with ID
                   5935: .Ar window-id
                   5936: closed.
1.547     nicm     5937: .It Ic %window-pane-changed Ar window-id Ar pane-id
                   5938: The active pane in the window with ID
                   5939: .Ar window-id
                   5940: changed to the pane with ID
                   5941: .Ar pane-id .
1.345     nicm     5942: .It Ic %window-renamed Ar window-id Ar name
                   5943: The window with ID
                   5944: .Ar window-id
                   5945: was renamed to
                   5946: .Ar name .
1.644     schwarze 5947: .El
                   5948: .Sh ENVIRONMENT
                   5949: When
                   5950: .Nm
                   5951: is started, it inspects the following environment variables:
                   5952: .Bl -tag -width LC_CTYPE
                   5953: .It Ev EDITOR
                   5954: If the command specified in this variable contains the string
                   5955: .Ql vi
                   5956: and
                   5957: .Ev VISUAL
                   5958: is unset, use vi-style key bindings.
                   5959: Overridden by the
                   5960: .Ic mode-keys
                   5961: and
                   5962: .Ic status-keys
                   5963: options.
                   5964: .It Ev HOME
                   5965: The user's login directory.
                   5966: If unset, the
                   5967: .Xr passwd 5
                   5968: database is consulted.
                   5969: .It Ev LC_CTYPE
                   5970: The character encoding
                   5971: .Xr locale 1 .
                   5972: It is used for two separate purposes.
                   5973: For output to the terminal, UTF-8 is used if the
                   5974: .Fl u
                   5975: option is given or if
                   5976: .Ev LC_CTYPE
                   5977: contains
                   5978: .Qq UTF-8
                   5979: or
                   5980: .Qq UTF8 .
                   5981: Otherwise, only ASCII characters are written and non-ASCII characters
                   5982: are replaced with underscores
                   5983: .Pq Ql _ .
                   5984: For input,
                   5985: .Nm
                   5986: always runs with a UTF-8 locale.
                   5987: If en_US.UTF-8 is provided by the operating system it is used and
                   5988: .Ev LC_CTYPE
                   5989: is ignored for input.
                   5990: Otherwise,
                   5991: .Ev LC_CTYPE
                   5992: tells
                   5993: .Nm
                   5994: what the UTF-8 locale is called on the current system.
                   5995: If the locale specified by
                   5996: .Ev LC_CTYPE
                   5997: is not available or is not a UTF-8 locale,
                   5998: .Nm
                   5999: exits with an error message.
                   6000: .It Ev LC_TIME
                   6001: The date and time format
                   6002: .Xr locale 1 .
                   6003: It is used for locale-dependent
                   6004: .Xr strftime 3
                   6005: format specifiers.
                   6006: .It Ev PWD
                   6007: The current working directory to be set in the global environment.
                   6008: This may be useful if it contains symbolic links.
                   6009: If the value of the variable does not match the current working
                   6010: directory, the variable is ignored and the result of
                   6011: .Xr getcwd 3
                   6012: is used instead.
                   6013: .It Ev SHELL
                   6014: The absolute path to the default shell for new windows.
                   6015: See the
                   6016: .Ic default-shell
                   6017: option for details.
                   6018: .It Ev TMUX_TMPDIR
                   6019: The parent directory of the directory containing the server sockets.
                   6020: See the
                   6021: .Fl L
                   6022: option for details.
                   6023: .It Ev VISUAL
                   6024: If the command specified in this variable contains the string
                   6025: .Ql vi ,
                   6026: use vi-style key bindings.
                   6027: Overridden by the
                   6028: .Ic mode-keys
                   6029: and
                   6030: .Ic status-keys
                   6031: options.
1.1       nicm     6032: .El
                   6033: .Sh FILES
1.26      nicm     6034: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1       nicm     6035: .It Pa ~/.tmux.conf
1.6       jmc      6036: Default
1.1       nicm     6037: .Nm
1.6       jmc      6038: configuration file.
1.26      nicm     6039: .It Pa /etc/tmux.conf
                   6040: System-wide configuration file.
1.1       nicm     6041: .El
1.57      jmc      6042: .Sh EXAMPLES
                   6043: To create a new
                   6044: .Nm
                   6045: session running
                   6046: .Xr vi 1 :
                   6047: .Pp
                   6048: .Dl $ tmux new-session vi
                   6049: .Pp
                   6050: Most commands have a shorter form, known as an alias.
                   6051: For new-session, this is
                   6052: .Ic new :
                   6053: .Pp
                   6054: .Dl $ tmux new vi
                   6055: .Pp
                   6056: Alternatively, the shortest unambiguous form of a command is accepted.
                   6057: If there are several options, they are listed:
                   6058: .Bd -literal -offset indent
                   6059: $ tmux n
                   6060: ambiguous command: n, could be: new-session, new-window, next-window
                   6061: .Ed
                   6062: .Pp
                   6063: Within an active session, a new window may be created by typing
                   6064: .Ql C-b c
                   6065: (Ctrl
                   6066: followed by the
                   6067: .Ql b
                   6068: key
                   6069: followed by the
                   6070: .Ql c
                   6071: key).
                   6072: .Pp
                   6073: Windows may be navigated with:
                   6074: .Ql C-b 0
                   6075: (to select window 0),
                   6076: .Ql C-b 1
                   6077: (to select window 1), and so on;
                   6078: .Ql C-b n
                   6079: to select the next window; and
                   6080: .Ql C-b p
                   6081: to select the previous window.
                   6082: .Pp
                   6083: A session may be detached using
                   6084: .Ql C-b d
1.64      nicm     6085: (or by an external event such as
                   6086: .Xr ssh 1
                   6087: disconnection) and reattached with:
1.57      jmc      6088: .Pp
                   6089: .Dl $ tmux attach-session
                   6090: .Pp
                   6091: Typing
                   6092: .Ql C-b \&?
                   6093: lists the current key bindings in the current window; up and down may be used
                   6094: to navigate the list or
                   6095: .Ql q
                   6096: to exit from it.
                   6097: .Pp
                   6098: Commands to be run when the
                   6099: .Nm
                   6100: server is started may be placed in the
                   6101: .Pa ~/.tmux.conf
                   6102: configuration file.
                   6103: Common examples include:
                   6104: .Pp
                   6105: Changing the default prefix key:
                   6106: .Bd -literal -offset indent
                   6107: set-option -g prefix C-a
                   6108: unbind-key C-b
                   6109: bind-key C-a send-prefix
                   6110: .Ed
                   6111: .Pp
                   6112: Turning the status line off, or changing its colour:
                   6113: .Bd -literal -offset indent
                   6114: set-option -g status off
1.378     nicm     6115: set-option -g status-style bg=blue
1.57      jmc      6116: .Ed
                   6117: .Pp
                   6118: Setting other options, such as the default command,
                   6119: or locking after 30 minutes of inactivity:
                   6120: .Bd -literal -offset indent
                   6121: set-option -g default-command "exec /bin/ksh"
                   6122: set-option -g lock-after-time 1800
                   6123: .Ed
                   6124: .Pp
                   6125: Creating new key bindings:
                   6126: .Bd -literal -offset indent
                   6127: bind-key b set-option status
                   6128: bind-key / command-prompt "split-window 'exec man %%'"
1.73      nicm     6129: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57      jmc      6130: .Ed
1.1       nicm     6131: .Sh SEE ALSO
                   6132: .Xr pty 4
                   6133: .Sh AUTHORS
1.477     nicm     6134: .An Nicholas Marriott Aq Mt nicholas.marriott@gmail.com