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

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