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

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