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

1.324   ! nicm        1: .\" $OpenBSD: tmux.1,v 1.323 2013/03/22 10:32:36 nicm Exp $
1.1       nicm        2: .\"
                      3: .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
                      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.324   ! nicm       17: .Dd $Mdocdate: March 22 2013 $
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.114     nicm       26: .Op Fl 28lquv
1.91      nicm       27: .Op Fl c Ar shell-command
1.1       nicm       28: .Op Fl f Ar file
                     29: .Op Fl L Ar socket-name
                     30: .Op Fl S Ar socket-path
                     31: .Op Ar command Op Ar flags
                     32: .Ek
                     33: .Sh DESCRIPTION
                     34: .Nm
1.59      jmc        35: is a terminal multiplexer:
                     36: it enables a number of terminals to be created, accessed, and
                     37: controlled from a single screen.
1.67      jmc        38: .Nm
                     39: may be detached from a screen
                     40: and continue running in the background,
                     41: then later reattached.
1.1       nicm       42: .Pp
1.60      nicm       43: When
                     44: .Nm
                     45: is started it creates a new
                     46: .Em session
                     47: with a single
                     48: .Em window
                     49: and displays it on screen.
                     50: A status line at the bottom of the screen
                     51: shows information on the current session
                     52: and is used to enter interactive commands.
                     53: .Pp
                     54: A session is a single collection of
                     55: .Em pseudo terminals
                     56: under the management of
                     57: .Nm .
                     58: Each session has one or more
                     59: windows linked to it.
                     60: A window occupies the entire screen
                     61: and may be split into rectangular panes,
                     62: each of which is a separate pseudo terminal
                     63: (the
                     64: .Xr pty 4
                     65: manual page documents the technical details of pseudo terminals).
                     66: Any number of
                     67: .Nm
                     68: instances may connect to the same session,
                     69: and any number of windows may be present in the same session.
                     70: Once all sessions are killed,
                     71: .Nm
                     72: exits.
                     73: .Pp
1.64      nicm       74: Each session is persistent and will survive accidental disconnection
1.66      jmc        75: (such as
1.64      nicm       76: .Xr ssh 1
1.67      jmc        77: connection timeout) or intentional detaching (with the
1.64      nicm       78: .Ql C-b d
                     79: key strokes).
                     80: .Nm
                     81: may be reattached using:
                     82: .Pp
                     83: .Dl $ tmux attach
1.60      nicm       84: .Pp
1.64      nicm       85: In
                     86: .Nm ,
                     87: a session is displayed on screen by a
                     88: .Em client
                     89: and all sessions are managed by a single
                     90: .Em server .
                     91: The server and each client are separate processes which communicate through a
                     92: socket in
                     93: .Pa /tmp .
1.65      nicm       94: .Pp
1.1       nicm       95: The options are as follows:
                     96: .Bl -tag -width "XXXXXXXXXXXX"
                     97: .It Fl 2
                     98: Force
                     99: .Nm
                    100: to assume the terminal supports 256 colours.
                    101: .It Fl 8
                    102: Like
                    103: .Fl 2 ,
1.6       jmc       104: but indicates that the terminal supports 88 colours.
1.91      nicm      105: .It Fl c Ar shell-command
                    106: Execute
                    107: .Ar shell-command
                    108: using the default shell.
                    109: If necessary, the
                    110: .Nm
                    111: server will be started to retrieve the
                    112: .Ic default-shell
                    113: option.
1.153     nicm      114: This option is for compatibility with
                    115: .Xr sh 1
                    116: when
                    117: .Nm
                    118: is used as a login shell.
1.1       nicm      119: .It Fl f Ar file
                    120: Specify an alternative configuration file.
                    121: By default,
                    122: .Nm
1.26      nicm      123: loads the system configuration file from
                    124: .Pa /etc/tmux.conf ,
                    125: if present, then looks for a user configuration file at
1.1       nicm      126: .Pa ~/.tmux.conf .
1.306     nicm      127: .Pp
1.1       nicm      128: The configuration file is a set of
                    129: .Nm
                    130: commands which are executed in sequence when the server is first started.
1.306     nicm      131: .Nm
                    132: loads configuration files once when the server process has started.
                    133: The
                    134: .Ic source-file
                    135: command may be used to load a file later.
1.61      nicm      136: .Pp
                    137: .Nm
1.306     nicm      138: shows any error messages from commands in configuration files in the first
                    139: session created, and continues to process the rest of the configuration file.
1.1       nicm      140: .It Fl L Ar socket-name
                    141: .Nm
                    142: stores the server socket in a directory under
1.208     nicm      143: .Pa /tmp
                    144: (or
                    145: .Ev TMPDIR
                    146: if set);
1.1       nicm      147: the default socket is named
                    148: .Em default .
                    149: This option allows a different socket name to be specified, allowing several
                    150: independent
                    151: .Nm
                    152: servers to be run.
                    153: Unlike
                    154: .Fl S
                    155: a full path is not necessary: the sockets are all created in the same
                    156: directory.
1.2       nicm      157: .Pp
                    158: If the socket is accidentally removed, the
1.6       jmc       159: .Dv SIGUSR1
1.2       nicm      160: signal may be sent to the
                    161: .Nm
                    162: server process to recreate it.
1.166     sobrado   163: .It Fl l
                    164: Behave as a login shell.
                    165: This flag currently has no effect and is for compatibility with other shells
                    166: when using tmux as a login shell.
1.4       sobrado   167: .It Fl q
1.133     nicm      168: Set the
                    169: .Ic quiet
                    170: server option to prevent the server sending various informational messages.
1.1       nicm      171: .It Fl S Ar socket-path
                    172: Specify a full alternative path to the server socket.
                    173: If
                    174: .Fl S
                    175: is specified, the default socket directory is not used and any
                    176: .Fl L
                    177: flag is ignored.
                    178: .It Fl u
                    179: .Nm
1.14      nicm      180: attempts to guess if the terminal is likely to support UTF-8 by checking the
                    181: first of the
                    182: .Ev LC_ALL ,
                    183: .Ev LC_CTYPE
                    184: and
1.2       nicm      185: .Ev LANG
1.14      nicm      186: environment variables to be set for the string "UTF-8".
1.5       nicm      187: This is not always correct: the
1.2       nicm      188: .Fl u
                    189: flag explicitly informs
                    190: .Nm
1.6       jmc       191: that UTF-8 is supported.
1.33      nicm      192: .Pp
                    193: If the server is started from a client passed
                    194: .Fl u
                    195: or where UTF-8 is detected, the
                    196: .Ic utf8
                    197: and
                    198: .Ic status-utf8
                    199: options are enabled in the global window and session options respectively.
1.1       nicm      200: .It Fl v
                    201: Request verbose logging.
                    202: This option may be specified multiple times for increasing verbosity.
                    203: Log messages will be saved into
                    204: .Pa tmux-client-PID.log
                    205: and
                    206: .Pa tmux-server-PID.log
                    207: files in the current directory, where
                    208: .Em PID
1.6       jmc       209: is the PID of the server or client process.
1.1       nicm      210: .It Ar command Op Ar flags
                    211: This specifies one of a set of commands used to control
                    212: .Nm ,
1.6       jmc       213: as described in the following sections.
1.59      jmc       214: If no commands are specified, the
1.1       nicm      215: .Ic new-session
                    216: command is assumed.
1.57      jmc       217: .El
1.64      nicm      218: .Sh KEY BINDINGS
                    219: .Nm
                    220: may be controlled from an attached client by using a key combination of a
                    221: prefix key,
                    222: .Ql C-b
                    223: (Ctrl-b) by default, followed by a command key.
                    224: .Pp
1.172     nicm      225: The default command key bindings are:
1.64      nicm      226: .Pp
1.171     nicm      227: .Bl -tag -width "XXXXXXXXXX" -offset indent -compact
                    228: .It C-b
                    229: Send the prefix key (C-b) through to the application.
                    230: .It C-o
                    231: Rotate the panes in the current window forwards.
                    232: .It C-z
                    233: Suspend the
                    234: .Nm
                    235: client.
                    236: .It !
                    237: Break the current pane out of the window.
                    238: .It \&"
                    239: Split the current pane into two, top and bottom.
                    240: .It #
                    241: List all paste buffers.
1.236     nicm      242: .It $
                    243: Rename the current session.
1.171     nicm      244: .It %
                    245: Split the current pane into two, left and right.
                    246: .It &
                    247: Kill the current window.
                    248: .It '
                    249: Prompt for a window index to select.
                    250: .It ,
                    251: Rename the current window.
                    252: .It -
                    253: Delete the most recently copied buffer of text.
                    254: .It .
                    255: Prompt for an index to move the current window.
                    256: .It 0 to 9
                    257: Select windows 0 to 9.
                    258: .It :
                    259: Enter the
                    260: .Nm
                    261: command prompt.
1.187     nicm      262: .It ;
                    263: Move to the previously active pane.
1.178     nicm      264: .It =
                    265: Choose which buffer to paste interactively from a list.
1.171     nicm      266: .It \&?
                    267: List all key bindings.
                    268: .It D
                    269: Choose a client to detach.
1.182     jmc       270: .It \&[
1.171     nicm      271: Enter copy mode to copy text or view the history.
1.182     jmc       272: .It \&]
1.171     nicm      273: Paste the most recently copied buffer of text.
1.64      nicm      274: .It c
1.65      nicm      275: Create a new window.
1.64      nicm      276: .It d
1.65      nicm      277: Detach the current client.
1.171     nicm      278: .It f
                    279: Prompt to search for text in open windows.
                    280: .It i
                    281: Display some information about the current window.
1.64      nicm      282: .It l
1.65      nicm      283: Move to the previously selected window.
1.64      nicm      284: .It n
1.65      nicm      285: Change to the next window.
1.171     nicm      286: .It o
                    287: Select the next pane in the current window.
1.64      nicm      288: .It p
1.65      nicm      289: Change to the previous window.
1.171     nicm      290: .It q
                    291: Briefly display pane indexes.
                    292: .It r
                    293: Force redraw of the attached client.
                    294: .It s
                    295: Select a new session for the attached client interactively.
1.194     nicm      296: .It L
                    297: Switch the attached client back to the last session.
1.171     nicm      298: .It t
                    299: Show the time.
                    300: .It w
                    301: Choose the current window interactively.
                    302: .It x
                    303: Kill the current pane.
                    304: .It {
                    305: Swap the current pane with the previous pane.
                    306: .It }
                    307: Swap the current pane with the next pane.
                    308: .It ~
                    309: Show previous messages from
                    310: .Nm ,
                    311: if any.
                    312: .It Page Up
                    313: Enter copy mode and scroll one page up.
                    314: .It Up, Down
                    315: .It Left, Right
                    316: Change to the pane above, below, to the left, or to the right of the current
                    317: pane.
                    318: .It M-1 to M-5
                    319: Arrange panes in one of the five preset layouts: even-horizontal,
                    320: even-vertical, main-horizontal, main-vertical, or tiled.
                    321: .It M-n
                    322: Move to the next window with a bell or activity marker.
                    323: .It M-o
                    324: Rotate the panes in the current window backwards.
                    325: .It M-p
                    326: Move to the previous window with a bell or activity marker.
                    327: .It C-Up, C-Down
                    328: .It C-Left, C-Right
                    329: Resize the current pane in steps of one cell.
                    330: .It M-Up, M-Down
                    331: .It M-Left, M-Right
                    332: Resize the current pane in steps of five cells.
1.64      nicm      333: .El
                    334: .Pp
                    335: Key bindings may be changed with the
                    336: .Ic bind-key
                    337: and
                    338: .Ic unbind-key
                    339: commands.
1.57      jmc       340: .Sh COMMANDS
                    341: This section contains a list of the commands supported by
                    342: .Nm .
                    343: Most commands accept the optional
                    344: .Fl t
                    345: argument with one of
                    346: .Ar target-client ,
                    347: .Ar target-session
                    348: .Ar target-window ,
                    349: or
                    350: .Ar target-pane .
                    351: These specify the client, session, window or pane which a command should affect.
                    352: .Ar target-client
                    353: is the name of the
                    354: .Xr pty 4
                    355: file to which the client is connected, for example either of
                    356: .Pa /dev/ttyp1
                    357: or
                    358: .Pa ttyp1
                    359: for the client attached to
                    360: .Pa /dev/ttyp1 .
                    361: If no client is specified, the current client is chosen, if possible, or an
                    362: error is reported.
                    363: Clients may be listed with the
                    364: .Ic list-clients
                    365: command.
1.1       nicm      366: .Pp
1.57      jmc       367: .Ar target-session
                    368: is either the name of a session (as listed by the
                    369: .Ic list-sessions
                    370: command) or the name of a client with the same syntax as
                    371: .Ar target-client ,
                    372: in which case the session attached to the client is used.
                    373: When looking for the session name,
                    374: .Nm
                    375: initially searches for an exact match; if none is found, the session names
                    376: are checked for any for which
                    377: .Ar target-session
                    378: is a prefix or for which it matches as an
                    379: .Xr fnmatch 3
                    380: pattern.
                    381: If a single match is found, it is used as the target session; multiple matches
                    382: produce an error.
                    383: If a session is omitted, the current session is used if available; if no
1.117     nicm      384: current session is available, the most recently used is chosen.
1.1       nicm      385: .Pp
1.57      jmc       386: .Ar target-window
                    387: specifies a window in the form
                    388: .Em session Ns \&: Ns Em window .
                    389: .Em session
                    390: follows the same rules as for
                    391: .Ar target-session ,
                    392: and
                    393: .Em window
1.270     nicm      394: is looked for in order: as a window index, for example mysession:1;
1.271     jmc       395: as a window ID, such as @1;
1.270     nicm      396: as an exact window name, such as mysession:mywindow; then as an
1.57      jmc       397: .Xr fnmatch 3
                    398: pattern or the start of a window name, such as mysession:mywin* or
                    399: mysession:mywin.
                    400: An empty window name specifies the next unused index if appropriate (for
                    401: example the
                    402: .Ic new-window
                    403: and
                    404: .Ic link-window
                    405: commands)
                    406: otherwise the current window in
                    407: .Em session
                    408: is chosen.
1.140     nicm      409: The special character
                    410: .Ql \&!
1.311     nicm      411: uses the last (previously current) window,
                    412: .Ql ^
                    413: selects the highest numbered window,
                    414: .Ql $
                    415: selects the lowest numbered window, and
1.140     nicm      416: .Ql +
                    417: and
                    418: .Ql -
1.311     nicm      419: select the next window or the previous window by number.
1.57      jmc       420: When the argument does not contain a colon,
                    421: .Nm
                    422: first attempts to parse it as window; if that fails, an attempt is made to
                    423: match a session.
1.1       nicm      424: .Pp
1.57      jmc       425: .Ar target-pane
                    426: takes a similar form to
                    427: .Ar target-window
                    428: but with the optional addition of a period followed by a pane index, for
                    429: example: mysession:mywindow.1.
                    430: If the pane index is omitted, the currently active pane in the specified
                    431: window is used.
                    432: If neither a colon nor period appears,
1.13      nicm      433: .Nm
1.57      jmc       434: first attempts to use the argument as a pane index; if that fails, it is looked
                    435: up as for
                    436: .Ar target-window .
1.156     nicm      437: A
                    438: .Ql +
                    439: or
                    440: .Ql -
                    441: indicate the next or previous pane index, respectively.
1.132     nicm      442: One of the strings
                    443: .Em top ,
                    444: .Em bottom ,
                    445: .Em left ,
                    446: .Em right ,
                    447: .Em top-left ,
                    448: .Em top-right ,
1.216     nicm      449: .Em bottom-left
                    450: or
1.132     nicm      451: .Em bottom-right
                    452: may be used instead of a pane index.
1.177     nicm      453: .Pp
                    454: The special characters
                    455: .Ql +
                    456: and
                    457: .Ql -
                    458: may be followed by an offset, for example:
                    459: .Bd -literal -offset indent
                    460: select-window -t:+2
                    461: .Ed
                    462: .Pp
                    463: When dealing with a session that doesn't contain sequential window indexes,
                    464: they will be correctly skipped.
1.212     nicm      465: .Pp
                    466: .Nm
                    467: also gives each pane created in a server an identifier consisting of a
                    468: .Ql %
                    469: and a number, starting from zero.
                    470: A pane's identifier is unique for the life of the
                    471: .Nm
                    472: server and is passed to the child process of the pane in the
                    473: .Ev TMUX_PANE
                    474: environment variable.
                    475: It may be used alone to target a pane or the window containing it.
1.15      jmc       476: .Pp
1.153     nicm      477: .Ar shell-command
                    478: arguments are
                    479: .Xr sh 1
                    480: commands.
                    481: These must be passed as a single item, which typically means quoting them, for
                    482: example:
                    483: .Bd -literal -offset indent
                    484: new-window 'vi /etc/passwd'
                    485: .Ed
                    486: .Pp
                    487: .Ar command
                    488: .Op Ar arguments
                    489: refers to a
                    490: .Nm
                    491: command, passed with the command and arguments separately, for example:
                    492: .Bd -literal -offset indent
                    493: bind-key F1 set-window-option force-width 81
                    494: .Ed
                    495: .Pp
                    496: Or if using
                    497: .Xr sh 1 :
                    498: .Bd -literal -offset indent
                    499: $ tmux bind-key F1 set-window-option force-width 81
                    500: .Ed
                    501: .Pp
1.57      jmc       502: Multiple commands may be specified together as part of a
                    503: .Em command sequence .
                    504: Each command should be separated by spaces and a semicolon;
1.244     nicm      505: commands are executed sequentially from left to right and
1.293     nicm      506: lines ending with a backslash continue on to the next line,
                    507: except when escaped by another backslash.
1.57      jmc       508: A literal semicolon may be included by escaping it with a backslash (for
                    509: example, when specifying a command sequence to
                    510: .Ic bind-key ) .
1.13      nicm      511: .Pp
1.153     nicm      512: Example
                    513: .Nm
                    514: commands include:
1.13      nicm      515: .Bd -literal -offset indent
1.57      jmc       516: refresh-client -t/dev/ttyp2
                    517:
                    518: rename-session -tfirst newname
                    519:
                    520: set-window-option -t:0 monitor-activity on
                    521:
                    522: new-window ; split-window -d
1.244     nicm      523:
                    524: bind-key R source-file ~/.tmux.conf \e; \e
                    525:        display-message "source-file done"
1.13      nicm      526: .Ed
1.153     nicm      527: .Pp
                    528: Or from
                    529: .Xr sh 1 :
                    530: .Bd -literal -offset indent
                    531: $ tmux kill-window -t :1
                    532:
1.159     jmc       533: $ tmux new-window \e; split-window -d
1.153     nicm      534:
1.159     jmc       535: $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
1.153     nicm      536: .Ed
1.57      jmc       537: .Sh CLIENTS AND SESSIONS
1.153     nicm      538: The
                    539: .Nm
                    540: server manages clients, sessions, windows and panes.
                    541: Clients are attached to sessions to interact with them, either
                    542: when they are created with the
                    543: .Ic new-session
                    544: command, or later with the
                    545: .Ic attach-session
                    546: command.
1.188     nicm      547: Each session has one or more windows
1.153     nicm      548: .Em linked
                    549: into it.
                    550: Windows may be linked to multiple sessions and are made up of one or
                    551: more panes,
                    552: each of which contains a pseudo terminal.
                    553: Commands for creating, linking and otherwise manipulating windows
                    554: are covered
                    555: in the
                    556: .Sx WINDOWS AND PANES
                    557: section.
                    558: .Pp
                    559: The following commands are available to manage clients and sessions:
1.57      jmc       560: .Bl -tag -width Ds
                    561: .It Xo Ic attach-session
1.148     nicm      562: .Op Fl dr
1.57      jmc       563: .Op Fl t Ar target-session
                    564: .Xc
                    565: .D1 (alias: Ic attach )
                    566: If run from outside
                    567: .Nm ,
                    568: create a new client in the current terminal and attach it to
                    569: .Ar target-session .
                    570: If used from inside, switch the current client.
                    571: If
                    572: .Fl d
                    573: is specified, any other clients attached to the session are detached.
1.148     nicm      574: .Fl r
                    575: signifies the client is read-only (only keys bound to the
                    576: .Ic detach-client
1.242     nicm      577: or
                    578: .Ic switch-client
                    579: commands have any effect)
1.13      nicm      580: .Pp
1.57      jmc       581: If no server is started,
                    582: .Ic attach-session
                    583: will attempt to start it; this will fail unless sessions are created in the
                    584: configuration file.
1.217     nicm      585: .Pp
                    586: The
                    587: .Ar target-session
                    588: rules for
                    589: .Ic attach-session
                    590: are slightly adjusted: if
                    591: .Nm
                    592: needs to select the most recently used session, it will prefer the most
                    593: recently used
                    594: .Em unattached
                    595: session.
1.211     nicm      596: .It Xo Ic detach-client
                    597: .Op Fl P
1.296     nicm      598: .Op Fl a
1.219     nicm      599: .Op Fl s Ar target-session
1.211     nicm      600: .Op Fl t Ar target-client
                    601: .Xc
1.57      jmc       602: .D1 (alias: Ic detach )
1.218     nicm      603: Detach the current client if bound to a key, the client specified with
                    604: .Fl t ,
1.258     jmc       605: or all clients currently attached to the session specified by
1.218     nicm      606: .Fl s .
1.296     nicm      607: The
                    608: .Fl a
                    609: option kills all but the client given with
                    610: .Fl t .
1.211     nicm      611: If
                    612: .Fl P
                    613: is given, send SIGHUP to the parent process of the client, typically causing it
                    614: to exit.
1.57      jmc       615: .It Ic has-session Op Fl t Ar target-session
                    616: .D1 (alias: Ic has )
                    617: Report an error and exit with 1 if the specified session does not exist.
                    618: If it does exist, exit with 0.
                    619: .It Ic kill-server
                    620: Kill the
1.1       nicm      621: .Nm
1.57      jmc       622: server and clients and destroy all sessions.
1.297     nicm      623: .It Ic kill-session
                    624: .Op Fl a
                    625: .Op Fl t Ar target-session
1.57      jmc       626: Destroy the given session, closing any windows linked to it and no other
                    627: sessions, and detaching all clients attached to it.
1.297     nicm      628: If
                    629: .Fl a
                    630: is given, all sessions but the specified one is killed.
1.250     nicm      631: .It Xo Ic list-clients
                    632: .Op Fl F Ar format
                    633: .Op Fl t Ar target-session
                    634: .Xc
1.57      jmc       635: .D1 (alias: Ic lsc )
1.221     jmc       636: List all clients attached to the server.
1.250     nicm      637: For the meaning of the
                    638: .Fl F
                    639: flag, see the
1.252     jmc       640: .Sx FORMATS
                    641: section.
1.221     jmc       642: If
1.220     nicm      643: .Ar target-session
                    644: is specified, list only clients connected to that session.
1.57      jmc       645: .It Ic list-commands
                    646: .D1 (alias: Ic lscm )
                    647: List the syntax of all commands supported by
                    648: .Nm .
1.247     nicm      649: .It Ic list-sessions Op Fl F Ar format
1.57      jmc       650: .D1 (alias: Ic ls )
                    651: List all sessions managed by the server.
1.247     nicm      652: For the meaning of the
                    653: .Fl F
                    654: flag, see the
                    655: .Sx FORMATS
                    656: section.
1.175     nicm      657: .It Ic lock-client Op Fl t Ar target-client
                    658: .D1 (alias: Ic lockc )
1.92      nicm      659: Lock
                    660: .Ar target-client ,
                    661: see the
                    662: .Ic lock-server
                    663: command.
1.175     nicm      664: .It Ic lock-session Op Fl t Ar target-session
                    665: .D1 (alias: Ic locks )
1.92      nicm      666: Lock all clients attached to
                    667: .Ar target-session .
1.57      jmc       668: .It Xo Ic new-session
                    669: .Op Fl d
                    670: .Op Fl n Ar window-name
                    671: .Op Fl s Ar session-name
1.101     nicm      672: .Op Fl t Ar target-session
1.210     nicm      673: .Op Fl x Ar width
                    674: .Op Fl y Ar height
1.153     nicm      675: .Op Ar shell-command
1.57      jmc       676: .Xc
                    677: .D1 (alias: Ic new )
                    678: Create a new session with name
                    679: .Ar session-name .
1.153     nicm      680: .Pp
1.57      jmc       681: The new session is attached to the current terminal unless
                    682: .Fl d
                    683: is given.
                    684: .Ar window-name
1.1       nicm      685: and
1.153     nicm      686: .Ar shell-command
                    687: are the name of and shell command to execute in the initial window.
1.210     nicm      688: If
                    689: .Fl d
                    690: is used,
                    691: .Fl x
                    692: and
                    693: .Fl y
                    694: specify the size of the initial window (80 by 24 if not given).
1.68      nicm      695: .Pp
                    696: If run from a terminal, any
                    697: .Xr termios 4
                    698: special characters are saved and used for new windows in the new session.
1.101     nicm      699: .Pp
                    700: If
                    701: .Fl t
                    702: is given, the new session is
                    703: .Em grouped
                    704: with
                    705: .Ar target-session .
                    706: This means they share the same set of windows - all windows from
                    707: .Ar target-session
                    708: are linked to the new session and any subsequent new windows or windows being
                    709: closed are applied to both sessions.
                    710: The current and previous window and any session options remain independent and
                    711: either session may be killed without affecting the other.
                    712: Giving
                    713: .Fl n
                    714: or
1.153     nicm      715: .Ar shell-command
1.101     nicm      716: are invalid if
                    717: .Fl t
                    718: is used.
1.248     nicm      719: .It Xo Ic refresh-client
                    720: .Op Fl S
                    721: .Op Fl t Ar target-client
                    722: .Xc
1.57      jmc       723: .D1 (alias: Ic refresh )
                    724: Refresh the current client if bound to a key, or a single client if one is given
                    725: with
                    726: .Fl t .
1.248     nicm      727: If
                    728: .Fl S
                    729: is specified, only update the client's status bar.
1.57      jmc       730: .It Xo Ic rename-session
                    731: .Op Fl t Ar target-session
                    732: .Ar new-name
                    733: .Xc
                    734: .D1 (alias: Ic rename )
                    735: Rename the session to
                    736: .Ar new-name .
1.121     nicm      737: .It Xo Ic show-messages
1.120     nicm      738: .Op Fl t Ar target-client
                    739: .Xc
                    740: .D1 (alias: Ic showmsgs )
                    741: Any messages displayed on the status line are saved in a per-client message
                    742: log, up to a maximum of the limit set by the
                    743: .Ar message-limit
                    744: session option for the session attached to that client.
                    745: This command displays the log for
                    746: .Ar target-client .
1.57      jmc       747: .It Ic source-file Ar path
                    748: .D1 (alias: Ic source )
                    749: Execute commands from
                    750: .Ar path .
                    751: .It Ic start-server
                    752: .D1 (alias: Ic start )
                    753: Start the
1.1       nicm      754: .Nm
1.57      jmc       755: server, if not already running, without creating any sessions.
                    756: .It Xo Ic suspend-client
1.202     nicm      757: .Op Fl t Ar target-client
1.57      jmc       758: .Xc
                    759: .D1 (alias: Ic suspendc )
                    760: Suspend a client by sending
                    761: .Dv SIGTSTP
                    762: (tty stop).
                    763: .It Xo Ic switch-client
1.242     nicm      764: .Op Fl lnpr
1.57      jmc       765: .Op Fl c Ar target-client
                    766: .Op Fl t Ar target-session
                    767: .Xc
                    768: .D1 (alias: Ic switchc )
                    769: Switch the current session for client
                    770: .Ar target-client
                    771: to
                    772: .Ar target-session .
1.183     nicm      773: If
1.197     jmc       774: .Fl l ,
1.183     nicm      775: .Fl n
                    776: or
                    777: .Fl p
1.194     nicm      778: is used, the client is moved to the last, next or previous session
                    779: respectively.
1.242     nicm      780: .Fl r
                    781: toggles whether a client is read-only (see the
                    782: .Ic attach-session
                    783: command).
1.57      jmc       784: .El
                    785: .Sh WINDOWS AND PANES
1.1       nicm      786: A
                    787: .Nm
                    788: window may be in one of several modes.
                    789: The default permits direct access to the terminal attached to the window.
1.164     nicm      790: The other is copy mode, which permits a section of a window or its
                    791: history to be copied to a
1.1       nicm      792: .Em paste buffer
                    793: for later insertion into another window.
                    794: This mode is entered with the
                    795: .Ic copy-mode
                    796: command, bound to
1.113     nicm      797: .Ql \&[
1.1       nicm      798: by default.
1.164     nicm      799: It is also entered when a command that produces output, such as
                    800: .Ic list-keys ,
                    801: is executed from a key binding.
1.1       nicm      802: .Pp
1.6       jmc       803: The keys available depend on whether emacs or vi mode is selected
                    804: (see the
1.1       nicm      805: .Ic mode-keys
                    806: option).
                    807: The following keys are supported as appropriate for the mode:
1.157     nicm      808: .Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
1.1       nicm      809: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
1.27      nicm      810: .It Li "Back to indentation" Ta "^" Ta "M-m"
1.142     nicm      811: .It Li "Bottom of history" Ta "G" Ta "M-<"
1.1       nicm      812: .It Li "Clear selection" Ta "Escape" Ta "C-g"
                    813: .It Li "Copy selection" Ta "Enter" Ta "M-w"
                    814: .It Li "Cursor down" Ta "j" Ta "Down"
1.70      nicm      815: .It Li "Cursor left" Ta "h" Ta "Left"
                    816: .It Li "Cursor right" Ta "l" Ta "Right"
1.116     nicm      817: .It Li "Cursor to bottom line" Ta "L" Ta ""
                    818: .It Li "Cursor to middle line" Ta "M" Ta "M-r"
                    819: .It Li "Cursor to top line" Ta "H" Ta "M-R"
1.70      nicm      820: .It Li "Cursor up" Ta "k" Ta "Up"
1.71      nicm      821: .It Li "Delete entire line" Ta "d" Ta "C-u"
1.227     nicm      822: .It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
1.1       nicm      823: .It Li "End of line" Ta "$" Ta "C-e"
1.142     nicm      824: .It Li "Go to line" Ta ":" Ta "g"
1.116     nicm      825: .It Li "Half page down" Ta "C-d" Ta "M-Down"
                    826: .It Li "Half page up" Ta "C-u" Ta "M-Up"
1.157     nicm      827: .It Li "Jump forward" Ta "f" Ta "f"
1.256     nicm      828: .It Li "Jump to forward" Ta "t" Ta ""
1.157     nicm      829: .It Li "Jump backward" Ta "F" Ta "F"
1.256     nicm      830: .It Li "Jump to backward" Ta "T" Ta ""
1.157     nicm      831: .It Li "Jump again" Ta ";" Ta ";"
                    832: .It Li "Jump again in reverse" Ta "," Ta ","
1.1       nicm      833: .It Li "Next page" Ta "C-f" Ta "Page down"
1.146     nicm      834: .It Li "Next space" Ta "W" Ta ""
                    835: .It Li "Next space, end of word" Ta "E" Ta ""
1.143     nicm      836: .It Li "Next word" Ta "w" Ta ""
                    837: .It Li "Next word end" Ta "e" Ta "M-f"
1.70      nicm      838: .It Li "Paste buffer" Ta "p" Ta "C-y"
1.116     nicm      839: .It Li "Previous page" Ta "C-b" Ta "Page up"
1.1       nicm      840: .It Li "Previous word" Ta "b" Ta "M-b"
1.146     nicm      841: .It Li "Previous space" Ta "B" Ta ""
1.1       nicm      842: .It Li "Quit mode" Ta "q" Ta "Escape"
1.147     nicm      843: .It Li "Rectangle toggle" Ta "v" Ta "R"
1.141     nicm      844: .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
                    845: .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
1.70      nicm      846: .It Li "Search again" Ta "n" Ta "n"
1.152     nicm      847: .It Li "Search again in reverse" Ta "N" Ta "N"
1.70      nicm      848: .It Li "Search backward" Ta "?" Ta "C-r"
                    849: .It Li "Search forward" Ta "/" Ta "C-s"
                    850: .It Li "Start of line" Ta "0" Ta "C-a"
1.1       nicm      851: .It Li "Start selection" Ta "Space" Ta "C-Space"
1.142     nicm      852: .It Li "Top of history" Ta "g" Ta "M->"
1.80      nicm      853: .It Li "Transpose chars" Ta "" Ta "C-t"
1.1       nicm      854: .El
1.146     nicm      855: .Pp
                    856: The next and previous word keys use space and the
                    857: .Ql - ,
1.154     nicm      858: .Ql _
1.146     nicm      859: and
                    860: .Ql @
1.154     nicm      861: characters as word delimiters by default, but this can be adjusted by
                    862: setting the
                    863: .Em word-separators
1.255     nicm      864: session option.
1.146     nicm      865: Next word moves to the start of the next word, next word end to the end of the
                    866: next word and previous word to the start of the previous word.
                    867: The three next and previous space keys work similarly but use a space alone as
                    868: the word separator.
1.157     nicm      869: .Pp
                    870: The jump commands enable quick movement within a line.
                    871: For instance, typing
                    872: .Ql f
                    873: followed by
                    874: .Ql /
                    875: will move the cursor to the next
                    876: .Ql /
                    877: character on the current line.
                    878: A
                    879: .Ql \&;
                    880: will then jump to the next occurrence.
1.1       nicm      881: .Pp
1.155     nicm      882: Commands in copy mode may be prefaced by an optional repeat count.
                    883: With vi key bindings, a prefix is entered using the number keys; with
                    884: emacs, the Alt (meta) key and a number begins prefix entry.
                    885: For example, to move the cursor forward by ten words, use
                    886: .Ql M-1 0 M-f
                    887: in emacs mode, and
                    888: .Ql 10w
                    889: in vi.
                    890: .Pp
1.254     nicm      891: When copying the selection, the repeat count indicates the buffer index to
                    892: replace, if used.
                    893: .Pp
1.155     nicm      894: Mode key bindings are defined in a set of named tables:
1.48      nicm      895: .Em vi-edit
                    896: and
                    897: .Em emacs-edit
                    898: for keys used when line editing at the command prompt;
                    899: .Em vi-choice
                    900: and
                    901: .Em emacs-choice
                    902: for keys used when choosing from lists (such as produced by the
1.144     nicm      903: .Ic choose-window
1.164     nicm      904: command); and
1.48      nicm      905: .Em vi-copy
                    906: and
                    907: .Em emacs-copy
1.97      nicm      908: used in copy mode.
1.48      nicm      909: The tables may be viewed with the
                    910: .Ic list-keys
1.49      nicm      911: command and keys modified or removed with
                    912: .Ic bind-key
                    913: and
                    914: .Ic unbind-key .
1.48      nicm      915: .Pp
1.2       nicm      916: The paste buffer key pastes the first line from the top paste buffer on the
                    917: stack.
1.57      jmc       918: .Pp
1.164     nicm      919: The synopsis for the
                    920: .Ic copy-mode
                    921: command is:
1.57      jmc       922: .Bl -tag -width Ds
                    923: .It Xo Ic copy-mode
                    924: .Op Fl u
1.72      nicm      925: .Op Fl t Ar target-pane
1.57      jmc       926: .Xc
                    927: Enter copy mode.
                    928: The
                    929: .Fl u
                    930: option scrolls one page up.
                    931: .El
1.18      nicm      932: .Pp
1.1       nicm      933: Each window displayed by
                    934: .Nm
                    935: may be split into one or more
                    936: .Em panes ;
                    937: each pane takes up a certain area of the display and is a separate terminal.
                    938: A window may be split into panes using the
                    939: .Ic split-window
                    940: command.
1.38      nicm      941: Windows may be split horizontally (with the
                    942: .Fl h
                    943: flag) or vertically.
                    944: Panes may be resized with the
                    945: .Ic resize-pane
1.1       nicm      946: command (bound to
1.38      nicm      947: .Ql C-up ,
                    948: .Ql C-down
                    949: .Ql C-left
                    950: and
                    951: .Ql C-right
1.1       nicm      952: by default), the current pane may be changed with the
1.156     nicm      953: .Ic select-pane
                    954: command and the
1.1       nicm      955: .Ic rotate-window
                    956: and
                    957: .Ic swap-pane
1.38      nicm      958: commands may be used to swap panes without changing their position.
                    959: Panes are numbered beginning from zero in the order they are created.
                    960: .Pp
                    961: A number of preset
                    962: .Em layouts
                    963: are available.
                    964: These may be selected with the
                    965: .Ic select-layout
                    966: command or cycled with
                    967: .Ic next-layout
                    968: (bound to
1.149     nicm      969: .Ql Space
1.131     nicm      970: by default); once a layout is chosen, panes within it may be moved and resized
                    971: as normal.
1.1       nicm      972: .Pp
                    973: The following layouts are supported:
                    974: .Bl -tag -width Ds
                    975: .It Ic even-horizontal
                    976: Panes are spread out evenly from left to right across the window.
                    977: .It Ic even-vertical
                    978: Panes are spread evenly from top to bottom.
1.2       nicm      979: .It Ic main-horizontal
1.131     nicm      980: A large (main) pane is shown at the top of the window and the remaining panes
                    981: are spread from left to right in the leftover space at the bottom.
1.2       nicm      982: Use the
                    983: .Em main-pane-height
                    984: window option to specify the height of the top pane.
1.1       nicm      985: .It Ic main-vertical
1.2       nicm      986: Similar to
                    987: .Ic main-horizontal
                    988: but the large pane is placed on the left and the others spread from top to
                    989: bottom along the right.
                    990: See the
                    991: .Em main-pane-width
                    992: window option.
1.165     nicm      993: .It Ic tiled
                    994: Panes are spread out as evenly as possible over the window in both rows and
                    995: columns.
1.1       nicm      996: .El
1.8       nicm      997: .Pp
1.181     nicm      998: In addition,
                    999: .Ic select-layout
                   1000: may be used to apply a previously used layout - the
                   1001: .Ic list-windows
                   1002: command displays the layout of each window in a form suitable for use with
                   1003: .Ic select-layout .
                   1004: For example:
                   1005: .Bd -literal -offset indent
                   1006: $ tmux list-windows
                   1007: 0: ksh [159x48]
                   1008:     layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
                   1009: $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
                   1010: .Ed
1.196     nicm     1011: .Pp
1.181     nicm     1012: .Nm
                   1013: automatically adjusts the size of the layout for the current window size.
                   1014: Note that a layout cannot be applied to a window with more panes than that
                   1015: from which the layout was originally defined.
                   1016: .Pp
1.57      jmc      1017: Commands related to windows and panes are as follows:
                   1018: .Bl -tag -width Ds
                   1019: .It Xo Ic break-pane
1.280     nicm     1020: .Op Fl dP
                   1021: .Op Fl F Ar format
1.57      jmc      1022: .Op Fl t Ar target-pane
                   1023: .Xc
                   1024: .D1 (alias: Ic breakp )
                   1025: Break
                   1026: .Ar target-pane
                   1027: off from its containing window to make it the only pane in a new window.
                   1028: If
                   1029: .Fl d
                   1030: is given, the new window does not become the current window.
1.280     nicm     1031: The
                   1032: .Fl P
                   1033: option prints information about the new window after it has been created.
                   1034: By default, it uses the format
                   1035: .Ql #{session_name}:#{window_index}
                   1036: but a different format may be specified with
                   1037: .Fl F .
1.128     nicm     1038: .It Xo Ic capture-pane
1.322     nicm     1039: .Op Fl p
1.128     nicm     1040: .Op Fl b Ar buffer-index
1.322     nicm     1041: .Op Fl c Ar target-client
1.213     nicm     1042: .Op Fl E Ar end-line
                   1043: .Op Fl S Ar start-line
1.128     nicm     1044: .Op Fl t Ar target-pane
                   1045: .Xc
                   1046: .D1 (alias: Ic capturep )
1.322     nicm     1047: Capture the contents of a pane.
                   1048: If
                   1049: .Fl p
                   1050: is given, the output goes to
                   1051: .Ar target-client
                   1052: stdout, otherwise to the buffer specified with
                   1053: .Fl b
                   1054: or a new buffer if omitted.
1.213     nicm     1055: .Pp
                   1056: .Fl S
                   1057: and
                   1058: .Fl E
                   1059: specify the starting and ending line numbers, zero is the first line of the
                   1060: visible pane and negative numbers are lines in the history.
                   1061: The default is to capture only the visible contents of the pane.
1.76      nicm     1062: .It Xo
                   1063: .Ic choose-client
1.294     nicm     1064: .Op Fl F Ar format
1.76      nicm     1065: .Op Fl t Ar target-window
                   1066: .Op Ar template
                   1067: .Xc
                   1068: Put a window into client choice mode, allowing a client to be selected
                   1069: interactively from a list.
                   1070: After a client is chosen,
                   1071: .Ql %%
                   1072: is replaced by the client
                   1073: .Xr pty 4
                   1074: path in
                   1075: .Ar template
                   1076: and the result executed as a command.
                   1077: If
                   1078: .Ar template
                   1079: is not given, "detach-client -t '%%'" is used.
1.294     nicm     1080: For the meaning of the
                   1081: .Fl F
                   1082: flag, see the
1.303     nicm     1083: .Sx FORMATS
                   1084: section.
1.314     nicm     1085: This command works only if at least one client is attached.
1.303     nicm     1086: .It Xo
                   1087: .Ic choose-list
                   1088: .Op Fl l Ar items
                   1089: .Op Fl t Ar target-window
                   1090: .Op Ar template
                   1091: .Xc
                   1092: Put a window into list choice mode, allowing
                   1093: .Ar items
                   1094: to be selected.
                   1095: .Ar items
                   1096: can be a comma-separated list to display more than one item.
                   1097: If an item has spaces, that entry must be quoted.
                   1098: After an item is chosen,
                   1099: .Ql %%
                   1100: is replaced by the chosen item in the
                   1101: .Ar template
                   1102: and the result is executed as a command.
                   1103: If
                   1104: .Ar template
                   1105: is not given, "run-shell '%%'" is used.
                   1106: .Ar items
                   1107: also accepts format specifiers.
                   1108: For the meaning of this see the
1.294     nicm     1109: .Sx FORMATS
                   1110: section.
1.314     nicm     1111: This command works only if at least one client is attached.
1.76      nicm     1112: .It Xo
                   1113: .Ic choose-session
1.294     nicm     1114: .Op Fl F Ar format
1.76      nicm     1115: .Op Fl t Ar target-window
                   1116: .Op Ar template
                   1117: .Xc
                   1118: Put a window into session choice mode, where a session may be selected
                   1119: interactively from a list.
                   1120: When one is chosen,
                   1121: .Ql %%
                   1122: is replaced by the session name in
                   1123: .Ar template
                   1124: and the result executed as a command.
                   1125: If
                   1126: .Ar template
                   1127: is not given, "switch-client -t '%%'" is used.
1.294     nicm     1128: For the meaning of the
                   1129: .Fl F
                   1130: flag, see the
                   1131: .Sx FORMATS
                   1132: section.
1.314     nicm     1133: This command works only if at least one client is attached.
1.298     nicm     1134: .It Xo
                   1135: .Ic choose-tree
1.319     nicm     1136: .Op Fl suw
1.298     nicm     1137: .Op Fl b Ar session-template
                   1138: .Op Fl c Ar window-template
                   1139: .Op Fl S Ar format
                   1140: .Op Fl W Ar format
                   1141: .Op Fl t Ar target-window
                   1142: .Xc
                   1143: Put a window into tree choice mode, where either sessions or windows may be
                   1144: selected interactively from a list.
                   1145: By default, windows belonging to a session are indented to show their
                   1146: relationship to a session.
                   1147: .Pp
                   1148: Note that the
                   1149: .Ic choose-window
                   1150: and
                   1151: .Ic choose-session
                   1152: commands are wrappers around
                   1153: .Ic choose-tree .
                   1154: .Pp
                   1155: If
                   1156: .Fl s
                   1157: is given, will show sessions.
                   1158: If
                   1159: .Fl w
                   1160: is given, will show windows.
1.320     nicm     1161: .Pp
                   1162: By default, the tree is collapsed and sessions must be expanded to windows
                   1163: with the right arrow key.
                   1164: The
1.309     nicm     1165: .Fl u
1.321     jmc      1166: option will start with all sessions expanded instead.
1.320     nicm     1167: .Pp
1.298     nicm     1168: If
                   1169: .Fl b
                   1170: is given, will override the default session command.
                   1171: Note that
                   1172: .Ql %%
1.320     nicm     1173: can be used and will be replaced with the session name.
1.298     nicm     1174: The default option if not specified is "switch-client -t '%%'".
                   1175: If
                   1176: .Fl c
                   1177: is given, will override the default window command.
1.320     nicm     1178: Like
                   1179: .Fl b ,
1.298     nicm     1180: .Ql %%
1.320     nicm     1181: can be used and will be replaced with the session name and window index.
                   1182: When a window is chosen from the list, the session command is run before the
                   1183: window command.
                   1184: .Pp
1.298     nicm     1185: If
                   1186: .Fl S
                   1187: is given will display the specified format instead of the default session
                   1188: format.
                   1189: If
                   1190: .Fl W
                   1191: is given will display the specified format instead of the default window
                   1192: format.
                   1193: For the meaning of the
                   1194: .Fl s
                   1195: and
                   1196: .Fl w
                   1197: options, see the
                   1198: .Sx FORMATS
                   1199: section.
1.320     nicm     1200: .Pp
1.314     nicm     1201: This command works only if at least one client is attached.
1.76      nicm     1202: .It Xo
                   1203: .Ic choose-window
1.294     nicm     1204: .Op Fl F Ar format
1.76      nicm     1205: .Op Fl t Ar target-window
                   1206: .Op Ar template
                   1207: .Xc
                   1208: Put a window into window choice mode, where a window may be chosen
                   1209: interactively from a list.
                   1210: After a window is selected,
                   1211: .Ql %%
                   1212: is replaced by the session name and window index in
                   1213: .Ar template
                   1214: and the result executed as a command.
                   1215: If
                   1216: .Ar template
                   1217: is not given, "select-window -t '%%'" is used.
1.294     nicm     1218: For the meaning of the
                   1219: .Fl F
                   1220: flag, see the
                   1221: .Sx FORMATS
                   1222: section.
1.314     nicm     1223: This command works only if at least one client is attached.
1.78      nicm     1224: .It Ic display-panes Op Fl t Ar target-client
                   1225: .D1 (alias: Ic displayp)
                   1226: Display a visible indicator of each pane shown by
                   1227: .Ar target-client .
                   1228: See the
1.145     nicm     1229: .Ic display-panes-time ,
                   1230: .Ic display-panes-colour ,
1.78      nicm     1231: and
1.145     nicm     1232: .Ic display-panes-active-colour
1.78      nicm     1233: session options.
1.84      nicm     1234: While the indicator is on screen, a pane may be selected with the
                   1235: .Ql 0
                   1236: to
                   1237: .Ql 9
                   1238: keys.
1.57      jmc      1239: .It Xo Ic find-window
1.285     nicm     1240: .Op Fl CNT
1.294     nicm     1241: .Op Fl F Ar format
1.57      jmc      1242: .Op Fl t Ar target-window
                   1243: .Ar match-string
                   1244: .Xc
                   1245: .D1 (alias: Ic findw )
                   1246: Search for the
                   1247: .Xr fnmatch 3
                   1248: pattern
                   1249: .Ar match-string
                   1250: in window names, titles, and visible content (but not history).
1.285     nicm     1251: The flags control matching behavior:
                   1252: .Fl C
                   1253: matches only visible window contents,
                   1254: .Fl N
                   1255: matches only the window name and
                   1256: .Fl T
                   1257: matches only the window title.
                   1258: The default is
                   1259: .Fl CNT .
                   1260: If only one window is matched, it'll be automatically selected,
                   1261: otherwise a choice list is shown.
1.294     nicm     1262: For the meaning of the
                   1263: .Fl F
                   1264: flag, see the
                   1265: .Sx FORMATS
                   1266: section.
1.314     nicm     1267: This command works only if at least one client is attached.
1.137     nicm     1268: .It Xo Ic join-pane
1.277     nicm     1269: .Op Fl bdhv
1.137     nicm     1270: .Oo Fl l
                   1271: .Ar size |
                   1272: .Fl p Ar percentage Oc
                   1273: .Op Fl s Ar src-pane
                   1274: .Op Fl t Ar dst-pane
                   1275: .Xc
                   1276: .D1 (alias: Ic joinp )
                   1277: Like
                   1278: .Ic split-window ,
                   1279: but instead of splitting
                   1280: .Ar dst-pane
                   1281: and creating a new pane, split it and move
                   1282: .Ar src-pane
                   1283: into the space.
                   1284: This can be used to reverse
                   1285: .Ic break-pane .
1.277     nicm     1286: The
                   1287: .Fl b
                   1288: option causes
                   1289: .Ar src-pane
                   1290: to be joined to left of or above
                   1291: .Ar dst-pane .
1.112     nicm     1292: .It Xo Ic kill-pane
                   1293: .Op Fl a
                   1294: .Op Fl t Ar target-pane
                   1295: .Xc
1.57      jmc      1296: .D1 (alias: Ic killp )
                   1297: Destroy the given pane.
                   1298: If no panes remain in the containing window, it is also destroyed.
1.112     nicm     1299: The
                   1300: .Fl a
                   1301: option kills all but the pane given with
                   1302: .Fl t .
1.289     nicm     1303: .It Xo Ic kill-window
                   1304: .Op Fl a
                   1305: .Op Fl t Ar target-window
                   1306: .Xc
1.57      jmc      1307: .D1 (alias: Ic killw )
                   1308: Kill the current window or the window at
                   1309: .Ar target-window ,
1.1       nicm     1310: removing it from any sessions to which it is linked.
1.289     nicm     1311: The
                   1312: .Fl a
                   1313: option kills all but the window given with
                   1314: .Fl t .
1.187     nicm     1315: .It Ic last-pane Op Fl t Ar target-window
                   1316: .D1 (alias: Ic lastp )
                   1317: Select the last (previously selected) pane.
1.56      jmc      1318: .It Ic last-window Op Fl t Ar target-session
1.1       nicm     1319: .D1 (alias: Ic last )
                   1320: Select the last (previously selected) window.
                   1321: If no
                   1322: .Ar target-session
                   1323: is specified, select the last window of the current session.
                   1324: .It Xo Ic link-window
                   1325: .Op Fl dk
                   1326: .Op Fl s Ar src-window
                   1327: .Op Fl t Ar dst-window
                   1328: .Xc
                   1329: .D1 (alias: Ic linkw )
                   1330: Link the window at
                   1331: .Ar src-window
                   1332: to the specified
                   1333: .Ar dst-window .
                   1334: If
                   1335: .Ar dst-window
                   1336: is specified and no such window exists, the
                   1337: .Ar src-window
                   1338: is linked there.
                   1339: If
                   1340: .Fl k
                   1341: is given and
                   1342: .Ar dst-window
                   1343: exists, it is killed, otherwise an error is generated.
                   1344: If
                   1345: .Fl d
                   1346: is given, the newly linked window is not selected.
1.214     nicm     1347: .It Xo Ic list-panes
                   1348: .Op Fl as
1.245     nicm     1349: .Op Fl F Ar format
1.214     nicm     1350: .Op Fl t Ar target
                   1351: .Xc
1.104     nicm     1352: .D1 (alias: Ic lsp )
1.214     nicm     1353: If
                   1354: .Fl a
                   1355: is given,
                   1356: .Ar target
                   1357: is ignored and all panes on the server are listed.
                   1358: If
                   1359: .Fl s
                   1360: is given,
                   1361: .Ar target
                   1362: is a session (or the current session).
                   1363: If neither is given,
                   1364: .Ar target
                   1365: is a window (or the current window).
1.247     nicm     1366: For the meaning of the
                   1367: .Fl F
                   1368: flag, see the
                   1369: .Sx FORMATS
                   1370: section.
1.214     nicm     1371: .It Xo Ic list-windows
                   1372: .Op Fl a
1.245     nicm     1373: .Op Fl F Ar format
1.214     nicm     1374: .Op Fl t Ar target-session
                   1375: .Xc
1.1       nicm     1376: .D1 (alias: Ic lsw )
1.214     nicm     1377: If
                   1378: .Fl a
                   1379: is given, list all windows on the server.
                   1380: Otherwise, list windows in the current session or in
1.1       nicm     1381: .Ar target-session .
1.245     nicm     1382: For the meaning of the
                   1383: .Fl F
                   1384: flag, see the
                   1385: .Sx FORMATS
                   1386: section.
1.277     nicm     1387: .It Xo Ic move-pane
                   1388: .Op Fl bdhv
                   1389: .Oo Fl l
                   1390: .Ar size |
                   1391: .Fl p Ar percentage Oc
                   1392: .Op Fl s Ar src-pane
                   1393: .Op Fl t Ar dst-pane
                   1394: .Xc
                   1395: .D1 (alias: Ic movep )
                   1396: Like
                   1397: .Ic join-pane ,
                   1398: but
                   1399: .Ar src-pane
                   1400: and
                   1401: .Ar dst-pane
                   1402: may belong to the same window.
1.1       nicm     1403: .It Xo Ic move-window
1.291     nicm     1404: .Op Fl rdk
1.1       nicm     1405: .Op Fl s Ar src-window
                   1406: .Op Fl t Ar dst-window
                   1407: .Xc
                   1408: .D1 (alias: Ic movew )
                   1409: This is similar to
                   1410: .Ic link-window ,
                   1411: except the window at
                   1412: .Ar src-window
                   1413: is moved to
                   1414: .Ar dst-window .
1.291     nicm     1415: With
                   1416: .Fl r ,
                   1417: all windows in the session are renumbered in sequential order, respecting
                   1418: the
                   1419: .Ic base-index
                   1420: option.
1.1       nicm     1421: .It Xo Ic new-window
1.201     nicm     1422: .Op Fl adkP
1.272     nicm     1423: .Op Fl c Ar start-directory
1.1       nicm     1424: .Op Fl n Ar window-name
                   1425: .Op Fl t Ar target-window
1.279     nicm     1426: .Op Fl F Ar format
1.153     nicm     1427: .Op Ar shell-command
1.1       nicm     1428: .Xc
                   1429: .D1 (alias: Ic neww )
                   1430: Create a new window.
1.160     nicm     1431: With
                   1432: .Fl a ,
                   1433: the new window is inserted at the next index up from the specified
                   1434: .Ar target-window ,
                   1435: moving windows up if necessary,
                   1436: otherwise
                   1437: .Ar target-window
                   1438: is the new window location.
                   1439: .Pp
1.1       nicm     1440: If
                   1441: .Fl d
                   1442: is given, the session does not make the new window the current window.
                   1443: .Ar target-window
1.28      nicm     1444: represents the window to be created; if the target already exists an error is
                   1445: shown, unless the
                   1446: .Fl k
                   1447: flag is used, in which case it is destroyed.
1.153     nicm     1448: .Ar shell-command
1.1       nicm     1449: is the command to execute.
                   1450: If
1.153     nicm     1451: .Ar shell-command
                   1452: is not specified, the value of the
                   1453: .Ic default-command
                   1454: option is used.
1.272     nicm     1455: .Fl c
                   1456: specifies the working directory in which the new window is created.
                   1457: It may have an absolute path or one of the following values (or a subdirectory):
                   1458: .Bl -column "XXXXXXXXXXXX" "XXXXXXXXXXXXXXXXXXXXXXXX" -offset indent
                   1459: .It Li "Empty string" Ta "Current pane's directory"
                   1460: .It Li "~" Ta "User's home directory"
                   1461: .It Li "-" Ta "Where session was started"
                   1462: .It Li "." Ta "Where server was started"
                   1463: .El
1.153     nicm     1464: .Pp
                   1465: When the shell command completes, the window closes.
                   1466: See the
                   1467: .Ic remain-on-exit
                   1468: option to change this behaviour.
1.1       nicm     1469: .Pp
                   1470: The
                   1471: .Ev TERM
                   1472: environment variable must be set to
                   1473: .Dq screen
                   1474: for all programs running
                   1475: .Em inside
                   1476: .Nm .
                   1477: New windows will automatically have
                   1478: .Dq TERM=screen
                   1479: added to their environment, but care must be taken not to reset this in shell
                   1480: start-up files.
1.201     nicm     1481: .Pp
                   1482: The
                   1483: .Fl P
1.279     nicm     1484: option prints information about the new window after it has been created.
                   1485: By default, it uses the format
                   1486: .Ql #{session_name}:#{window_index}
                   1487: but a different format may be specified with
                   1488: .Fl F .
1.56      jmc      1489: .It Ic next-layout Op Fl t Ar target-window
1.1       nicm     1490: .D1 (alias: Ic nextl )
                   1491: Move a window to the next layout and rearrange the panes to fit.
                   1492: .It Xo Ic next-window
1.9       nicm     1493: .Op Fl a
1.1       nicm     1494: .Op Fl t Ar target-session
                   1495: .Xc
                   1496: .D1 (alias: Ic next )
                   1497: Move to the next window in the session.
1.9       nicm     1498: If
1.12      jmc      1499: .Fl a
1.295     nicm     1500: is used, move to the next window with an alert.
1.107     nicm     1501: .It Xo Ic pipe-pane
                   1502: .Op Fl o
                   1503: .Op Fl t Ar target-pane
1.153     nicm     1504: .Op Ar shell-command
1.107     nicm     1505: .Xc
                   1506: .D1 (alias: Ic pipep )
                   1507: Pipe any output sent by the program in
                   1508: .Ar target-pane
                   1509: to a shell command.
                   1510: A pane may only be piped to one command at a time, any existing pipe is
                   1511: closed before
1.153     nicm     1512: .Ar shell-command
1.107     nicm     1513: is executed.
1.174     nicm     1514: The
                   1515: .Ar shell-command
                   1516: string may contain the special character sequences supported by the
                   1517: .Ic status-left
1.231     nicm     1518: option.
1.107     nicm     1519: If no
1.153     nicm     1520: .Ar shell-command
1.107     nicm     1521: is given, the current pipe (if any) is closed.
                   1522: .Pp
                   1523: The
                   1524: .Fl o
                   1525: option only opens a new pipe if no previous pipe exists, allowing a pipe to
                   1526: be toggled with a single key, for example:
                   1527: .Bd -literal -offset indent
1.174     nicm     1528: bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1.107     nicm     1529: .Ed
1.176     nicm     1530: .It Xo Ic previous-layout
                   1531: .Op Fl t Ar target-window
                   1532: .Xc
                   1533: .D1 (alias: Ic prevl )
                   1534: Move to the previous layout in the session.
1.1       nicm     1535: .It Xo Ic previous-window
1.9       nicm     1536: .Op Fl a
1.1       nicm     1537: .Op Fl t Ar target-session
                   1538: .Xc
                   1539: .D1 (alias: Ic prev )
                   1540: Move to the previous window in the session.
1.9       nicm     1541: With
                   1542: .Fl a ,
1.295     nicm     1543: move to the previous window with an alert.
1.1       nicm     1544: .It Xo Ic rename-window
                   1545: .Op Fl t Ar target-window
                   1546: .Ar new-name
                   1547: .Xc
                   1548: .D1 (alias: Ic renamew )
                   1549: Rename the current window, or the window at
                   1550: .Ar target-window
                   1551: if specified, to
                   1552: .Ar new-name .
                   1553: .It Xo Ic resize-pane
1.39      jmc      1554: .Op Fl DLRU
1.52      nicm     1555: .Op Fl t Ar target-pane
1.324   ! nicm     1556: .Op Fl x Ar width
        !          1557: .Op Fl y Ar height
1.1       nicm     1558: .Op Ar adjustment
                   1559: .Xc
                   1560: .D1 (alias: Ic resizep )
1.324   ! nicm     1561: Resize a pane, up, down, left or right by
        !          1562: .Ar adjustment
        !          1563: with
        !          1564: .Fl U ,
1.57      jmc      1565: .Fl D ,
                   1566: .Fl L
1.324   ! nicm     1567: or
        !          1568: .Fl R ,
        !          1569: or
        !          1570: to an absolute size
        !          1571: with
        !          1572: .Fl x
        !          1573: or
        !          1574: .Fl y .
1.57      jmc      1575: The
                   1576: .Ar adjustment
                   1577: is given in lines or cells (the default is 1).
1.234     nicm     1578: .It Xo Ic respawn-pane
                   1579: .Op Fl k
                   1580: .Op Fl t Ar target-pane
                   1581: .Op Ar shell-command
                   1582: .Xc
                   1583: .D1 (alias: Ic respawnp )
                   1584: Reactivate a pane in which the command has exited (see the
                   1585: .Ic remain-on-exit
                   1586: window option).
                   1587: If
                   1588: .Ar shell-command
                   1589: is not given, the command used when the pane was created is executed.
                   1590: The pane must be already inactive, unless
                   1591: .Fl k
                   1592: is given, in which case any existing command is killed.
1.57      jmc      1593: .It Xo Ic respawn-window
                   1594: .Op Fl k
                   1595: .Op Fl t Ar target-window
1.153     nicm     1596: .Op Ar shell-command
1.57      jmc      1597: .Xc
                   1598: .D1 (alias: Ic respawnw )
1.153     nicm     1599: Reactivate a window in which the command has exited (see the
1.57      jmc      1600: .Ic remain-on-exit
                   1601: window option).
                   1602: If
1.153     nicm     1603: .Ar shell-command
1.57      jmc      1604: is not given, the command used when the window was created is executed.
                   1605: The window must be already inactive, unless
                   1606: .Fl k
                   1607: is given, in which case any existing command is killed.
                   1608: .It Xo Ic rotate-window
                   1609: .Op Fl DU
                   1610: .Op Fl t Ar target-window
                   1611: .Xc
                   1612: .D1 (alias: Ic rotatew )
                   1613: Rotate the positions of the panes within a window, either upward (numerically
                   1614: lower) with
                   1615: .Fl U
                   1616: or downward (numerically higher).
                   1617: .It Xo Ic select-layout
1.313     nicm     1618: .Op Fl np
1.57      jmc      1619: .Op Fl t Ar target-window
                   1620: .Op Ar layout-name
                   1621: .Xc
1.176     nicm     1622: .D1 (alias: Ic selectl )
1.57      jmc      1623: Choose a specific layout for a window.
                   1624: If
                   1625: .Ar layout-name
1.181     nicm     1626: is not given, the last preset layout used (if any) is reapplied.
1.204     nicm     1627: .Fl n
                   1628: and
                   1629: .Fl p
                   1630: are equivalent to the
                   1631: .Ic next-layout
                   1632: and
                   1633: .Ic previous-layout
                   1634: commands.
1.156     nicm     1635: .It Xo Ic select-pane
1.204     nicm     1636: .Op Fl lDLRU
1.156     nicm     1637: .Op Fl t Ar target-pane
                   1638: .Xc
1.57      jmc      1639: .D1 (alias: Ic selectp )
                   1640: Make pane
                   1641: .Ar target-pane
                   1642: the active pane in window
                   1643: .Ar target-window .
1.156     nicm     1644: If one of
                   1645: .Fl D ,
                   1646: .Fl L ,
                   1647: .Fl R ,
                   1648: or
                   1649: .Fl U
                   1650: is used, respectively the pane below, to the left, to the right, or above the
                   1651: target pane is used.
1.204     nicm     1652: .Fl l
                   1653: is the same as using the
                   1654: .Ic last-pane
                   1655: command.
                   1656: .It Xo Ic select-window
1.310     nicm     1657: .Op Fl lnpT
1.204     nicm     1658: .Op Fl t Ar target-window
                   1659: .Xc
1.57      jmc      1660: .D1 (alias: Ic selectw )
                   1661: Select the window at
                   1662: .Ar target-window .
1.204     nicm     1663: .Fl l ,
                   1664: .Fl n
                   1665: and
                   1666: .Fl p
                   1667: are equivalent to the
                   1668: .Ic last-window ,
                   1669: .Ic next-window
                   1670: and
                   1671: .Ic previous-window
                   1672: commands.
1.310     nicm     1673: If
                   1674: .Fl T
                   1675: is given and the selected window is already the current window,
                   1676: the command behaves like
                   1677: .Ic last-window .
1.57      jmc      1678: .It Xo Ic split-window
1.201     nicm     1679: .Op Fl dhvP
1.272     nicm     1680: .Op Fl c Ar start-directory
1.57      jmc      1681: .Oo Fl l
                   1682: .Ar size |
                   1683: .Fl p Ar percentage Oc
1.136     nicm     1684: .Op Fl t Ar target-pane
1.153     nicm     1685: .Op Ar shell-command
1.279     nicm     1686: .Op Fl F Ar format
1.57      jmc      1687: .Xc
1.176     nicm     1688: .D1 (alias: Ic splitw )
1.136     nicm     1689: Create a new pane by splitting
                   1690: .Ar target-pane :
1.57      jmc      1691: .Fl h
                   1692: does a horizontal split and
                   1693: .Fl v
                   1694: a vertical split; if neither is specified,
                   1695: .Fl v
                   1696: is assumed.
                   1697: The
                   1698: .Fl l
                   1699: and
                   1700: .Fl p
1.136     nicm     1701: options specify the size of the new pane in lines (for vertical split) or in
1.57      jmc      1702: cells (for horizontal split), or as a percentage, respectively.
1.136     nicm     1703: All other options have the same meaning as for the
1.57      jmc      1704: .Ic new-window
                   1705: command.
                   1706: .It Xo Ic swap-pane
                   1707: .Op Fl dDU
                   1708: .Op Fl s Ar src-pane
                   1709: .Op Fl t Ar dst-pane
                   1710: .Xc
                   1711: .D1 (alias: Ic swapp )
                   1712: Swap two panes.
                   1713: If
                   1714: .Fl U
                   1715: is used and no source pane is specified with
                   1716: .Fl s ,
                   1717: .Ar dst-pane
                   1718: is swapped with the previous pane (before it numerically);
                   1719: .Fl D
                   1720: swaps with the next pane (after it numerically).
1.138     nicm     1721: .Fl d
                   1722: instructs
                   1723: .Nm
                   1724: not to change the active pane.
1.57      jmc      1725: .It Xo Ic swap-window
                   1726: .Op Fl d
                   1727: .Op Fl s Ar src-window
                   1728: .Op Fl t Ar dst-window
                   1729: .Xc
                   1730: .D1 (alias: Ic swapw )
                   1731: This is similar to
                   1732: .Ic link-window ,
                   1733: except the source and destination windows are swapped.
                   1734: It is an error if no window exists at
                   1735: .Ar src-window .
                   1736: .It Xo Ic unlink-window
1.1       nicm     1737: .Op Fl k
                   1738: .Op Fl t Ar target-window
                   1739: .Xc
1.57      jmc      1740: .D1 (alias: Ic unlinkw )
                   1741: Unlink
                   1742: .Ar target-window .
                   1743: Unless
                   1744: .Fl k
                   1745: is given, a window may be unlinked only if it is linked to multiple sessions -
                   1746: windows may not be linked to no sessions;
                   1747: if
1.1       nicm     1748: .Fl k
1.57      jmc      1749: is specified and the window is linked to only one session, it is unlinked and
                   1750: destroyed.
                   1751: .El
                   1752: .Sh KEY BINDINGS
1.93      nicm     1753: .Nm
                   1754: allows a command to be bound to most keys, with or without a prefix key.
                   1755: When specifying keys, most represent themselves (for example
                   1756: .Ql A
                   1757: to
1.95      jmc      1758: .Ql Z ) .
1.93      nicm     1759: Ctrl keys may be prefixed with
                   1760: .Ql C-
                   1761: or
1.95      jmc      1762: .Ql ^ ,
                   1763: and Alt (meta) with
1.93      nicm     1764: .Ql M- .
                   1765: In addition, the following special key names are accepted:
1.126     nicm     1766: .Em Up ,
                   1767: .Em Down ,
                   1768: .Em Left ,
                   1769: .Em Right ,
1.93      nicm     1770: .Em BSpace ,
                   1771: .Em BTab ,
                   1772: .Em DC
                   1773: (Delete),
                   1774: .Em End ,
                   1775: .Em Enter ,
                   1776: .Em Escape ,
                   1777: .Em F1
                   1778: to
                   1779: .Em F20 ,
                   1780: .Em Home ,
                   1781: .Em IC
                   1782: (Insert),
1.254     nicm     1783: .Em NPage/PageDown/PgDn ,
                   1784: .Em PPage/PageUp/PgUp ,
1.93      nicm     1785: .Em Space ,
                   1786: and
                   1787: .Em Tab .
                   1788: Note that to bind the
                   1789: .Ql \&"
                   1790: or
                   1791: .Ql '
                   1792: keys, quotation marks are necessary, for example:
                   1793: .Bd -literal -offset indent
                   1794: bind-key '"' split-window
1.167     nicm     1795: bind-key "'" new-window
1.93      nicm     1796: .Ed
                   1797: .Pp
1.57      jmc      1798: Commands related to key bindings are as follows:
                   1799: .Bl -tag -width Ds
                   1800: .It Xo Ic bind-key
                   1801: .Op Fl cnr
                   1802: .Op Fl t Ar key-table
                   1803: .Ar key Ar command Op Ar arguments
1.1       nicm     1804: .Xc
1.57      jmc      1805: .D1 (alias: Ic bind )
                   1806: Bind key
                   1807: .Ar key
                   1808: to
                   1809: .Ar command .
                   1810: By default (without
                   1811: .Fl t )
                   1812: the primary key bindings are modified (those normally activated with the prefix
                   1813: key); in this case, if
                   1814: .Fl n
                   1815: is specified, it is not necessary to use the prefix key,
                   1816: .Ar command
                   1817: is bound to
                   1818: .Ar key
                   1819: alone.
1.1       nicm     1820: The
1.57      jmc      1821: .Fl r
                   1822: flag indicates this key may repeat, see the
                   1823: .Ic repeat-time
                   1824: option.
                   1825: .Pp
                   1826: If
                   1827: .Fl t
                   1828: is present,
                   1829: .Ar key
                   1830: is bound in
                   1831: .Ar key-table :
                   1832: the binding for command mode with
                   1833: .Fl c
                   1834: or for normal mode without.
                   1835: To view the default bindings and possible commands, see the
                   1836: .Ic list-keys
                   1837: command.
                   1838: .It Ic list-keys Op Fl t Ar key-table
                   1839: .D1 (alias: Ic lsk )
                   1840: List all key bindings.
                   1841: Without
                   1842: .Fl t
                   1843: the primary key bindings - those executed when preceded by the prefix key -
                   1844: are printed.
                   1845: .Pp
                   1846: With
                   1847: .Fl t ,
                   1848: the key bindings in
                   1849: .Ar key-table
                   1850: are listed; this may be one of:
                   1851: .Em vi-edit ,
                   1852: .Em emacs-edit ,
                   1853: .Em vi-choice ,
                   1854: .Em emacs-choice ,
                   1855: .Em vi-copy
                   1856: or
                   1857: .Em emacs-copy .
                   1858: .It Xo Ic send-keys
1.273     nicm     1859: .Op Fl lR
1.72      nicm     1860: .Op Fl t Ar target-pane
1.57      jmc      1861: .Ar key Ar ...
1.1       nicm     1862: .Xc
1.57      jmc      1863: .D1 (alias: Ic send )
                   1864: Send a key or keys to a window.
                   1865: Each argument
                   1866: .Ar key
                   1867: is the name of the key (such as
                   1868: .Ql C-a
                   1869: or
                   1870: .Ql npage
                   1871: ) to send; if the string is not recognised as a key, it is sent as a series of
                   1872: characters.
1.273     nicm     1873: The
                   1874: .Fl l
                   1875: flag disables key name lookup and sends the keys literally.
1.57      jmc      1876: All arguments are sent sequentially from first to last.
1.265     nicm     1877: The
                   1878: .Fl R
                   1879: flag causes the terminal state to be reset.
1.267     nicm     1880: .It Xo Ic send-prefix
                   1881: .Op Fl 2
                   1882: .Op Fl t Ar target-pane
                   1883: .Xc
                   1884: Send the prefix key, or with
                   1885: .Fl 2
                   1886: the secondary prefix key, to a window as if it was pressed.
1.57      jmc      1887: .It Xo Ic unbind-key
1.189     nicm     1888: .Op Fl acn
1.57      jmc      1889: .Op Fl t Ar key-table
                   1890: .Ar key
1.2       nicm     1891: .Xc
1.57      jmc      1892: .D1 (alias: Ic unbind )
                   1893: Unbind the command bound to
                   1894: .Ar key .
                   1895: Without
                   1896: .Fl t
                   1897: the primary key bindings are modified; in this case, if
                   1898: .Fl n
                   1899: is specified, the command bound to
                   1900: .Ar key
                   1901: without a prefix (if any) is removed.
1.189     nicm     1902: If
                   1903: .Fl a
                   1904: is present, all key bindings are removed.
1.57      jmc      1905: .Pp
1.47      nicm     1906: If
1.57      jmc      1907: .Fl t
                   1908: is present,
                   1909: .Ar key
                   1910: in
                   1911: .Ar key-table
                   1912: is unbound: the binding for command mode with
                   1913: .Fl c
                   1914: or for normal mode without.
                   1915: .El
                   1916: .Sh OPTIONS
                   1917: The appearance and behaviour of
                   1918: .Nm
                   1919: may be modified by changing the value of various options.
1.133     nicm     1920: There are three types of option:
                   1921: .Em server options ,
1.57      jmc      1922: .Em session options
                   1923: and
                   1924: .Em window options .
                   1925: .Pp
1.133     nicm     1926: The
                   1927: .Nm
                   1928: server has a set of global options which do not apply to any particular
                   1929: window or session.
                   1930: These are altered with the
                   1931: .Ic set-option
                   1932: .Fl s
                   1933: command, or displayed with the
                   1934: .Ic show-options
                   1935: .Fl s
                   1936: command.
                   1937: .Pp
                   1938: In addition, each individual session may have a set of session options, and
                   1939: there is a separate set of global session options.
1.57      jmc      1940: Sessions which do not have a particular option configured inherit the value
                   1941: from the global session options.
                   1942: Session options are set or unset with the
                   1943: .Ic set-option
                   1944: command and may be listed with the
                   1945: .Ic show-options
                   1946: command.
1.133     nicm     1947: The available server and session options are listed under the
1.57      jmc      1948: .Ic set-option
                   1949: command.
                   1950: .Pp
                   1951: Similarly, a set of window options is attached to each window, and there is
                   1952: a set of global window options from which any unset options are inherited.
                   1953: Window options are altered with the
                   1954: .Ic set-window-option
                   1955: command and can be listed with the
                   1956: .Ic show-window-options
                   1957: command.
                   1958: All window options are documented with the
                   1959: .Ic set-window-option
                   1960: command.
1.318     nicm     1961: .Pp
                   1962: .Nm
                   1963: also supports user options which are prefixed with a
                   1964: .Ql \&@ .
1.321     jmc      1965: User options may have any name, so long as they are prefixed with
                   1966: .Ql \&@ ,
1.318     nicm     1967: and be set to any string.
                   1968: For example
                   1969: .Bd -literal -offset indent
                   1970: $ tmux setw -q @foo "abc123"
                   1971: $ tmux showw -v @foo
                   1972: abc123
                   1973: .Ed
1.57      jmc      1974: .Pp
                   1975: Commands which set options are as follows:
                   1976: .Bl -tag -width Ds
1.1       nicm     1977: .It Xo Ic set-option
1.281     nicm     1978: .Op Fl agqsuw
1.129     nicm     1979: .Op Fl t Ar target-session | Ar target-window
1.1       nicm     1980: .Ar option Ar value
                   1981: .Xc
                   1982: .D1 (alias: Ic set )
1.133     nicm     1983: Set a window option with
                   1984: .Fl w
                   1985: (equivalent to the
                   1986: .Ic set-window-option
                   1987: command),
                   1988: a server option with
                   1989: .Fl s ,
                   1990: otherwise a session option.
                   1991: .Pp
                   1992: If
                   1993: .Fl g
                   1994: is specified, the global session or window option is set.
1.58      nicm     1995: With
                   1996: .Fl a ,
                   1997: and if the option expects a string,
                   1998: .Ar value
                   1999: is appended to the existing setting.
1.1       nicm     2000: The
                   2001: .Fl u
                   2002: flag unsets an option, so a session inherits the option from the global
1.133     nicm     2003: options.
                   2004: It is not possible to unset a global option.
1.1       nicm     2005: .Pp
1.281     nicm     2006: The
                   2007: .Fl q
                   2008: flag suppresses the informational message (as if the
                   2009: .Ic quiet
                   2010: server option was set).
                   2011: .Pp
1.133     nicm     2012: Available window options are listed under
                   2013: .Ic set-window-option .
1.274     nicm     2014: .Pp
                   2015: .Ar value
                   2016: depends on the option and may be a number, a string, or a flag (on, off, or
                   2017: omitted to toggle).
1.133     nicm     2018: .Pp
                   2019: Available server options are:
                   2020: .Bl -tag -width Ds
1.198     nicm     2021: .It Ic buffer-limit Ar number
                   2022: Set the number of buffers; as new buffers are added to the top of the stack,
                   2023: old ones are removed from the bottom if necessary to maintain this maximum
                   2024: length.
1.239     nicm     2025: .It Ic escape-time Ar time
                   2026: Set the time in milliseconds for which
                   2027: .Nm
                   2028: waits after an escape is input to determine if it is part of a function or meta
                   2029: key sequences.
                   2030: The default is 500 milliseconds.
                   2031: .It Xo Ic exit-unattached
                   2032: .Op Ic on | off
                   2033: .Xc
                   2034: If enabled, the server will exit when there are no attached clients.
                   2035: .It Xo Ic quiet
                   2036: .Op Ic on | off
                   2037: .Xc
                   2038: Enable or disable the display of various informational messages (see also the
                   2039: .Fl q
                   2040: command line flag).
1.228     nicm     2041: .It Xo Ic set-clipboard
                   2042: .Op Ic on | off
                   2043: .Xc
                   2044: Attempt to set the terminal clipboard content using the
                   2045: \ee]52;...\e007
                   2046: .Xr xterm 1
                   2047: escape sequences.
                   2048: This option is on by default if there is an
                   2049: .Em \&Ms
                   2050: entry in the
                   2051: .Xr terminfo 5
                   2052: description for the client terminal.
                   2053: Note that this feature needs to be enabled in
                   2054: .Xr xterm 1
                   2055: by setting the resource:
                   2056: .Bd -literal -offset indent
                   2057: disallowedWindowOps: 20,21,SetXprop
                   2058: .Ed
                   2059: .Pp
                   2060: Or changing this property from the
                   2061: .Xr xterm 1
                   2062: interactive menu when required.
1.133     nicm     2063: .El
1.129     nicm     2064: .Pp
1.18      nicm     2065: Available session options are:
1.1       nicm     2066: .Bl -tag -width Ds
1.312     nicm     2067: .It Ic assume-paste-time Ar milliseconds
                   2068: If keys are entered faster than one in
                   2069: .Ar milliseconds ,
                   2070: they are assumed to have been pasted rather than typed and
                   2071: .Nm
                   2072: key bindings are not processed.
                   2073: The default is one millisecond and zero disables.
1.69      nicm     2074: .It Ic base-index Ar index
                   2075: Set the base index from which an unused index should be searched when a new
                   2076: window is created.
                   2077: The default is zero.
1.1       nicm     2078: .It Xo Ic bell-action
1.56      jmc      2079: .Op Ic any | none | current
1.1       nicm     2080: .Xc
                   2081: Set action on window bell.
                   2082: .Ic any
                   2083: means a bell in any window linked to a session causes a bell in the current
                   2084: window of that session,
                   2085: .Ic none
                   2086: means all bells are ignored and
                   2087: .Ic current
1.305     nicm     2088: means only bells in windows other than the current window are ignored.
1.237     nicm     2089: .It Xo Ic bell-on-alert
                   2090: .Op Ic on | off
                   2091: .Xc
1.295     nicm     2092: If on, ring the terminal bell when an alert
1.237     nicm     2093: occurs.
1.153     nicm     2094: .It Ic default-command Ar shell-command
1.1       nicm     2095: Set the command used for new windows (if not specified when the window is
                   2096: created) to
1.153     nicm     2097: .Ar shell-command ,
1.79      nicm     2098: which may be any
                   2099: .Xr sh 1
                   2100: command.
1.19      nicm     2101: The default is an empty string, which instructs
                   2102: .Nm
1.79      nicm     2103: to create a login shell using the value of the
                   2104: .Ic default-shell
                   2105: option.
1.196     nicm     2106: .It Ic default-path Ar path
1.257     nicm     2107: Set the default working directory for new panes.
                   2108: If empty (the default), the working directory is determined from the process
                   2109: running in the active pane, from the command line environment or from the
                   2110: working directory where the session was created.
1.292     nicm     2111: Otherwise the same options are available as for the
                   2112: .Fl c
                   2113: flag to
                   2114: .Ic new-window .
1.79      nicm     2115: .It Ic default-shell Ar path
                   2116: Specify the default shell.
                   2117: This is used as the login shell for new windows when the
                   2118: .Ic default-command
                   2119: option is set to empty, and must be the full path of the executable.
                   2120: When started
                   2121: .Nm
                   2122: tries to set a default value from the first suitable of the
1.19      nicm     2123: .Ev SHELL
1.79      nicm     2124: environment variable, the shell returned by
                   2125: .Xr getpwuid 3 ,
                   2126: or
                   2127: .Pa /bin/sh .
                   2128: This option should be configured when
                   2129: .Nm
                   2130: is used as a login shell.
1.22      nicm     2131: .It Ic default-terminal Ar terminal
                   2132: Set the default terminal for new windows created in this session - the
                   2133: default value of the
                   2134: .Ev TERM
                   2135: environment variable.
                   2136: For
                   2137: .Nm
                   2138: to work correctly, this
                   2139: .Em must
                   2140: be set to
                   2141: .Ql screen
                   2142: or a derivative of it.
1.206     nicm     2143: .It Xo Ic destroy-unattached
                   2144: .Op Ic on | off
                   2145: .Xc
1.185     nicm     2146: If enabled and the session is no longer attached to any clients, it is
                   2147: destroyed.
1.206     nicm     2148: .It Xo Ic detach-on-destroy
                   2149: .Op Ic on | off
                   2150: .Xc
1.184     nicm     2151: If on (the default), the client is detached when the session it is attached to
                   2152: is destroyed.
                   2153: If off, the client is switched to the most recently active of the remaining
                   2154: sessions.
1.145     nicm     2155: .It Ic display-panes-active-colour Ar colour
                   2156: Set the colour used by the
                   2157: .Ic display-panes
                   2158: command to show the indicator for the active pane.
1.78      nicm     2159: .It Ic display-panes-colour Ar colour
1.145     nicm     2160: Set the colour used by the
1.78      nicm     2161: .Ic display-panes
1.145     nicm     2162: command to show the indicators for inactive panes.
1.78      nicm     2163: .It Ic display-panes-time Ar time
                   2164: Set the time in milliseconds for which the indicators shown by the
                   2165: .Ic display-panes
                   2166: command appear.
1.21      nicm     2167: .It Ic display-time Ar time
1.78      nicm     2168: Set the amount of time for which status line messages and other on-screen
                   2169: indicators are displayed.
1.21      nicm     2170: .Ar time
                   2171: is in milliseconds.
1.1       nicm     2172: .It Ic history-limit Ar lines
                   2173: Set the maximum number of lines held in window history.
                   2174: This setting applies only to new windows - existing window histories are not
                   2175: resized and retain the limit at the point they were created.
                   2176: .It Ic lock-after-time Ar number
1.100     nicm     2177: Lock the session (like the
                   2178: .Ic lock-session
1.90      nicm     2179: command) after
1.1       nicm     2180: .Ar number
1.100     nicm     2181: seconds of inactivity, or the entire server (all sessions) if the
                   2182: .Ic lock-server
                   2183: option is set.
                   2184: The default is not to lock (set to 0).
1.153     nicm     2185: .It Ic lock-command Ar shell-command
1.90      nicm     2186: Command to run when locking each client.
                   2187: The default is to run
                   2188: .Xr lock 1
                   2189: with
                   2190: .Fl np .
1.100     nicm     2191: .It Xo Ic lock-server
                   2192: .Op Ic on | off
                   2193: .Xc
                   2194: If this option is
1.102     nicm     2195: .Ic on
1.100     nicm     2196: (the default),
                   2197: instead of each session locking individually as each has been
                   2198: idle for
1.108     jmc      2199: .Ic lock-after-time ,
                   2200: the entire server will lock after
1.100     nicm     2201: .Em all
                   2202: sessions would have locked.
                   2203: This has no effect as a session option; it must be set as a global option.
1.1       nicm     2204: .It Ic message-attr Ar attributes
                   2205: Set status line message attributes, where
                   2206: .Ar attributes
                   2207: is either
1.168     nicm     2208: .Ic none
1.1       nicm     2209: or a comma-delimited list of one or more of:
                   2210: .Ic bright
                   2211: (or
                   2212: .Ic bold ) ,
                   2213: .Ic dim ,
                   2214: .Ic underscore ,
                   2215: .Ic blink ,
                   2216: .Ic reverse ,
                   2217: .Ic hidden ,
                   2218: or
                   2219: .Ic italics .
                   2220: .It Ic message-bg Ar colour
                   2221: Set status line message background colour, where
                   2222: .Ar colour
                   2223: is one of:
                   2224: .Ic black ,
                   2225: .Ic red ,
                   2226: .Ic green ,
                   2227: .Ic yellow ,
                   2228: .Ic blue ,
                   2229: .Ic magenta ,
                   2230: .Ic cyan ,
1.85      nicm     2231: .Ic white ,
1.266     nicm     2232: aixterm bright variants (if supported:
                   2233: .Ic brightred ,
                   2234: .Ic brightgreen ,
                   2235: and so on),
1.85      nicm     2236: .Ic colour0
                   2237: to
                   2238: .Ic colour255
1.205     nicm     2239: from the 256-colour set,
                   2240: .Ic default ,
                   2241: or a hexadecimal RGB string such as
                   2242: .Ql #ffffff ,
                   2243: which chooses the closest match from the default 256-colour set.
1.253     nicm     2244: .It Ic message-command-attr Ar attributes
                   2245: Set status line message attributes when in command mode.
                   2246: .It Ic message-command-bg Ar colour
                   2247: Set status line message background colour when in command mode.
                   2248: .It Ic message-command-fg Ar colour
                   2249: Set status line message foreground colour when in command mode.
1.1       nicm     2250: .It Ic message-fg Ar colour
                   2251: Set status line message foreground colour.
1.120     nicm     2252: .It Ic message-limit Ar number
                   2253: Set the number of error or information messages to save in the message log for
                   2254: each client.
                   2255: The default is 20.
1.226     nicm     2256: .It Xo Ic mouse-resize-pane
                   2257: .Op Ic on | off
                   2258: .Xc
                   2259: If on,
                   2260: .Nm
                   2261: captures the mouse and allows panes to be resized by dragging on their borders.
1.102     nicm     2262: .It Xo Ic mouse-select-pane
                   2263: .Op Ic on | off
                   2264: .Xc
                   2265: If on,
                   2266: .Nm
                   2267: captures the mouse and when a window is split into multiple panes the mouse may
                   2268: be used to select the current pane.
                   2269: The mouse click is also passed through to the application as normal.
1.222     nicm     2270: .It Xo Ic mouse-select-window
                   2271: .Op Ic on | off
                   2272: .Xc
                   2273: If on, clicking the mouse on a window name in the status line will select that
                   2274: window.
1.239     nicm     2275: .It Xo Ic mouse-utf8
                   2276: .Op Ic on | off
                   2277: .Xc
                   2278: If enabled, request mouse input as UTF-8 on UTF-8 terminals.
1.196     nicm     2279: .It Ic pane-active-border-bg Ar colour
                   2280: .It Ic pane-active-border-fg Ar colour
                   2281: Set the pane border colour for the currently active pane.
                   2282: .It Ic pane-border-bg Ar colour
1.135     nicm     2283: .It Ic pane-border-fg Ar colour
                   2284: Set the pane border colour for panes aside from the active pane.
1.267     nicm     2285: .It Ic prefix Ar key
                   2286: Set the key accepted as a prefix key.
                   2287: .It Ic prefix2 Ar key
                   2288: Set a secondary key accepted as a prefix key.
1.291     nicm     2289: .It Xo Ic renumber-windows
                   2290: .Op Ic on | off
                   2291: .Xc
                   2292: If on, when a window is closed in a session, automatically renumber the other
                   2293: windows in numerical order.
                   2294: This respects the
                   2295: .Ic base-index
                   2296: option if it has been set.
                   2297: If off, do not renumber the windows.
1.21      nicm     2298: .It Ic repeat-time Ar time
1.1       nicm     2299: Allow multiple commands to be entered without pressing the prefix-key again
                   2300: in the specified
1.21      nicm     2301: .Ar time
1.1       nicm     2302: milliseconds (the default is 500).
                   2303: Whether a key repeats may be set when it is bound using the
                   2304: .Fl r
                   2305: flag to
                   2306: .Ic bind-key .
1.52      nicm     2307: Repeat is enabled for the default keys bound to the
                   2308: .Ic resize-pane
                   2309: command.
1.1       nicm     2310: .It Xo Ic set-remain-on-exit
1.56      jmc      2311: .Op Ic on | off
1.1       nicm     2312: .Xc
                   2313: Set the
                   2314: .Ic remain-on-exit
                   2315: window option for any windows first created in this session.
1.153     nicm     2316: When this option is true, windows in which the running program has
                   2317: exited do not close, instead remaining open but inactivate.
                   2318: Use the
                   2319: .Ic respawn-window
                   2320: command to reactivate such a window, or the
                   2321: .Ic kill-window
                   2322: command to destroy it.
1.1       nicm     2323: .It Xo Ic set-titles
1.56      jmc      2324: .Op Ic on | off
1.1       nicm     2325: .Xc
1.261     nicm     2326: Attempt to set the client terminal title using the
                   2327: .Em tsl
                   2328: and
                   2329: .Em fsl
                   2330: .Xr terminfo 5
                   2331: entries if they exist.
                   2332: .Nm
                   2333: automatically sets these to the \ee]2;...\e007 sequence if
1.1       nicm     2334: the terminal appears to be an xterm.
1.11      nicm     2335: This option is off by default.
1.6       jmc      2336: Note that elinks
1.1       nicm     2337: will only attempt to set the window title if the STY environment
                   2338: variable is set.
1.86      nicm     2339: .It Ic set-titles-string Ar string
                   2340: String used to set the window title if
                   2341: .Ic set-titles
                   2342: is on.
                   2343: Character sequences are replaced as for the
                   2344: .Ic status-left
                   2345: option.
1.1       nicm     2346: .It Xo Ic status
1.56      jmc      2347: .Op Ic on | off
1.1       nicm     2348: .Xc
                   2349: Show or hide the status line.
                   2350: .It Ic status-attr Ar attributes
                   2351: Set status line attributes.
                   2352: .It Ic status-bg Ar colour
                   2353: Set status line background colour.
                   2354: .It Ic status-fg Ar colour
                   2355: Set status line foreground colour.
                   2356: .It Ic status-interval Ar interval
                   2357: Update the status bar every
                   2358: .Ar interval
                   2359: seconds.
                   2360: By default, updates will occur every 15 seconds.
                   2361: A setting of zero disables redrawing at interval.
1.41      nicm     2362: .It Xo Ic status-justify
1.56      jmc      2363: .Op Ic left | centre | right
1.41      nicm     2364: .Xc
                   2365: Set the position of the window list component of the status line: left, centre
                   2366: or right justified.
1.1       nicm     2367: .It Xo Ic status-keys
1.56      jmc      2368: .Op Ic vi | emacs
1.1       nicm     2369: .Xc
1.6       jmc      2370: Use vi or emacs-style
1.1       nicm     2371: key bindings in the status line, for example at the command prompt.
1.191     nicm     2372: The default is emacs, unless the
                   2373: .Ev VISUAL
                   2374: or
                   2375: .Ev EDITOR
                   2376: environment variables are set and contain the string
                   2377: .Ql vi .
1.1       nicm     2378: .It Ic status-left Ar string
                   2379: Display
                   2380: .Ar string
                   2381: to the left of the status bar.
                   2382: .Ar string
                   2383: will be passed through
                   2384: .Xr strftime 3
                   2385: before being used.
                   2386: By default, the session name is shown.
                   2387: .Ar string
1.83      nicm     2388: may contain any of the following special character sequences:
1.1       nicm     2389: .Bl -column "Character pair" "Replaced with" -offset indent
                   2390: .It Sy "Character pair" Ta Sy "Replaced with"
1.153     nicm     2391: .It Li "#(shell-command)" Ta "First line of the command's output"
1.83      nicm     2392: .It Li "#[attributes]" Ta "Colour or attribute change"
1.1       nicm     2393: .It Li "#H" Ta "Hostname of local host"
1.224     nicm     2394: .It Li "#h" Ta "Hostname of local host without the domain name"
1.125     nicm     2395: .It Li "#F" Ta "Current window flag"
1.35      nicm     2396: .It Li "#I" Ta "Current window index"
1.301     nicm     2397: .It Li "#D" Ta "Current pane unique identifier"
1.35      nicm     2398: .It Li "#P" Ta "Current pane index"
1.1       nicm     2399: .It Li "#S" Ta "Session name"
1.261     nicm     2400: .It Li "#T" Ta "Current pane title"
1.35      nicm     2401: .It Li "#W" Ta "Current window name"
1.1       nicm     2402: .It Li "##" Ta "A literal" Ql #
                   2403: .El
1.83      nicm     2404: .Pp
1.153     nicm     2405: The #(shell-command) form executes
                   2406: .Ql shell-command
                   2407: and inserts the first line of its output.
1.103     nicm     2408: Note that shell commands are only executed once at the interval specified by
                   2409: the
                   2410: .Ic status-interval
                   2411: option: if the status line is redrawn in the meantime, the previous result is
                   2412: used.
1.161     nicm     2413: Shell commands are executed with the
                   2414: .Nm
                   2415: global environment set (see the
1.162     jmc      2416: .Sx ENVIRONMENT
                   2417: section).
1.163     nicm     2418: .Pp
1.263     nicm     2419: For details on how the names and titles can be set see the
1.261     nicm     2420: .Sx "NAMES AND TITLES"
                   2421: section.
1.109     nicm     2422: .Pp
1.83      nicm     2423: #[attributes] allows a comma-separated list of attributes to be specified,
                   2424: these may be
                   2425: .Ql fg=colour
                   2426: to set the foreground colour,
                   2427: .Ql bg=colour
1.131     nicm     2428: to set the background colour, the name of one of the attributes (listed under
                   2429: the
1.83      nicm     2430: .Ic message-attr
1.109     nicm     2431: option) to turn an attribute on, or an attribute prefixed with
                   2432: .Ql no
                   2433: to turn one off, for example
                   2434: .Ic nobright .
1.83      nicm     2435: Examples are:
                   2436: .Bd -literal -offset indent
                   2437: #(sysctl vm.loadavg)
                   2438: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
                   2439: .Ed
1.1       nicm     2440: .Pp
1.109     nicm     2441: Where appropriate, special character sequences may be prefixed with a number to
                   2442: specify the maximum length, for example
1.1       nicm     2443: .Ql #24T .
1.10      nicm     2444: .Pp
1.12      jmc      2445: By default, UTF-8 in
1.10      nicm     2446: .Ar string
                   2447: is not interpreted, to enable UTF-8, use the
                   2448: .Ic status-utf8
                   2449: option.
1.62      nicm     2450: .It Ic status-left-attr Ar attributes
1.66      jmc      2451: Set the attribute of the left part of the status line.
1.196     nicm     2452: .It Ic status-left-bg Ar colour
                   2453: Set the background colour of the left part of the status line.
1.62      nicm     2454: .It Ic status-left-fg Ar colour
                   2455: Set the foreground colour of the left part of the status line.
1.1       nicm     2456: .It Ic status-left-length Ar length
                   2457: Set the maximum
                   2458: .Ar length
                   2459: of the left component of the status bar.
                   2460: The default is 10.
1.269     nicm     2461: .It Xo Ic status-position
                   2462: .Op Ic top | bottom
                   2463: .Xc
                   2464: Set the position of the status line.
1.1       nicm     2465: .It Ic status-right Ar string
                   2466: Display
                   2467: .Ar string
                   2468: to the right of the status bar.
1.151     nicm     2469: By default, the current window title in double quotes, the date and the time
                   2470: are shown.
1.1       nicm     2471: As with
                   2472: .Ic status-left ,
                   2473: .Ar string
                   2474: will be passed to
1.10      nicm     2475: .Xr strftime 3 ,
                   2476: character pairs are replaced, and UTF-8 is dependent on the
                   2477: .Ic status-utf8
                   2478: option.
1.62      nicm     2479: .It Ic status-right-attr Ar attributes
1.66      jmc      2480: Set the attribute of the right part of the status line.
1.196     nicm     2481: .It Ic status-right-bg Ar colour
                   2482: Set the background colour of the right part of the status line.
1.62      nicm     2483: .It Ic status-right-fg Ar colour
                   2484: Set the foreground colour of the right part of the status line.
1.1       nicm     2485: .It Ic status-right-length Ar length
                   2486: Set the maximum
                   2487: .Ar length
                   2488: of the right component of the status bar.
                   2489: The default is 40.
1.10      nicm     2490: .It Xo Ic status-utf8
1.56      jmc      2491: .Op Ic on | off
1.10      nicm     2492: .Xc
                   2493: Instruct
                   2494: .Nm
                   2495: to treat top-bit-set characters in the
                   2496: .Ic status-left
                   2497: and
                   2498: .Ic status-right
                   2499: strings as UTF-8; notably, this is important for wide characters.
                   2500: This option defaults to off.
1.55      jmc      2501: .It Ic terminal-overrides Ar string
1.54      nicm     2502: Contains a list of entries which override terminal descriptions read using
                   2503: .Xr terminfo 5 .
                   2504: .Ar string
                   2505: is a comma-separated list of items each a colon-separated string made up of a
                   2506: terminal type pattern (matched using
                   2507: .Xr fnmatch 3 )
                   2508: and a set of
                   2509: .Em name=value
                   2510: entries.
                   2511: .Pp
                   2512: For example, to set the
                   2513: .Ql clear
                   2514: .Xr terminfo 5
                   2515: entry to
                   2516: .Ql \ee[H\ee[2J
                   2517: for all terminal types and the
                   2518: .Ql dch1
                   2519: entry to
                   2520: .Ql \ee[P
1.55      jmc      2521: for the
1.54      nicm     2522: .Ql rxvt
                   2523: terminal type, the option could be set to the string:
                   2524: .Bd -literal -offset indent
                   2525: "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
                   2526: .Ed
                   2527: .Pp
                   2528: The terminal entry value is passed through
                   2529: .Xr strunvis 3
                   2530: before interpretation.
                   2531: The default value forcibly corrects the
                   2532: .Ql colors
                   2533: entry for terminals which support 88 or 256 colours:
                   2534: .Bd -literal -offset indent
1.225     nicm     2535: "*88col*:colors=88,*256col*:colors=256,xterm*:XT"
1.54      nicm     2536: .Ed
1.63      nicm     2537: .It Ic update-environment Ar variables
                   2538: Set a space-separated string containing a list of environment variables to be
                   2539: copied into the session environment when a new session is created or an
                   2540: existing session is attached.
                   2541: Any variables that do not exist in the source environment are set to be
                   2542: removed from the session environment (as if
                   2543: .Fl r
                   2544: was given to the
                   2545: .Ic set-environment
                   2546: command).
                   2547: The default is
1.190     nicm     2548: "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
                   2549: XAUTHORITY".
1.37      nicm     2550: .It Xo Ic visual-activity
1.56      jmc      2551: .Op Ic on | off
1.37      nicm     2552: .Xc
                   2553: If on, display a status line message when activity occurs in a window
1.39      jmc      2554: for which the
1.37      nicm     2555: .Ic monitor-activity
                   2556: window option is enabled.
                   2557: .It Xo Ic visual-bell
1.56      jmc      2558: .Op Ic on | off
1.37      nicm     2559: .Xc
                   2560: If this option is on, a message is shown on a bell instead of it being passed
                   2561: through to the terminal (which normally makes a sound).
                   2562: Also see the
                   2563: .Ic bell-action
                   2564: option.
                   2565: .It Xo Ic visual-content
1.56      jmc      2566: .Op Ic on | off
1.37      nicm     2567: .Xc
                   2568: Like
                   2569: .Ic visual-activity ,
                   2570: display a message when content is present in a window
1.39      jmc      2571: for which the
1.37      nicm     2572: .Ic monitor-content
                   2573: window option is enabled.
1.192     nicm     2574: .It Xo Ic visual-silence
                   2575: .Op Ic on | off
                   2576: .Xc
                   2577: If
                   2578: .Ic monitor-silence
                   2579: is enabled, prints a message after the interval has expired on a given window.
1.255     nicm     2580: .It Ic word-separators Ar string
                   2581: Sets the session's conception of what characters are considered word
                   2582: separators, for the purposes of the next and previous word commands in
                   2583: copy mode.
                   2584: The default is
                   2585: .Ql \ -_@ .
1.1       nicm     2586: .El
                   2587: .It Xo Ic set-window-option
1.281     nicm     2588: .Op Fl agqu
1.1       nicm     2589: .Op Fl t Ar target-window
                   2590: .Ar option Ar value
                   2591: .Xc
                   2592: .D1 (alias: Ic setw )
1.18      nicm     2593: Set a window option.
1.1       nicm     2594: The
1.58      nicm     2595: .Fl a ,
1.281     nicm     2596: .Fl g ,
                   2597: .Fl q
1.1       nicm     2598: and
                   2599: .Fl u
                   2600: flags work similarly to the
                   2601: .Ic set-option
                   2602: command.
                   2603: .Pp
1.18      nicm     2604: Supported window options are:
1.56      jmc      2605: .Pp
                   2606: .Bl -tag -width Ds -compact
1.1       nicm     2607: .It Xo Ic aggressive-resize
1.56      jmc      2608: .Op Ic on | off
1.1       nicm     2609: .Xc
                   2610: Aggressively resize the chosen window.
                   2611: This means that
                   2612: .Nm
                   2613: will resize the window to the size of the smallest session for which it is the
                   2614: current window, rather than the smallest session to which it is attached.
                   2615: The window may resize when the current window is changed on another sessions;
1.6       jmc      2616: this option is good for full-screen programs which support
                   2617: .Dv SIGWINCH
                   2618: and poor for interactive programs such as shells.
1.262     nicm     2619: .Pp
                   2620: .It Xo Ic allow-rename
                   2621: .Op Ic on | off
                   2622: .Xc
                   2623: Allow programs to change the window name using a terminal escape
                   2624: sequence (\\033k...\\033\\\\).
                   2625: The default is on.
1.56      jmc      2626: .Pp
1.196     nicm     2627: .It Xo Ic alternate-screen
                   2628: .Op Ic on | off
                   2629: .Xc
                   2630: This option configures whether programs running inside
                   2631: .Nm
                   2632: may use the terminal alternate screen feature, which allows the
                   2633: .Em smcup
                   2634: and
                   2635: .Em rmcup
                   2636: .Xr terminfo 5
1.209     nicm     2637: capabilities.
                   2638: The alternate screen feature preserves the contents of the window when an
                   2639: interactive application starts and restores it on exit, so that any output
                   2640: visible before the application starts reappears unchanged after it exits.
                   2641: The default is on.
1.196     nicm     2642: .Pp
1.1       nicm     2643: .It Xo Ic automatic-rename
1.56      jmc      2644: .Op Ic on | off
1.1       nicm     2645: .Xc
                   2646: Control automatic window renaming.
                   2647: When this setting is enabled,
                   2648: .Nm
                   2649: will attempt - on supported platforms - to rename the window to reflect the
                   2650: command currently running in it.
                   2651: This flag is automatically disabled for an individual window when a name
                   2652: is specified at creation with
1.186     nicm     2653: .Ic new-window
                   2654: or
1.1       nicm     2655: .Ic new-session ,
                   2656: or later with
1.261     nicm     2657: .Ic rename-window ,
                   2658: or with a terminal escape sequence.
1.1       nicm     2659: It may be switched off globally with:
                   2660: .Bd -literal -offset indent
                   2661: set-window-option -g automatic-rename off
                   2662: .Ed
1.283     nicm     2663: .Pp
                   2664: .It Ic c0-change-interval Ar interval
                   2665: .It Ic c0-change-trigger Ar trigger
                   2666: These two options configure a simple form of rate limiting for a pane.
                   2667: If
                   2668: .Nm
                   2669: sees more than
                   2670: .Ar trigger
                   2671: C0 sequences that modify the screen (for example, carriage returns, linefeeds
                   2672: or backspaces) in one millisecond, it will stop updating the pane immediately and
                   2673: instead redraw it entirely every
                   2674: .Ar interval
                   2675: milliseconds.
                   2676: This helps to prevent fast output (such as
                   2677: .Xr yes 1
                   2678: overwhelming the terminal).
1.284     nicm     2679: The default is a trigger of 250 and an interval of 100.
1.283     nicm     2680: A trigger of zero disables the rate limiting.
1.56      jmc      2681: .Pp
1.1       nicm     2682: .It Ic clock-mode-colour Ar colour
                   2683: Set clock colour.
1.56      jmc      2684: .Pp
1.1       nicm     2685: .It Xo Ic clock-mode-style
1.56      jmc      2686: .Op Ic 12 | 24
1.1       nicm     2687: .Xc
                   2688: Set clock hour format.
1.56      jmc      2689: .Pp
1.1       nicm     2690: .It Ic force-height Ar height
                   2691: .It Ic force-width Ar width
                   2692: Prevent
                   2693: .Nm
                   2694: from resizing a window to greater than
                   2695: .Ar width
                   2696: or
                   2697: .Ar height .
                   2698: A value of zero restores the default unlimited setting.
1.56      jmc      2699: .Pp
1.196     nicm     2700: .It Ic main-pane-height Ar height
1.2       nicm     2701: .It Ic main-pane-width Ar width
                   2702: Set the width or height of the main (left or top) pane in the
                   2703: .Ic main-horizontal
                   2704: or
                   2705: .Ic main-vertical
                   2706: layouts.
1.56      jmc      2707: .Pp
1.1       nicm     2708: .It Ic mode-attr Ar attributes
                   2709: Set window modes attributes.
1.56      jmc      2710: .Pp
1.1       nicm     2711: .It Ic mode-bg Ar colour
                   2712: Set window modes background colour.
1.56      jmc      2713: .Pp
1.1       nicm     2714: .It Ic mode-fg Ar colour
                   2715: Set window modes foreground colour.
1.56      jmc      2716: .Pp
1.1       nicm     2717: .It Xo Ic mode-keys
1.56      jmc      2718: .Op Ic vi | emacs
1.1       nicm     2719: .Xc
1.105     nicm     2720: Use vi or emacs-style key bindings in copy and choice modes.
1.191     nicm     2721: As with the
                   2722: .Ic status-keys
                   2723: option, the default is emacs, unless
                   2724: .Ev VISUAL
                   2725: or
                   2726: .Ev EDITOR
                   2727: contains
                   2728: .Ql vi .
1.56      jmc      2729: .Pp
1.50      nicm     2730: .It Xo Ic mode-mouse
1.240     nicm     2731: .Op Ic on | off | copy-mode
1.50      nicm     2732: .Xc
1.51      jmc      2733: Mouse state in modes.
1.223     nicm     2734: If on, the mouse may be used to enter copy mode and copy a selection by
                   2735: dragging, to enter copy mode and scroll with the mouse wheel, or to select an
                   2736: option in choice mode.
1.240     nicm     2737: If set to
1.241     jmc      2738: .Em copy-mode ,
1.240     nicm     2739: the mouse behaves as set to on, but cannot be used to enter copy
                   2740: mode.
1.56      jmc      2741: .Pp
1.1       nicm     2742: .It Xo Ic monitor-activity
1.56      jmc      2743: .Op Ic on | off
1.1       nicm     2744: .Xc
                   2745: Monitor for activity in the window.
                   2746: Windows with activity are highlighted in the status line.
1.56      jmc      2747: .Pp
                   2748: .It Ic monitor-content Ar match-string
1.6       jmc      2749: Monitor content in the window.
                   2750: When
1.16      nicm     2751: .Xr fnmatch 3
                   2752: pattern
1.1       nicm     2753: .Ar match-string
                   2754: appears in the window, it is highlighted in the status line.
1.56      jmc      2755: .Pp
1.192     nicm     2756: .It Xo Ic monitor-silence
                   2757: .Op Ic interval
                   2758: .Xc
                   2759: Monitor for silence (no activity) in the window within
                   2760: .Ic interval
                   2761: seconds.
                   2762: Windows that have been silent for the interval are highlighted in the
                   2763: status line.
                   2764: An interval of zero disables the monitoring.
1.195     nicm     2765: .Pp
                   2766: .It Ic other-pane-height Ar height
                   2767: Set the height of the other panes (not the main pane) in the
                   2768: .Ic main-horizontal
                   2769: layout.
                   2770: If this option is set to 0 (the default), it will have no effect.
                   2771: If both the
                   2772: .Ic main-pane-height
                   2773: and
                   2774: .Ic other-pane-height
                   2775: options are set, the main pane will grow taller to make the other panes the
                   2776: specified height, but will never shrink to do so.
                   2777: .Pp
                   2778: .It Ic other-pane-width Ar width
                   2779: Like
                   2780: .Ic other-pane-height ,
                   2781: but set the width of other panes in the
                   2782: .Ic main-vertical
                   2783: layout.
1.243     nicm     2784: .Pp
                   2785: .It Ic pane-base-index Ar index
                   2786: Like
                   2787: .Ic base-index ,
                   2788: but set the starting index for pane numbers.
1.192     nicm     2789: .Pp
1.1       nicm     2790: .It Xo Ic remain-on-exit
1.56      jmc      2791: .Op Ic on | off
1.1       nicm     2792: .Xc
                   2793: A window with this flag set is not destroyed when the program running in it
                   2794: exits.
                   2795: The window may be reactivated with the
                   2796: .Ic respawn-window
                   2797: command.
1.56      jmc      2798: .Pp
1.99      nicm     2799: .It Xo Ic synchronize-panes
                   2800: .Op Ic on | off
                   2801: .Xc
1.164     nicm     2802: Duplicate input to any pane to all other panes in the same window (only
                   2803: for panes that are not in any special mode).
1.139     nicm     2804: .Pp
1.1       nicm     2805: .It Xo Ic utf8
1.56      jmc      2806: .Op Ic on | off
1.1       nicm     2807: .Xc
                   2808: Instructs
                   2809: .Nm
                   2810: to expect UTF-8 sequences to appear in this window.
1.56      jmc      2811: .Pp
1.264     nicm     2812: .It Ic window-status-bell-attr Ar attributes
                   2813: Set status line attributes for windows which have a bell alert.
1.169     nicm     2814: .Pp
1.264     nicm     2815: .It Ic window-status-bell-bg Ar colour
                   2816: Set status line background colour for windows with a bell alert.
1.169     nicm     2817: .Pp
1.264     nicm     2818: .It Ic window-status-bell-fg Ar colour
                   2819: Set status line foreground colour for windows with a bell alert.
                   2820: .Pp
                   2821: .It Ic window-status-content-attr Ar attributes
                   2822: Set status line attributes for windows which have a content alert.
                   2823: .Pp
                   2824: .It Ic window-status-content-bg Ar colour
                   2825: Set status line background colour for windows with a content alert.
                   2826: .Pp
                   2827: .It Ic window-status-content-fg Ar colour
                   2828: Set status line foreground colour for windows with a content alert.
                   2829: .Pp
                   2830: .It Ic window-status-activity-attr Ar attributes
                   2831: Set status line attributes for windows which have an activity (or silence) alert.
                   2832: .Pp
                   2833: .It Ic window-status-activity-bg Ar colour
                   2834: Set status line background colour for windows with an activity alert.
                   2835: .Pp
                   2836: .It Ic window-status-activity-fg Ar colour
                   2837: Set status line foreground colour for windows with an activity alert.
1.125     nicm     2838: .Pp
1.239     nicm     2839: .It Ic window-status-attr Ar attributes
                   2840: Set status line attributes for a single window.
                   2841: .Pp
                   2842: .It Ic window-status-bg Ar colour
                   2843: Set status line background colour for a single window.
                   2844: .Pp
1.40      nicm     2845: .It Ic window-status-current-attr Ar attributes
                   2846: Set status line attributes for the currently active window.
1.56      jmc      2847: .Pp
1.40      nicm     2848: .It Ic window-status-current-bg Ar colour
                   2849: Set status line background colour for the currently active window.
1.56      jmc      2850: .Pp
1.40      nicm     2851: .It Ic window-status-current-fg Ar colour
                   2852: Set status line foreground colour for the currently active window.
1.56      jmc      2853: .Pp
1.125     nicm     2854: .It Ic window-status-current-format Ar string
                   2855: Like
                   2856: .Ar window-status-format ,
                   2857: but is the format used when the window is the current window.
1.307     nicm     2858: .Pp
                   2859: .It Ic window-status-last-attr Ar attributes
                   2860: Set status line attributes for the last active window.
                   2861: .Pp
                   2862: .It Ic window-status-last-bg Ar colour
                   2863: Set status line background colour for the last active window.
                   2864: .Pp
                   2865: .It Ic window-status-last-fg Ar colour
                   2866: Set status line foreground colour for the last active window.
1.239     nicm     2867: .Pp
                   2868: .It Ic window-status-fg Ar colour
                   2869: Set status line foreground colour for a single window.
                   2870: .Pp
                   2871: .It Ic window-status-format Ar string
                   2872: Set the format in which the window is displayed in the status line window list.
                   2873: See the
                   2874: .Ar status-left
                   2875: option for details of special character sequences available.
                   2876: The default is
                   2877: .Ql #I:#W#F .
1.290     nicm     2878: .Pp
                   2879: .It Ic window-status-separator Ar string
                   2880: Sets the separator drawn between windows in the status line.
                   2881: The default is a single space character.
1.125     nicm     2882: .Pp
1.1       nicm     2883: .It Xo Ic xterm-keys
1.56      jmc      2884: .Op Ic on | off
1.1       nicm     2885: .Xc
                   2886: If this option is set,
                   2887: .Nm
                   2888: will generate
1.57      jmc      2889: .Xr xterm 1 -style
                   2890: function key sequences; these have a number included to indicate modifiers such
                   2891: as Shift, Alt or Ctrl.
1.123     nicm     2892: The default is off.
1.282     nicm     2893: .Pp
                   2894: .It Xo Ic wrap-search
                   2895: .Op Ic on | off
                   2896: .Xc
                   2897: If this option is set, searches will wrap around the end of the pane contents.
                   2898: The default is on.
1.57      jmc      2899: .El
                   2900: .It Xo Ic show-options
1.317     nicm     2901: .Op Fl gsvw
1.129     nicm     2902: .Op Fl t Ar target-session | Ar target-window
1.276     nicm     2903: .Op Ar option
1.57      jmc      2904: .Xc
                   2905: .D1 (alias: Ic show )
1.276     nicm     2906: Show the window options (or a single window option if given) with
1.129     nicm     2907: .Fl w
1.133     nicm     2908: (equivalent to
1.134     nicm     2909: .Ic show-window-options ) ,
1.133     nicm     2910: the server options with
                   2911: .Fl s ,
                   2912: otherwise the session options for
                   2913: .Ar target session .
                   2914: Global session or window options are listed if
                   2915: .Fl g
                   2916: is used.
1.317     nicm     2917: .Fl v
                   2918: shows only the option value, not the name.
1.57      jmc      2919: .It Xo Ic show-window-options
1.317     nicm     2920: .Op Fl gv
1.57      jmc      2921: .Op Fl t Ar target-window
1.276     nicm     2922: .Op Ar option
1.57      jmc      2923: .Xc
                   2924: .D1 (alias: Ic showw )
1.276     nicm     2925: List the window options or a single option for
1.57      jmc      2926: .Ar target-window ,
                   2927: or the global window options if
                   2928: .Fl g
                   2929: is used.
1.317     nicm     2930: .Fl v
                   2931: shows only the option value, not the name.
1.63      nicm     2932: .El
1.245     nicm     2933: .Sh FORMATS
1.294     nicm     2934: Certain commands accept the
1.245     nicm     2935: .Fl F
                   2936: flag with a
                   2937: .Ar format
                   2938: argument.
                   2939: This is a string which controls the output format of the command.
                   2940: Special character sequences are replaced as documented under the
                   2941: .Ic status-left
                   2942: option and an additional long form is accepted.
                   2943: Replacement variables are enclosed in
                   2944: .Ql #{
                   2945: and
                   2946: .Ql } ,
                   2947: for example
                   2948: .Ql #{session_name}
                   2949: is equivalent to
                   2950: .Ql #S .
                   2951: Conditionals are also accepted by prefixing with
1.246     jmc      2952: .Ql \&?
1.245     nicm     2953: and separating two alternatives with a comma;
                   2954: if the specified variable exists and is not zero, the first alternative
1.246     jmc      2955: is chosen, otherwise the second is used.
                   2956: For example
1.245     nicm     2957: .Ql #{?session_attached,attached,not attached}
                   2958: will include the string
                   2959: .Ql attached
                   2960: if the session is attached and the string
                   2961: .Ql not attached
                   2962: if it is unattached.
                   2963: .Pp
                   2964: The following variables are available, where appropriate:
                   2965: .Bl -column "session_created_string" "Replaced with" -offset indent
                   2966: .It Sy "Variable name" Ta Sy "Replaced with"
1.294     nicm     2967: .It Li "buffer_sample" Ta "First 50 characters from the specified buffer"
                   2968: .It Li "buffer_size" Ta "Size of the specified buffer in bytes"
1.250     nicm     2969: .It Li "client_activity" Ta "Integer time client last had activity"
                   2970: .It Li "client_activity_string" Ta "String time client last had activity"
                   2971: .It Li "client_created" Ta "Integer time client created"
                   2972: .It Li "client_created_string" Ta "String time client created"
                   2973: .It Li "client_cwd" Ta "Working directory of client"
                   2974: .It Li "client_height" Ta "Height of client"
1.323     nicm     2975: .It Li "client_last_session" Ta "Name of the client's last session"
1.315     nicm     2976: .It Li "client_prefix" Ta "1 if prefix key has been pressed"
1.250     nicm     2977: .It Li "client_readonly" Ta "1 if client is readonly"
1.323     nicm     2978: .It Li "client_session" Ta "Name of the client's session"
1.250     nicm     2979: .It Li "client_termname" Ta "Terminal name of client"
                   2980: .It Li "client_tty" Ta "Pseudo terminal of client"
                   2981: .It Li "client_utf8" Ta "1 if client supports utf8"
                   2982: .It Li "client_width" Ta "Width of client"
1.245     nicm     2983: .It Li "host" Ta "Hostname of local host"
1.301     nicm     2984: .It Li "history_bytes" Ta "Number of bytes in window history"
                   2985: .It Li "history_limit" Ta "Maximum window history lines"
1.302     nicm     2986: .It Li "history_size" Ta "Size of history in bytes"
1.245     nicm     2987: .It Li "line" Ta "Line number in the list"
                   2988: .It Li "pane_active" Ta "1 if active pane"
1.287     nicm     2989: .It Li "pane_current_path" Ta "Current path if available"
1.245     nicm     2990: .It Li "pane_dead" Ta "1 if pane is dead"
                   2991: .It Li "pane_height" Ta "Height of pane"
1.271     jmc      2992: .It Li "pane_id" Ta "Unique pane ID"
1.300     nicm     2993: .It Li "pane_index" Ta "Index of pane"
1.249     nicm     2994: .It Li "pane_pid" Ta "PID of first process in pane"
                   2995: .It Li "pane_start_command" Ta "Command pane started with"
                   2996: .It Li "pane_start_path" Ta "Path pane started with"
1.245     nicm     2997: .It Li "pane_title" Ta "Title of pane"
1.249     nicm     2998: .It Li "pane_tty" Ta "Pseudo terminal of pane"
1.245     nicm     2999: .It Li "pane_width" Ta "Width of pane"
                   3000: .It Li "session_attached" Ta "1 if session attached"
                   3001: .It Li "session_created" Ta "Integer time session created"
                   3002: .It Li "session_created_string" Ta "String time session created"
                   3003: .It Li "session_group" Ta "Number of session group"
                   3004: .It Li "session_grouped" Ta "1 if session in a group"
                   3005: .It Li "session_height" Ta "Height of session"
                   3006: .It Li "session_name" Ta "Name of session"
                   3007: .It Li "session_width" Ta "Width of session"
                   3008: .It Li "session_windows" Ta "Number of windows in session"
                   3009: .It Li "window_active" Ta "1 if window active"
1.294     nicm     3010: .It Li "window_find_matches" Ta "Matched data from the find-window command if available"
1.245     nicm     3011: .It Li "window_flags" Ta "Window flags"
                   3012: .It Li "window_height" Ta "Height of window"
1.301     nicm     3013: .It Li "window_id" Ta "Unique window ID"
1.245     nicm     3014: .It Li "window_index" Ta "Index of window"
                   3015: .It Li "window_layout" Ta "Window layout description"
                   3016: .It Li "window_name" Ta "Name of window"
1.294     nicm     3017: .It Li "window_panes" Ta "Number of panes in window"
1.245     nicm     3018: .It Li "window_width" Ta "Width of window"
                   3019: .El
1.261     nicm     3020: .Sh NAMES AND TITLES
                   3021: .Nm
                   3022: distinguishes between names and titles.
                   3023: Windows and sessions have names, which may be used to specify them in targets
                   3024: and are displayed in the status line and various lists: the name is the
                   3025: .Nm
                   3026: identifier for a window or session.
                   3027: Only panes have titles.
                   3028: A pane's title is typically set by the program running inside the pane and
                   3029: is not modified by
                   3030: .Nm .
                   3031: It is the same mechanism used to set for example the
                   3032: .Xr xterm 1
                   3033: window title in an
                   3034: .Xr X 7
                   3035: window manager.
1.268     nicm     3036: Windows themselves do not have titles - a window's title is the title of its
1.261     nicm     3037: active pane.
                   3038: .Nm
                   3039: itself may set the title of the terminal in which the client is running, see
                   3040: the
                   3041: .Ic set-titles
                   3042: option.
                   3043: .Pp
                   3044: A session's name is set with the
                   3045: .Ic new-session
                   3046: and
                   3047: .Ic rename-session
                   3048: commands.
                   3049: A window's name is set with one of:
                   3050: .Bl -enum -width Ds
                   3051: .It
                   3052: A command argument (such as
                   3053: .Fl n
                   3054: for
                   3055: .Ic new-window
                   3056: or
                   3057: .Ic new-session ) .
                   3058: .It
                   3059: An escape sequence:
                   3060: .Bd -literal -offset indent
                   3061: $ printf '\e033kWINDOW_NAME\e033\e\e'
                   3062: .Ed
                   3063: .It
                   3064: Automatic renaming, which sets the name to the active command in the window's
                   3065: active pane.
                   3066: See the
                   3067: .Ic automatic-rename
                   3068: option.
                   3069: .El
                   3070: .Pp
                   3071: When a pane is first created, its title is the hostname.
                   3072: A pane's title can be set via the OSC title setting sequence, for example:
                   3073: .Bd -literal -offset indent
                   3074: $ printf '\e033]2;My Title\e033\e\e'
                   3075: .Ed
1.63      nicm     3076: .Sh ENVIRONMENT
                   3077: When the server is started,
                   3078: .Nm
                   3079: copies the environment into the
                   3080: .Em global environment ;
                   3081: in addition, each session has a
                   3082: .Em session environment .
1.193     nicm     3083: When a window is created, the session and global environments are merged.
                   3084: If a variable exists in both, the value from the session environment is used.
                   3085: The result is the initial environment passed to the new process.
1.63      nicm     3086: .Pp
                   3087: The
                   3088: .Ic update-environment
                   3089: session option may be used to update the session environment from the client
                   3090: when a new session is created or an old reattached.
                   3091: .Nm
                   3092: also initialises the
                   3093: .Ev TMUX
                   3094: variable with some internal information to allow commands to be executed
                   3095: from inside, and the
                   3096: .Ev TERM
                   3097: variable with the correct terminal setting of
                   3098: .Ql screen .
                   3099: .Pp
                   3100: Commands to alter and view the environment are:
                   3101: .Bl -tag -width Ds
                   3102: .It Xo Ic set-environment
                   3103: .Op Fl gru
                   3104: .Op Fl t Ar target-session
                   3105: .Ar name Op Ar value
                   3106: .Xc
1.115     nicm     3107: .D1 (alias: Ic setenv )
1.63      nicm     3108: Set or unset an environment variable.
                   3109: If
                   3110: .Fl g
                   3111: is used, the change is made in the global environment; otherwise, it is applied
                   3112: to the session environment for
                   3113: .Ar target-session .
                   3114: The
                   3115: .Fl u
                   3116: flag unsets a variable.
                   3117: .Fl r
                   3118: indicates the variable is to be removed from the environment before starting a
                   3119: new process.
                   3120: .It Xo Ic show-environment
                   3121: .Op Fl g
                   3122: .Op Fl t Ar target-session
1.286     nicm     3123: .Op Ar variable
1.63      nicm     3124: .Xc
1.115     nicm     3125: .D1 (alias: Ic showenv )
1.63      nicm     3126: Display the environment for
                   3127: .Ar target-session
                   3128: or the global environment with
                   3129: .Fl g .
1.286     nicm     3130: If
                   3131: .Ar variable
                   3132: is omitted, all variables are shown.
1.63      nicm     3133: Variables removed from the environment are prefixed with
                   3134: .Ql - .
1.57      jmc      3135: .El
                   3136: .Sh STATUS LINE
                   3137: .Nm
                   3138: includes an optional status line which is displayed in the bottom line of each
                   3139: terminal.
                   3140: By default, the status line is enabled (it may be disabled with the
                   3141: .Ic status
                   3142: session option) and contains, from left-to-right: the name of the current
1.261     nicm     3143: session in square brackets; the window list; the title of the active pane
                   3144: in double quotes; and the time and date.
1.57      jmc      3145: .Pp
                   3146: The status line is made of three parts: configurable left and right sections
                   3147: (which may contain dynamic content such as the time or output from a shell
                   3148: command, see the
                   3149: .Ic status-left ,
                   3150: .Ic status-left-length ,
                   3151: .Ic status-right ,
                   3152: and
                   3153: .Ic status-right-length
                   3154: options below), and a central window list.
1.125     nicm     3155: By default, the window list shows the index, name and (if any) flag of the
                   3156: windows present in the current session in ascending numerical order.
                   3157: It may be customised with the
                   3158: .Ar window-status-format
                   3159: and
                   3160: .Ar window-status-current-format
                   3161: options.
1.57      jmc      3162: The flag is one of the following symbols appended to the window name:
                   3163: .Bl -column "Symbol" "Meaning" -offset indent
                   3164: .It Sy "Symbol" Ta Sy "Meaning"
                   3165: .It Li "*" Ta "Denotes the current window."
                   3166: .It Li "-" Ta "Marks the last window (previously selected)."
                   3167: .It Li "#" Ta "Window is monitored and activity has been detected."
                   3168: .It Li "!" Ta "A bell has occurred in the window."
                   3169: .It Li "+" Ta "Window is monitored for content and it has appeared."
1.192     nicm     3170: .It Li "~" Ta "The window has been silent for the monitor-silence interval."
1.57      jmc      3171: .El
                   3172: .Pp
                   3173: The # symbol relates to the
                   3174: .Ic monitor-activity
                   3175: and + to the
                   3176: .Ic monitor-content
                   3177: window options.
                   3178: The window name is printed in inverted colours if an alert (bell, activity or
                   3179: content) is present.
                   3180: .Pp
1.131     nicm     3181: The colour and attributes of the status line may be configured, the entire
                   3182: status line using the
1.57      jmc      3183: .Ic status-attr ,
                   3184: .Ic status-fg
                   3185: and
                   3186: .Ic status-bg
                   3187: session options and individual windows using the
                   3188: .Ic window-status-attr ,
                   3189: .Ic window-status-fg
                   3190: and
                   3191: .Ic window-status-bg
                   3192: window options.
                   3193: .Pp
1.131     nicm     3194: The status line is automatically refreshed at interval if it has changed, the
                   3195: interval may be controlled with the
1.57      jmc      3196: .Ic status-interval
                   3197: session option.
                   3198: .Pp
                   3199: Commands related to the status line are as follows:
                   3200: .Bl -tag -width Ds
                   3201: .It Xo Ic command-prompt
1.235     nicm     3202: .Op Fl I Ar inputs
1.73      nicm     3203: .Op Fl p Ar prompts
1.57      jmc      3204: .Op Fl t Ar target-client
                   3205: .Op Ar template
                   3206: .Xc
                   3207: Open the command prompt in a client.
                   3208: This may be used from inside
                   3209: .Nm
                   3210: to execute commands interactively.
1.231     nicm     3211: .Pp
1.57      jmc      3212: If
                   3213: .Ar template
1.73      nicm     3214: is specified, it is used as the command.
1.235     nicm     3215: If present,
                   3216: .Fl I
                   3217: is a comma-separated list of the initial text for each prompt.
1.73      nicm     3218: If
                   3219: .Fl p
                   3220: is given,
                   3221: .Ar prompts
                   3222: is a comma-separated list of prompts which are displayed in order; otherwise
                   3223: a single prompt is displayed, constructed from
                   3224: .Ar template
                   3225: if it is present, or
                   3226: .Ql \&:
                   3227: if not.
1.235     nicm     3228: .Pp
                   3229: Both
                   3230: .Ar inputs
                   3231: and
1.231     nicm     3232: .Ar prompts
                   3233: may contain the special character sequences supported by the
                   3234: .Ic status-left
                   3235: option.
                   3236: .Pp
1.73      nicm     3237: Before the command is executed, the first occurrence of the string
                   3238: .Ql %%
1.74      jmc      3239: and all occurrences of
1.73      nicm     3240: .Ql %1
                   3241: are replaced by the response to the first prompt, the second
                   3242: .Ql %%
                   3243: and all
                   3244: .Ql %2
                   3245: are replaced with the response to the second prompt, and so on for further
1.74      jmc      3246: prompts.
                   3247: Up to nine prompt responses may be replaced
                   3248: .Po
                   3249: .Ql %1
1.73      nicm     3250: to
1.74      jmc      3251: .Ql %9
                   3252: .Pc .
1.57      jmc      3253: .It Xo Ic confirm-before
1.238     nicm     3254: .Op Fl p Ar prompt
1.57      jmc      3255: .Op Fl t Ar target-client
                   3256: .Ar command
                   3257: .Xc
                   3258: .D1 (alias: Ic confirm )
                   3259: Ask for confirmation before executing
                   3260: .Ar command .
1.238     nicm     3261: If
                   3262: .Fl p
                   3263: is given,
                   3264: .Ar prompt
                   3265: is the prompt to display; otherwise a prompt is constructed from
                   3266: .Ar command .
                   3267: It may contain the special character sequences supported by the
                   3268: .Ic status-left
                   3269: option.
                   3270: .Pp
1.57      jmc      3271: This command works only from inside
                   3272: .Nm .
                   3273: .It Xo Ic display-message
1.127     nicm     3274: .Op Fl p
1.215     nicm     3275: .Op Fl c Ar target-client
                   3276: .Op Fl t Ar target-pane
1.57      jmc      3277: .Op Ar message
                   3278: .Xc
                   3279: .D1 (alias: Ic display )
1.127     nicm     3280: Display a message.
                   3281: If
                   3282: .Fl p
                   3283: is given, the output is printed to stdout, otherwise it is displayed in the
                   3284: .Ar target-client
                   3285: status line.
1.122     nicm     3286: The format of
1.124     jmc      3287: .Ar message
1.275     nicm     3288: is described in the
                   3289: .Sx FORMATS
                   3290: section; information is taken from
1.215     nicm     3291: .Ar target-pane
                   3292: if
                   3293: .Fl t
                   3294: is given, otherwise the active pane for the session attached to
                   3295: .Ar target-client .
1.57      jmc      3296: .El
                   3297: .Sh BUFFERS
                   3298: .Nm
                   3299: maintains a stack of
1.199     nicm     3300: .Em paste buffers .
1.57      jmc      3301: Up to the value of the
                   3302: .Ic buffer-limit
                   3303: option are kept; when a new buffer is added, the buffer at the bottom of the
                   3304: stack is removed.
                   3305: Buffers may be added using
                   3306: .Ic copy-mode
                   3307: or the
                   3308: .Ic set-buffer
                   3309: command, and pasted into a window using the
                   3310: .Ic paste-buffer
                   3311: command.
                   3312: .Pp
                   3313: A configurable history buffer is also maintained for each window.
                   3314: By default, up to 2000 lines are kept; this can be altered with the
                   3315: .Ic history-limit
                   3316: option (see the
                   3317: .Ic set-option
                   3318: command above).
                   3319: .Pp
                   3320: The buffer commands are as follows:
                   3321: .Bl -tag -width Ds
1.178     nicm     3322: .It Xo
                   3323: .Ic choose-buffer
1.294     nicm     3324: .Op Fl F Ar format
1.178     nicm     3325: .Op Fl t Ar target-window
                   3326: .Op Ar template
                   3327: .Xc
                   3328: Put a window into buffer choice mode, where a buffer may be chosen
                   3329: interactively from a list.
                   3330: After a buffer is selected,
                   3331: .Ql %%
                   3332: is replaced by the buffer index in
                   3333: .Ar template
                   3334: and the result executed as a command.
                   3335: If
                   3336: .Ar template
                   3337: is not given, "paste-buffer -b '%%'" is used.
1.294     nicm     3338: For the meaning of the
                   3339: .Fl F
                   3340: flag, see the
                   3341: .Sx FORMATS
                   3342: section.
1.314     nicm     3343: This command works only if at least one client is attached.
1.57      jmc      3344: .It Ic clear-history Op Fl t Ar target-pane
                   3345: .D1 (alias: Ic clearhist )
                   3346: Remove and free the history for the specified pane.
1.198     nicm     3347: .It Ic delete-buffer Op Fl b Ar buffer-index
1.57      jmc      3348: .D1 (alias: Ic deleteb )
                   3349: Delete the buffer at
                   3350: .Ar buffer-index ,
                   3351: or the top buffer if not specified.
1.294     nicm     3352: .It Xo Ic list-buffers
                   3353: .Op Fl F Ar format
                   3354: .Xc
1.57      jmc      3355: .D1 (alias: Ic lsb )
1.198     nicm     3356: List the global buffers.
1.294     nicm     3357: For the meaning of the
                   3358: .Fl F
                   3359: flag, see the
                   3360: .Sx FORMATS
                   3361: section.
1.200     jmc      3362: .It Xo Ic load-buffer
1.57      jmc      3363: .Op Fl b Ar buffer-index
                   3364: .Ar path
                   3365: .Xc
                   3366: .D1 (alias: Ic loadb )
                   3367: Load the contents of the specified paste buffer from
                   3368: .Ar path .
                   3369: .It Xo Ic paste-buffer
1.278     nicm     3370: .Op Fl dpr
1.57      jmc      3371: .Op Fl b Ar buffer-index
1.170     nicm     3372: .Op Fl s Ar separator
1.158     nicm     3373: .Op Fl t Ar target-pane
1.57      jmc      3374: .Xc
                   3375: .D1 (alias: Ic pasteb )
1.158     nicm     3376: Insert the contents of a paste buffer into the specified pane.
                   3377: If not specified, paste into the current one.
1.57      jmc      3378: With
                   3379: .Fl d ,
                   3380: also delete the paste buffer from the stack.
                   3381: When output, any linefeed (LF) characters in the paste buffer are replaced with
1.170     nicm     3382: a separator, by default carriage return (CR).
                   3383: A custom separator may be specified using the
                   3384: .Fl s
                   3385: flag.
                   3386: The
1.57      jmc      3387: .Fl r
1.170     nicm     3388: flag means to do no replacement (equivalent to a separator of LF).
1.278     nicm     3389: If
                   3390: .Fl p
                   3391: is specified, paste bracket control codes are inserted around the
                   3392: buffer if the application has requested bracketed paste mode.
1.57      jmc      3393: .It Xo Ic save-buffer
                   3394: .Op Fl a
                   3395: .Op Fl b Ar buffer-index
                   3396: .Ar path
                   3397: .Xc
                   3398: .D1 (alias: Ic saveb )
                   3399: Save the contents of the specified paste buffer to
                   3400: .Ar path .
                   3401: The
                   3402: .Fl a
                   3403: option appends to rather than overwriting the file.
                   3404: .It Xo Ic set-buffer
                   3405: .Op Fl b Ar buffer-index
                   3406: .Ar data
                   3407: .Xc
                   3408: .D1 (alias: Ic setb )
                   3409: Set the contents of the specified buffer to
                   3410: .Ar data .
1.1       nicm     3411: .It Xo Ic show-buffer
                   3412: .Op Fl b Ar buffer-index
                   3413: .Xc
                   3414: .D1 (alias: Ic showb )
                   3415: Display the contents of the specified buffer.
1.57      jmc      3416: .El
                   3417: .Sh MISCELLANEOUS
                   3418: Miscellaneous commands are as follows:
                   3419: .Bl -tag -width Ds
1.72      nicm     3420: .It Ic clock-mode Op Fl t Ar target-pane
1.57      jmc      3421: Display a large clock.
1.251     nicm     3422: .It Ic if-shell Ar shell-command command Op Ar command
1.57      jmc      3423: .D1 (alias: Ic if )
1.251     nicm     3424: Execute the first
1.57      jmc      3425: .Ar command
                   3426: if
                   3427: .Ar shell-command
1.251     nicm     3428: returns success or the second
                   3429: .Ar command
                   3430: otherwise.
1.57      jmc      3431: .It Ic lock-server
                   3432: .D1 (alias: Ic lock )
1.90      nicm     3433: Lock each client individually by running the command specified by the
                   3434: .Ic lock-command
                   3435: option.
1.308     nicm     3436: .It Xo Ic run-shell
                   3437: .Op Fl t Ar target-pane
                   3438: .Ar shell-command
                   3439: .Xc
1.87      nicm     3440: .D1 (alias: Ic run )
                   3441: Execute
1.153     nicm     3442: .Ar shell-command
1.106     nicm     3443: in the background without creating a window.
1.308     nicm     3444: After it finishes, any output to stdout is displayed in copy mode (in the pane
                   3445: specified by
                   3446: .Fl t
                   3447: or the current pane if omitted).
1.153     nicm     3448: If the command doesn't return success, the exit status is also displayed.
1.57      jmc      3449: .It Ic server-info
                   3450: .D1 (alias: Ic info )
                   3451: Show server information and terminal details.
1.228     nicm     3452: .El
                   3453: .Sh TERMINFO EXTENSIONS
                   3454: .Nm
                   3455: understands some extensions to
                   3456: .Xr terminfo 5 :
                   3457: .Bl -tag -width Ds
1.232     jmc      3458: .It Em Cc , Cr
1.233     nicm     3459: Set the cursor colour.
1.232     jmc      3460: The first takes a single string argument and is used to set the colour;
                   3461: the second takes no arguments and restores the default cursor colour.
                   3462: If set, a sequence such as this may be used
                   3463: to change the cursor colour from inside
                   3464: .Nm :
                   3465: .Bd -literal -offset indent
                   3466: $ printf '\e033]12;red\e033\e\e'
                   3467: .Ed
                   3468: .It Em Cs , Csr
1.230     nicm     3469: Change the cursor style.
1.232     jmc      3470: If set, a sequence such as this may be used
                   3471: to change the cursor to an underline:
1.230     nicm     3472: .Bd -literal -offset indent
                   3473: $ printf '\e033[4 q'
                   3474: .Ed
                   3475: .Pp
                   3476: If
                   3477: .Em Csr
                   3478: is set, it will be used to reset the cursor style instead
                   3479: of
                   3480: .Em Cs .
1.232     jmc      3481: .It Em \&Ms
                   3482: This sequence can be used by
                   3483: .Nm
                   3484: to store the current buffer in the host terminal's selection (clipboard).
                   3485: See the
                   3486: .Em set-clipboard
                   3487: option above and the
                   3488: .Xr xterm 1
                   3489: man page.
1.1       nicm     3490: .El
                   3491: .Sh FILES
1.26      nicm     3492: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1       nicm     3493: .It Pa ~/.tmux.conf
1.6       jmc      3494: Default
1.1       nicm     3495: .Nm
1.6       jmc      3496: configuration file.
1.26      nicm     3497: .It Pa /etc/tmux.conf
                   3498: System-wide configuration file.
1.1       nicm     3499: .El
1.57      jmc      3500: .Sh EXAMPLES
                   3501: To create a new
                   3502: .Nm
                   3503: session running
                   3504: .Xr vi 1 :
                   3505: .Pp
                   3506: .Dl $ tmux new-session vi
                   3507: .Pp
                   3508: Most commands have a shorter form, known as an alias.
                   3509: For new-session, this is
                   3510: .Ic new :
                   3511: .Pp
                   3512: .Dl $ tmux new vi
                   3513: .Pp
                   3514: Alternatively, the shortest unambiguous form of a command is accepted.
                   3515: If there are several options, they are listed:
                   3516: .Bd -literal -offset indent
                   3517: $ tmux n
                   3518: ambiguous command: n, could be: new-session, new-window, next-window
                   3519: .Ed
                   3520: .Pp
                   3521: Within an active session, a new window may be created by typing
                   3522: .Ql C-b c
                   3523: (Ctrl
                   3524: followed by the
                   3525: .Ql b
                   3526: key
                   3527: followed by the
                   3528: .Ql c
                   3529: key).
                   3530: .Pp
                   3531: Windows may be navigated with:
                   3532: .Ql C-b 0
                   3533: (to select window 0),
                   3534: .Ql C-b 1
                   3535: (to select window 1), and so on;
                   3536: .Ql C-b n
                   3537: to select the next window; and
                   3538: .Ql C-b p
                   3539: to select the previous window.
                   3540: .Pp
                   3541: A session may be detached using
                   3542: .Ql C-b d
1.64      nicm     3543: (or by an external event such as
                   3544: .Xr ssh 1
                   3545: disconnection) and reattached with:
1.57      jmc      3546: .Pp
                   3547: .Dl $ tmux attach-session
                   3548: .Pp
                   3549: Typing
                   3550: .Ql C-b \&?
                   3551: lists the current key bindings in the current window; up and down may be used
                   3552: to navigate the list or
                   3553: .Ql q
                   3554: to exit from it.
                   3555: .Pp
                   3556: Commands to be run when the
                   3557: .Nm
                   3558: server is started may be placed in the
                   3559: .Pa ~/.tmux.conf
                   3560: configuration file.
                   3561: Common examples include:
                   3562: .Pp
                   3563: Changing the default prefix key:
                   3564: .Bd -literal -offset indent
                   3565: set-option -g prefix C-a
                   3566: unbind-key C-b
                   3567: bind-key C-a send-prefix
                   3568: .Ed
                   3569: .Pp
                   3570: Turning the status line off, or changing its colour:
                   3571: .Bd -literal -offset indent
                   3572: set-option -g status off
                   3573: set-option -g status-bg blue
                   3574: .Ed
                   3575: .Pp
                   3576: Setting other options, such as the default command,
                   3577: or locking after 30 minutes of inactivity:
                   3578: .Bd -literal -offset indent
                   3579: set-option -g default-command "exec /bin/ksh"
                   3580: set-option -g lock-after-time 1800
                   3581: .Ed
                   3582: .Pp
                   3583: Creating new key bindings:
                   3584: .Bd -literal -offset indent
                   3585: bind-key b set-option status
                   3586: bind-key / command-prompt "split-window 'exec man %%'"
1.73      nicm     3587: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57      jmc      3588: .Ed
1.1       nicm     3589: .Sh SEE ALSO
                   3590: .Xr pty 4
                   3591: .Sh AUTHORS
                   3592: .An Nicholas Marriott Aq nicm@users.sourceforge.net