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

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