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

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