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

1.217   ! nicm        1: .\" $OpenBSD: tmux.1,v 1.216 2011/04/01 16:59:11 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.217   ! nicm       17: .Dd $Mdocdate: April 1 2011 $
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 .
                    127: The configuration file is a set of
                    128: .Nm
                    129: commands which are executed in sequence when the server is first started.
1.61      nicm      130: .Pp
                    131: If a command in the configuration file fails,
                    132: .Nm
                    133: will report an error and exit without executing further commands.
1.1       nicm      134: .It Fl L Ar socket-name
                    135: .Nm
                    136: stores the server socket in a directory under
1.208     nicm      137: .Pa /tmp
                    138: (or
                    139: .Ev TMPDIR
                    140: if set);
1.1       nicm      141: the default socket is named
                    142: .Em default .
                    143: This option allows a different socket name to be specified, allowing several
                    144: independent
                    145: .Nm
                    146: servers to be run.
                    147: Unlike
                    148: .Fl S
                    149: a full path is not necessary: the sockets are all created in the same
                    150: directory.
1.2       nicm      151: .Pp
                    152: If the socket is accidentally removed, the
1.6       jmc       153: .Dv SIGUSR1
1.2       nicm      154: signal may be sent to the
                    155: .Nm
                    156: server process to recreate it.
1.166     sobrado   157: .It Fl l
                    158: Behave as a login shell.
                    159: This flag currently has no effect and is for compatibility with other shells
                    160: when using tmux as a login shell.
1.4       sobrado   161: .It Fl q
1.133     nicm      162: Set the
                    163: .Ic quiet
                    164: server option to prevent the server sending various informational messages.
1.1       nicm      165: .It Fl S Ar socket-path
                    166: Specify a full alternative path to the server socket.
                    167: If
                    168: .Fl S
                    169: is specified, the default socket directory is not used and any
                    170: .Fl L
                    171: flag is ignored.
                    172: .It Fl u
                    173: .Nm
1.14      nicm      174: attempts to guess if the terminal is likely to support UTF-8 by checking the
                    175: first of the
                    176: .Ev LC_ALL ,
                    177: .Ev LC_CTYPE
                    178: and
1.2       nicm      179: .Ev LANG
1.14      nicm      180: environment variables to be set for the string "UTF-8".
1.5       nicm      181: This is not always correct: the
1.2       nicm      182: .Fl u
                    183: flag explicitly informs
                    184: .Nm
1.6       jmc       185: that UTF-8 is supported.
1.33      nicm      186: .Pp
                    187: If the server is started from a client passed
                    188: .Fl u
                    189: or where UTF-8 is detected, the
                    190: .Ic utf8
                    191: and
                    192: .Ic status-utf8
                    193: options are enabled in the global window and session options respectively.
1.1       nicm      194: .It Fl v
                    195: Request verbose logging.
                    196: This option may be specified multiple times for increasing verbosity.
                    197: Log messages will be saved into
                    198: .Pa tmux-client-PID.log
                    199: and
                    200: .Pa tmux-server-PID.log
                    201: files in the current directory, where
                    202: .Em PID
1.6       jmc       203: is the PID of the server or client process.
1.1       nicm      204: .It Ar command Op Ar flags
                    205: This specifies one of a set of commands used to control
                    206: .Nm ,
1.6       jmc       207: as described in the following sections.
1.59      jmc       208: If no commands are specified, the
1.1       nicm      209: .Ic new-session
                    210: command is assumed.
1.57      jmc       211: .El
1.64      nicm      212: .Sh KEY BINDINGS
                    213: .Nm
                    214: may be controlled from an attached client by using a key combination of a
                    215: prefix key,
                    216: .Ql C-b
                    217: (Ctrl-b) by default, followed by a command key.
                    218: .Pp
1.172     nicm      219: The default command key bindings are:
1.64      nicm      220: .Pp
1.171     nicm      221: .Bl -tag -width "XXXXXXXXXX" -offset indent -compact
                    222: .It C-b
                    223: Send the prefix key (C-b) through to the application.
                    224: .It C-o
                    225: Rotate the panes in the current window forwards.
                    226: .It C-z
                    227: Suspend the
                    228: .Nm
                    229: client.
                    230: .It !
                    231: Break the current pane out of the window.
                    232: .It \&"
                    233: Split the current pane into two, top and bottom.
                    234: .It #
                    235: List all paste buffers.
                    236: .It %
                    237: Split the current pane into two, left and right.
                    238: .It &
                    239: Kill the current window.
                    240: .It '
                    241: Prompt for a window index to select.
                    242: .It ,
                    243: Rename the current window.
                    244: .It -
                    245: Delete the most recently copied buffer of text.
                    246: .It .
                    247: Prompt for an index to move the current window.
                    248: .It 0 to 9
                    249: Select windows 0 to 9.
                    250: .It :
                    251: Enter the
                    252: .Nm
                    253: command prompt.
1.187     nicm      254: .It ;
                    255: Move to the previously active pane.
1.178     nicm      256: .It =
                    257: Choose which buffer to paste interactively from a list.
1.171     nicm      258: .It \&?
                    259: List all key bindings.
                    260: .It D
                    261: Choose a client to detach.
1.182     jmc       262: .It \&[
1.171     nicm      263: Enter copy mode to copy text or view the history.
1.182     jmc       264: .It \&]
1.171     nicm      265: Paste the most recently copied buffer of text.
1.64      nicm      266: .It c
1.65      nicm      267: Create a new window.
1.64      nicm      268: .It d
1.65      nicm      269: Detach the current client.
1.171     nicm      270: .It f
                    271: Prompt to search for text in open windows.
                    272: .It i
                    273: Display some information about the current window.
1.64      nicm      274: .It l
1.65      nicm      275: Move to the previously selected window.
1.64      nicm      276: .It n
1.65      nicm      277: Change to the next window.
1.171     nicm      278: .It o
                    279: Select the next pane in the current window.
1.64      nicm      280: .It p
1.65      nicm      281: Change to the previous window.
1.171     nicm      282: .It q
                    283: Briefly display pane indexes.
                    284: .It r
                    285: Force redraw of the attached client.
                    286: .It s
                    287: Select a new session for the attached client interactively.
1.194     nicm      288: .It L
                    289: Switch the attached client back to the last session.
1.171     nicm      290: .It t
                    291: Show the time.
                    292: .It w
                    293: Choose the current window interactively.
                    294: .It x
                    295: Kill the current pane.
                    296: .It {
                    297: Swap the current pane with the previous pane.
                    298: .It }
                    299: Swap the current pane with the next pane.
                    300: .It ~
                    301: Show previous messages from
                    302: .Nm ,
                    303: if any.
                    304: .It Page Up
                    305: Enter copy mode and scroll one page up.
                    306: .It Up, Down
                    307: .It Left, Right
                    308: Change to the pane above, below, to the left, or to the right of the current
                    309: pane.
                    310: .It M-1 to M-5
                    311: Arrange panes in one of the five preset layouts: even-horizontal,
                    312: even-vertical, main-horizontal, main-vertical, or tiled.
                    313: .It M-n
                    314: Move to the next window with a bell or activity marker.
                    315: .It M-o
                    316: Rotate the panes in the current window backwards.
                    317: .It M-p
                    318: Move to the previous window with a bell or activity marker.
                    319: .It C-Up, C-Down
                    320: .It C-Left, C-Right
                    321: Resize the current pane in steps of one cell.
                    322: .It M-Up, M-Down
                    323: .It M-Left, M-Right
                    324: Resize the current pane in steps of five cells.
1.64      nicm      325: .El
                    326: .Pp
                    327: Key bindings may be changed with the
                    328: .Ic bind-key
                    329: and
                    330: .Ic unbind-key
                    331: commands.
1.57      jmc       332: .Sh COMMANDS
                    333: This section contains a list of the commands supported by
                    334: .Nm .
                    335: Most commands accept the optional
                    336: .Fl t
                    337: argument with one of
                    338: .Ar target-client ,
                    339: .Ar target-session
                    340: .Ar target-window ,
                    341: or
                    342: .Ar target-pane .
                    343: These specify the client, session, window or pane which a command should affect.
                    344: .Ar target-client
                    345: is the name of the
                    346: .Xr pty 4
                    347: file to which the client is connected, for example either of
                    348: .Pa /dev/ttyp1
                    349: or
                    350: .Pa ttyp1
                    351: for the client attached to
                    352: .Pa /dev/ttyp1 .
                    353: If no client is specified, the current client is chosen, if possible, or an
                    354: error is reported.
                    355: Clients may be listed with the
                    356: .Ic list-clients
                    357: command.
1.1       nicm      358: .Pp
1.57      jmc       359: .Ar target-session
                    360: is either the name of a session (as listed by the
                    361: .Ic list-sessions
                    362: command) or the name of a client with the same syntax as
                    363: .Ar target-client ,
                    364: in which case the session attached to the client is used.
                    365: When looking for the session name,
                    366: .Nm
                    367: initially searches for an exact match; if none is found, the session names
                    368: are checked for any for which
                    369: .Ar target-session
                    370: is a prefix or for which it matches as an
                    371: .Xr fnmatch 3
                    372: pattern.
                    373: If a single match is found, it is used as the target session; multiple matches
                    374: produce an error.
                    375: If a session is omitted, the current session is used if available; if no
1.117     nicm      376: current session is available, the most recently used is chosen.
1.1       nicm      377: .Pp
1.57      jmc       378: .Ar target-window
                    379: specifies a window in the form
                    380: .Em session Ns \&: Ns Em window .
                    381: .Em session
                    382: follows the same rules as for
                    383: .Ar target-session ,
                    384: and
                    385: .Em window
                    386: is looked for in order: as a window index, for example mysession:1; as an exact
                    387: window name, such as mysession:mywindow; then as an
                    388: .Xr fnmatch 3
                    389: pattern or the start of a window name, such as mysession:mywin* or
                    390: mysession:mywin.
                    391: An empty window name specifies the next unused index if appropriate (for
                    392: example the
                    393: .Ic new-window
                    394: and
                    395: .Ic link-window
                    396: commands)
                    397: otherwise the current window in
                    398: .Em session
                    399: is chosen.
1.140     nicm      400: The special character
                    401: .Ql \&!
                    402: uses the last (previously current) window, or
                    403: .Ql +
                    404: and
                    405: .Ql -
                    406: are the next window or the previous window by number.
1.57      jmc       407: When the argument does not contain a colon,
                    408: .Nm
                    409: first attempts to parse it as window; if that fails, an attempt is made to
                    410: match a session.
1.1       nicm      411: .Pp
1.57      jmc       412: .Ar target-pane
                    413: takes a similar form to
                    414: .Ar target-window
                    415: but with the optional addition of a period followed by a pane index, for
                    416: example: mysession:mywindow.1.
                    417: If the pane index is omitted, the currently active pane in the specified
                    418: window is used.
                    419: If neither a colon nor period appears,
1.13      nicm      420: .Nm
1.57      jmc       421: first attempts to use the argument as a pane index; if that fails, it is looked
                    422: up as for
                    423: .Ar target-window .
1.156     nicm      424: A
                    425: .Ql +
                    426: or
                    427: .Ql -
                    428: indicate the next or previous pane index, respectively.
1.132     nicm      429: One of the strings
                    430: .Em top ,
                    431: .Em bottom ,
                    432: .Em left ,
                    433: .Em right ,
                    434: .Em top-left ,
                    435: .Em top-right ,
1.216     nicm      436: .Em bottom-left
                    437: or
1.132     nicm      438: .Em bottom-right
                    439: may be used instead of a pane index.
1.177     nicm      440: .Pp
                    441: The special characters
                    442: .Ql +
                    443: and
                    444: .Ql -
                    445: may be followed by an offset, for example:
                    446: .Bd -literal -offset indent
                    447: select-window -t:+2
                    448: .Ed
                    449: .Pp
                    450: When dealing with a session that doesn't contain sequential window indexes,
                    451: they will be correctly skipped.
1.212     nicm      452: .Pp
                    453: .Nm
                    454: also gives each pane created in a server an identifier consisting of a
                    455: .Ql %
                    456: and a number, starting from zero.
                    457: A pane's identifier is unique for the life of the
                    458: .Nm
                    459: server and is passed to the child process of the pane in the
                    460: .Ev TMUX_PANE
                    461: environment variable.
                    462: It may be used alone to target a pane or the window containing it.
1.15      jmc       463: .Pp
1.153     nicm      464: .Ar shell-command
                    465: arguments are
                    466: .Xr sh 1
                    467: commands.
                    468: These must be passed as a single item, which typically means quoting them, for
                    469: example:
                    470: .Bd -literal -offset indent
                    471: new-window 'vi /etc/passwd'
                    472: .Ed
                    473: .Pp
                    474: .Ar command
                    475: .Op Ar arguments
                    476: refers to a
                    477: .Nm
                    478: command, passed with the command and arguments separately, for example:
                    479: .Bd -literal -offset indent
                    480: bind-key F1 set-window-option force-width 81
                    481: .Ed
                    482: .Pp
                    483: Or if using
                    484: .Xr sh 1 :
                    485: .Bd -literal -offset indent
                    486: $ tmux bind-key F1 set-window-option force-width 81
                    487: .Ed
                    488: .Pp
1.57      jmc       489: Multiple commands may be specified together as part of a
                    490: .Em command sequence .
                    491: Each command should be separated by spaces and a semicolon;
                    492: commands are executed sequentially from left to right.
                    493: A literal semicolon may be included by escaping it with a backslash (for
                    494: example, when specifying a command sequence to
                    495: .Ic bind-key ) .
1.13      nicm      496: .Pp
1.153     nicm      497: Example
                    498: .Nm
                    499: commands include:
1.13      nicm      500: .Bd -literal -offset indent
1.57      jmc       501: refresh-client -t/dev/ttyp2
                    502:
                    503: rename-session -tfirst newname
                    504:
                    505: set-window-option -t:0 monitor-activity on
                    506:
                    507: new-window ; split-window -d
1.13      nicm      508: .Ed
1.153     nicm      509: .Pp
                    510: Or from
                    511: .Xr sh 1 :
                    512: .Bd -literal -offset indent
                    513: $ tmux kill-window -t :1
                    514:
1.159     jmc       515: $ tmux new-window \e; split-window -d
1.153     nicm      516:
1.159     jmc       517: $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
1.153     nicm      518: .Ed
1.57      jmc       519: .Sh CLIENTS AND SESSIONS
1.153     nicm      520: The
                    521: .Nm
                    522: server manages clients, sessions, windows and panes.
                    523: Clients are attached to sessions to interact with them, either
                    524: when they are created with the
                    525: .Ic new-session
                    526: command, or later with the
                    527: .Ic attach-session
                    528: command.
1.188     nicm      529: Each session has one or more windows
1.153     nicm      530: .Em linked
                    531: into it.
                    532: Windows may be linked to multiple sessions and are made up of one or
                    533: more panes,
                    534: each of which contains a pseudo terminal.
                    535: Commands for creating, linking and otherwise manipulating windows
                    536: are covered
                    537: in the
                    538: .Sx WINDOWS AND PANES
                    539: section.
                    540: .Pp
                    541: The following commands are available to manage clients and sessions:
1.57      jmc       542: .Bl -tag -width Ds
                    543: .It Xo Ic attach-session
1.148     nicm      544: .Op Fl dr
1.57      jmc       545: .Op Fl t Ar target-session
                    546: .Xc
                    547: .D1 (alias: Ic attach )
                    548: If run from outside
                    549: .Nm ,
                    550: create a new client in the current terminal and attach it to
                    551: .Ar target-session .
                    552: If used from inside, switch the current client.
                    553: If
                    554: .Fl d
                    555: is specified, any other clients attached to the session are detached.
1.148     nicm      556: .Fl r
                    557: signifies the client is read-only (only keys bound to the
                    558: .Ic detach-client
                    559: command have any effect)
1.13      nicm      560: .Pp
1.57      jmc       561: If no server is started,
                    562: .Ic attach-session
                    563: will attempt to start it; this will fail unless sessions are created in the
                    564: configuration file.
1.217   ! nicm      565: .Pp
        !           566: The
        !           567: .Ar target-session
        !           568: rules for
        !           569: .Ic attach-session
        !           570: are slightly adjusted: if
        !           571: .Nm
        !           572: needs to select the most recently used session, it will prefer the most
        !           573: recently used
        !           574: .Em unattached
        !           575: session.
1.211     nicm      576: .It Xo Ic detach-client
                    577: .Op Fl P
                    578: .Op Fl t Ar target-client
                    579: .Xc
1.57      jmc       580: .D1 (alias: Ic detach )
                    581: Detach the current client if bound to a key, or the specified client with
                    582: .Fl t .
1.211     nicm      583: If
                    584: .Fl P
                    585: is given, send SIGHUP to the parent process of the client, typically causing it
                    586: to exit.
1.57      jmc       587: .It Ic has-session Op Fl t Ar target-session
                    588: .D1 (alias: Ic has )
                    589: Report an error and exit with 1 if the specified session does not exist.
                    590: If it does exist, exit with 0.
                    591: .It Ic kill-server
                    592: Kill the
1.1       nicm      593: .Nm
1.57      jmc       594: server and clients and destroy all sessions.
                    595: .It Ic kill-session Op Fl t Ar target-session
                    596: Destroy the given session, closing any windows linked to it and no other
                    597: sessions, and detaching all clients attached to it.
                    598: .It Ic list-clients
                    599: .D1 (alias: Ic lsc )
                    600: List all clients attached to the server.
                    601: .It Ic list-commands
                    602: .D1 (alias: Ic lscm )
                    603: List the syntax of all commands supported by
                    604: .Nm .
                    605: .It Ic list-sessions
                    606: .D1 (alias: Ic ls )
                    607: List all sessions managed by the server.
1.175     nicm      608: .It Ic lock-client Op Fl t Ar target-client
                    609: .D1 (alias: Ic lockc )
1.92      nicm      610: Lock
                    611: .Ar target-client ,
                    612: see the
                    613: .Ic lock-server
                    614: command.
1.175     nicm      615: .It Ic lock-session Op Fl t Ar target-session
                    616: .D1 (alias: Ic locks )
1.92      nicm      617: Lock all clients attached to
                    618: .Ar target-session .
1.57      jmc       619: .It Xo Ic new-session
                    620: .Op Fl d
                    621: .Op Fl n Ar window-name
                    622: .Op Fl s Ar session-name
1.101     nicm      623: .Op Fl t Ar target-session
1.210     nicm      624: .Op Fl x Ar width
                    625: .Op Fl y Ar height
1.153     nicm      626: .Op Ar shell-command
1.57      jmc       627: .Xc
                    628: .D1 (alias: Ic new )
                    629: Create a new session with name
                    630: .Ar session-name .
1.153     nicm      631: .Pp
1.57      jmc       632: The new session is attached to the current terminal unless
                    633: .Fl d
                    634: is given.
                    635: .Ar window-name
1.1       nicm      636: and
1.153     nicm      637: .Ar shell-command
                    638: are the name of and shell command to execute in the initial window.
1.210     nicm      639: If
                    640: .Fl d
                    641: is used,
                    642: .Fl x
                    643: and
                    644: .Fl y
                    645: specify the size of the initial window (80 by 24 if not given).
1.68      nicm      646: .Pp
                    647: If run from a terminal, any
                    648: .Xr termios 4
                    649: special characters are saved and used for new windows in the new session.
1.101     nicm      650: .Pp
                    651: If
                    652: .Fl t
                    653: is given, the new session is
                    654: .Em grouped
                    655: with
                    656: .Ar target-session .
                    657: This means they share the same set of windows - all windows from
                    658: .Ar target-session
                    659: are linked to the new session and any subsequent new windows or windows being
                    660: closed are applied to both sessions.
                    661: The current and previous window and any session options remain independent and
                    662: either session may be killed without affecting the other.
                    663: Giving
                    664: .Fl n
                    665: or
1.153     nicm      666: .Ar shell-command
1.101     nicm      667: are invalid if
                    668: .Fl t
                    669: is used.
1.57      jmc       670: .It Ic refresh-client Op Fl t Ar target-client
                    671: .D1 (alias: Ic refresh )
                    672: Refresh the current client if bound to a key, or a single client if one is given
                    673: with
                    674: .Fl t .
                    675: .It Xo Ic rename-session
                    676: .Op Fl t Ar target-session
                    677: .Ar new-name
                    678: .Xc
                    679: .D1 (alias: Ic rename )
                    680: Rename the session to
                    681: .Ar new-name .
1.121     nicm      682: .It Xo Ic show-messages
1.120     nicm      683: .Op Fl t Ar target-client
                    684: .Xc
                    685: .D1 (alias: Ic showmsgs )
                    686: Any messages displayed on the status line are saved in a per-client message
                    687: log, up to a maximum of the limit set by the
                    688: .Ar message-limit
                    689: session option for the session attached to that client.
                    690: This command displays the log for
                    691: .Ar target-client .
1.57      jmc       692: .It Ic source-file Ar path
                    693: .D1 (alias: Ic source )
                    694: Execute commands from
                    695: .Ar path .
                    696: .It Ic start-server
                    697: .D1 (alias: Ic start )
                    698: Start the
1.1       nicm      699: .Nm
1.57      jmc       700: server, if not already running, without creating any sessions.
                    701: .It Xo Ic suspend-client
1.202     nicm      702: .Op Fl t Ar target-client
1.57      jmc       703: .Xc
                    704: .D1 (alias: Ic suspendc )
                    705: Suspend a client by sending
                    706: .Dv SIGTSTP
                    707: (tty stop).
                    708: .It Xo Ic switch-client
1.194     nicm      709: .Op Fl lnp
1.57      jmc       710: .Op Fl c Ar target-client
                    711: .Op Fl t Ar target-session
                    712: .Xc
                    713: .D1 (alias: Ic switchc )
                    714: Switch the current session for client
                    715: .Ar target-client
                    716: to
                    717: .Ar target-session .
1.183     nicm      718: If
1.197     jmc       719: .Fl l ,
1.183     nicm      720: .Fl n
                    721: or
                    722: .Fl p
1.194     nicm      723: is used, the client is moved to the last, next or previous session
                    724: respectively.
1.57      jmc       725: .El
                    726: .Sh WINDOWS AND PANES
1.1       nicm      727: A
                    728: .Nm
                    729: window may be in one of several modes.
                    730: The default permits direct access to the terminal attached to the window.
1.164     nicm      731: The other is copy mode, which permits a section of a window or its
                    732: history to be copied to a
1.1       nicm      733: .Em paste buffer
                    734: for later insertion into another window.
                    735: This mode is entered with the
                    736: .Ic copy-mode
                    737: command, bound to
1.113     nicm      738: .Ql \&[
1.1       nicm      739: by default.
1.164     nicm      740: It is also entered when a command that produces output, such as
                    741: .Ic list-keys ,
                    742: is executed from a key binding.
1.1       nicm      743: .Pp
1.6       jmc       744: The keys available depend on whether emacs or vi mode is selected
                    745: (see the
1.1       nicm      746: .Ic mode-keys
                    747: option).
                    748: The following keys are supported as appropriate for the mode:
1.157     nicm      749: .Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
1.1       nicm      750: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
1.27      nicm      751: .It Li "Back to indentation" Ta "^" Ta "M-m"
1.142     nicm      752: .It Li "Bottom of history" Ta "G" Ta "M-<"
1.1       nicm      753: .It Li "Clear selection" Ta "Escape" Ta "C-g"
                    754: .It Li "Copy selection" Ta "Enter" Ta "M-w"
                    755: .It Li "Cursor down" Ta "j" Ta "Down"
1.70      nicm      756: .It Li "Cursor left" Ta "h" Ta "Left"
                    757: .It Li "Cursor right" Ta "l" Ta "Right"
1.116     nicm      758: .It Li "Cursor to bottom line" Ta "L" Ta ""
                    759: .It Li "Cursor to middle line" Ta "M" Ta "M-r"
                    760: .It Li "Cursor to top line" Ta "H" Ta "M-R"
1.70      nicm      761: .It Li "Cursor up" Ta "k" Ta "Up"
1.71      nicm      762: .It Li "Delete entire line" Ta "d" Ta "C-u"
1.70      nicm      763: .It Li "Delete to end of line" Ta "D" Ta "C-k"
1.1       nicm      764: .It Li "End of line" Ta "$" Ta "C-e"
1.142     nicm      765: .It Li "Go to line" Ta ":" Ta "g"
1.116     nicm      766: .It Li "Half page down" Ta "C-d" Ta "M-Down"
                    767: .It Li "Half page up" Ta "C-u" Ta "M-Up"
1.157     nicm      768: .It Li "Jump forward" Ta "f" Ta "f"
                    769: .It Li "Jump backward" Ta "F" Ta "F"
                    770: .It Li "Jump again" Ta ";" Ta ";"
                    771: .It Li "Jump again in reverse" Ta "," Ta ","
1.1       nicm      772: .It Li "Next page" Ta "C-f" Ta "Page down"
1.146     nicm      773: .It Li "Next space" Ta "W" Ta ""
                    774: .It Li "Next space, end of word" Ta "E" Ta ""
1.143     nicm      775: .It Li "Next word" Ta "w" Ta ""
                    776: .It Li "Next word end" Ta "e" Ta "M-f"
1.70      nicm      777: .It Li "Paste buffer" Ta "p" Ta "C-y"
1.116     nicm      778: .It Li "Previous page" Ta "C-b" Ta "Page up"
1.1       nicm      779: .It Li "Previous word" Ta "b" Ta "M-b"
1.146     nicm      780: .It Li "Previous space" Ta "B" Ta ""
1.1       nicm      781: .It Li "Quit mode" Ta "q" Ta "Escape"
1.147     nicm      782: .It Li "Rectangle toggle" Ta "v" Ta "R"
1.141     nicm      783: .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
                    784: .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
1.70      nicm      785: .It Li "Search again" Ta "n" Ta "n"
1.152     nicm      786: .It Li "Search again in reverse" Ta "N" Ta "N"
1.70      nicm      787: .It Li "Search backward" Ta "?" Ta "C-r"
                    788: .It Li "Search forward" Ta "/" Ta "C-s"
                    789: .It Li "Start of line" Ta "0" Ta "C-a"
1.1       nicm      790: .It Li "Start selection" Ta "Space" Ta "C-Space"
1.142     nicm      791: .It Li "Top of history" Ta "g" Ta "M->"
1.80      nicm      792: .It Li "Transpose chars" Ta "" Ta "C-t"
1.1       nicm      793: .El
1.146     nicm      794: .Pp
                    795: The next and previous word keys use space and the
                    796: .Ql - ,
1.154     nicm      797: .Ql _
1.146     nicm      798: and
                    799: .Ql @
1.154     nicm      800: characters as word delimiters by default, but this can be adjusted by
                    801: setting the
                    802: .Em word-separators
                    803: window option.
1.146     nicm      804: Next word moves to the start of the next word, next word end to the end of the
                    805: next word and previous word to the start of the previous word.
                    806: The three next and previous space keys work similarly but use a space alone as
                    807: the word separator.
1.157     nicm      808: .Pp
                    809: The jump commands enable quick movement within a line.
                    810: For instance, typing
                    811: .Ql f
                    812: followed by
                    813: .Ql /
                    814: will move the cursor to the next
                    815: .Ql /
                    816: character on the current line.
                    817: A
                    818: .Ql \&;
                    819: will then jump to the next occurrence.
1.1       nicm      820: .Pp
1.155     nicm      821: Commands in copy mode may be prefaced by an optional repeat count.
                    822: With vi key bindings, a prefix is entered using the number keys; with
                    823: emacs, the Alt (meta) key and a number begins prefix entry.
                    824: For example, to move the cursor forward by ten words, use
                    825: .Ql M-1 0 M-f
                    826: in emacs mode, and
                    827: .Ql 10w
                    828: in vi.
                    829: .Pp
                    830: Mode key bindings are defined in a set of named tables:
1.48      nicm      831: .Em vi-edit
                    832: and
                    833: .Em emacs-edit
                    834: for keys used when line editing at the command prompt;
                    835: .Em vi-choice
                    836: and
                    837: .Em emacs-choice
                    838: for keys used when choosing from lists (such as produced by the
1.144     nicm      839: .Ic choose-window
1.164     nicm      840: command); and
1.48      nicm      841: .Em vi-copy
                    842: and
                    843: .Em emacs-copy
1.97      nicm      844: used in copy mode.
1.48      nicm      845: The tables may be viewed with the
                    846: .Ic list-keys
1.49      nicm      847: command and keys modified or removed with
                    848: .Ic bind-key
                    849: and
                    850: .Ic unbind-key .
1.48      nicm      851: .Pp
1.2       nicm      852: The paste buffer key pastes the first line from the top paste buffer on the
                    853: stack.
1.57      jmc       854: .Pp
1.164     nicm      855: The synopsis for the
                    856: .Ic copy-mode
                    857: command is:
1.57      jmc       858: .Bl -tag -width Ds
                    859: .It Xo Ic copy-mode
                    860: .Op Fl u
1.72      nicm      861: .Op Fl t Ar target-pane
1.57      jmc       862: .Xc
                    863: Enter copy mode.
                    864: The
                    865: .Fl u
                    866: option scrolls one page up.
                    867: .El
1.18      nicm      868: .Pp
1.1       nicm      869: Each window displayed by
                    870: .Nm
                    871: may be split into one or more
                    872: .Em panes ;
                    873: each pane takes up a certain area of the display and is a separate terminal.
                    874: A window may be split into panes using the
                    875: .Ic split-window
                    876: command.
1.38      nicm      877: Windows may be split horizontally (with the
                    878: .Fl h
                    879: flag) or vertically.
                    880: Panes may be resized with the
                    881: .Ic resize-pane
1.1       nicm      882: command (bound to
1.38      nicm      883: .Ql C-up ,
                    884: .Ql C-down
                    885: .Ql C-left
                    886: and
                    887: .Ql C-right
1.1       nicm      888: by default), the current pane may be changed with the
1.156     nicm      889: .Ic select-pane
                    890: command and the
1.1       nicm      891: .Ic rotate-window
                    892: and
                    893: .Ic swap-pane
1.38      nicm      894: commands may be used to swap panes without changing their position.
                    895: Panes are numbered beginning from zero in the order they are created.
                    896: .Pp
                    897: A number of preset
                    898: .Em layouts
                    899: are available.
                    900: These may be selected with the
                    901: .Ic select-layout
                    902: command or cycled with
                    903: .Ic next-layout
                    904: (bound to
1.149     nicm      905: .Ql Space
1.131     nicm      906: by default); once a layout is chosen, panes within it may be moved and resized
                    907: as normal.
1.1       nicm      908: .Pp
                    909: The following layouts are supported:
                    910: .Bl -tag -width Ds
                    911: .It Ic even-horizontal
                    912: Panes are spread out evenly from left to right across the window.
                    913: .It Ic even-vertical
                    914: Panes are spread evenly from top to bottom.
1.2       nicm      915: .It Ic main-horizontal
1.131     nicm      916: A large (main) pane is shown at the top of the window and the remaining panes
                    917: are spread from left to right in the leftover space at the bottom.
1.2       nicm      918: Use the
                    919: .Em main-pane-height
                    920: window option to specify the height of the top pane.
1.1       nicm      921: .It Ic main-vertical
1.2       nicm      922: Similar to
                    923: .Ic main-horizontal
                    924: but the large pane is placed on the left and the others spread from top to
                    925: bottom along the right.
                    926: See the
                    927: .Em main-pane-width
                    928: window option.
1.165     nicm      929: .It Ic tiled
                    930: Panes are spread out as evenly as possible over the window in both rows and
                    931: columns.
1.1       nicm      932: .El
1.8       nicm      933: .Pp
1.181     nicm      934: In addition,
                    935: .Ic select-layout
                    936: may be used to apply a previously used layout - the
                    937: .Ic list-windows
                    938: command displays the layout of each window in a form suitable for use with
                    939: .Ic select-layout .
                    940: For example:
                    941: .Bd -literal -offset indent
                    942: $ tmux list-windows
                    943: 0: ksh [159x48]
                    944:     layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
                    945: $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
                    946: .Ed
1.196     nicm      947: .Pp
1.181     nicm      948: .Nm
                    949: automatically adjusts the size of the layout for the current window size.
                    950: Note that a layout cannot be applied to a window with more panes than that
                    951: from which the layout was originally defined.
                    952: .Pp
1.57      jmc       953: Commands related to windows and panes are as follows:
                    954: .Bl -tag -width Ds
                    955: .It Xo Ic break-pane
                    956: .Op Fl d
                    957: .Op Fl t Ar target-pane
                    958: .Xc
                    959: .D1 (alias: Ic breakp )
                    960: Break
                    961: .Ar target-pane
                    962: off from its containing window to make it the only pane in a new window.
                    963: If
                    964: .Fl d
                    965: is given, the new window does not become the current window.
1.128     nicm      966: .It Xo Ic capture-pane
                    967: .Op Fl b Ar buffer-index
1.213     nicm      968: .Op Fl E Ar end-line
                    969: .Op Fl S Ar start-line
1.128     nicm      970: .Op Fl t Ar target-pane
                    971: .Xc
                    972: .D1 (alias: Ic capturep )
                    973: Capture the contents of a pane to the specified buffer, or a new buffer if none
                    974: is specified.
1.213     nicm      975: .Pp
                    976: .Fl S
                    977: and
                    978: .Fl E
                    979: specify the starting and ending line numbers, zero is the first line of the
                    980: visible pane and negative numbers are lines in the history.
                    981: The default is to capture only the visible contents of the pane.
1.76      nicm      982: .It Xo
                    983: .Ic choose-client
                    984: .Op Fl t Ar target-window
                    985: .Op Ar template
                    986: .Xc
                    987: Put a window into client choice mode, allowing a client to be selected
                    988: interactively from a list.
                    989: After a client is chosen,
                    990: .Ql %%
                    991: is replaced by the client
                    992: .Xr pty 4
                    993: path in
                    994: .Ar template
                    995: and the result executed as a command.
                    996: If
                    997: .Ar template
                    998: is not given, "detach-client -t '%%'" is used.
1.57      jmc       999: This command works only from inside
                   1000: .Nm .
1.76      nicm     1001: .It Xo
                   1002: .Ic choose-session
                   1003: .Op Fl t Ar target-window
                   1004: .Op Ar template
                   1005: .Xc
                   1006: Put a window into session choice mode, where a session may be selected
                   1007: interactively from a list.
                   1008: When one is chosen,
                   1009: .Ql %%
                   1010: is replaced by the session name in
                   1011: .Ar template
                   1012: and the result executed as a command.
                   1013: If
                   1014: .Ar template
                   1015: is not given, "switch-client -t '%%'" is used.
                   1016: This command works only from inside
                   1017: .Nm .
                   1018: .It Xo
                   1019: .Ic choose-window
                   1020: .Op Fl t Ar target-window
                   1021: .Op Ar template
                   1022: .Xc
                   1023: Put a window into window choice mode, where a window may be chosen
                   1024: interactively from a list.
                   1025: After a window is selected,
                   1026: .Ql %%
                   1027: is replaced by the session name and window index in
                   1028: .Ar template
                   1029: and the result executed as a command.
                   1030: If
                   1031: .Ar template
                   1032: is not given, "select-window -t '%%'" is used.
1.57      jmc      1033: This command works only from inside
                   1034: .Nm .
1.78      nicm     1035: .It Ic display-panes Op Fl t Ar target-client
                   1036: .D1 (alias: Ic displayp)
                   1037: Display a visible indicator of each pane shown by
                   1038: .Ar target-client .
                   1039: See the
1.145     nicm     1040: .Ic display-panes-time ,
                   1041: .Ic display-panes-colour ,
1.78      nicm     1042: and
1.145     nicm     1043: .Ic display-panes-active-colour
1.78      nicm     1044: session options.
1.84      nicm     1045: While the indicator is on screen, a pane may be selected with the
                   1046: .Ql 0
                   1047: to
                   1048: .Ql 9
                   1049: keys.
1.57      jmc      1050: .It Xo Ic find-window
                   1051: .Op Fl t Ar target-window
                   1052: .Ar match-string
                   1053: .Xc
                   1054: .D1 (alias: Ic findw )
                   1055: Search for the
                   1056: .Xr fnmatch 3
                   1057: pattern
                   1058: .Ar match-string
                   1059: in window names, titles, and visible content (but not history).
                   1060: If only one window is matched, it'll be automatically selected, otherwise a
                   1061: choice list is shown.
                   1062: This command only works from inside
1.1       nicm     1063: .Nm .
1.137     nicm     1064: .It Xo Ic join-pane
                   1065: .Op Fl dhv
                   1066: .Oo Fl l
                   1067: .Ar size |
                   1068: .Fl p Ar percentage Oc
                   1069: .Op Fl s Ar src-pane
                   1070: .Op Fl t Ar dst-pane
                   1071: .Xc
                   1072: .D1 (alias: Ic joinp )
                   1073: Like
                   1074: .Ic split-window ,
                   1075: but instead of splitting
                   1076: .Ar dst-pane
                   1077: and creating a new pane, split it and move
                   1078: .Ar src-pane
                   1079: into the space.
                   1080: This can be used to reverse
                   1081: .Ic break-pane .
1.112     nicm     1082: .It Xo Ic kill-pane
                   1083: .Op Fl a
                   1084: .Op Fl t Ar target-pane
                   1085: .Xc
1.57      jmc      1086: .D1 (alias: Ic killp )
                   1087: Destroy the given pane.
                   1088: If no panes remain in the containing window, it is also destroyed.
1.112     nicm     1089: The
                   1090: .Fl a
                   1091: option kills all but the pane given with
                   1092: .Fl t .
1.57      jmc      1093: .It Ic kill-window Op Fl t Ar target-window
                   1094: .D1 (alias: Ic killw )
                   1095: Kill the current window or the window at
                   1096: .Ar target-window ,
1.1       nicm     1097: removing it from any sessions to which it is linked.
1.187     nicm     1098: .It Ic last-pane Op Fl t Ar target-window
                   1099: .D1 (alias: Ic lastp )
                   1100: Select the last (previously selected) pane.
1.56      jmc      1101: .It Ic last-window Op Fl t Ar target-session
1.1       nicm     1102: .D1 (alias: Ic last )
                   1103: Select the last (previously selected) window.
                   1104: If no
                   1105: .Ar target-session
                   1106: is specified, select the last window of the current session.
                   1107: .It Xo Ic link-window
                   1108: .Op Fl dk
                   1109: .Op Fl s Ar src-window
                   1110: .Op Fl t Ar dst-window
                   1111: .Xc
                   1112: .D1 (alias: Ic linkw )
                   1113: Link the window at
                   1114: .Ar src-window
                   1115: to the specified
                   1116: .Ar dst-window .
                   1117: If
                   1118: .Ar dst-window
                   1119: is specified and no such window exists, the
                   1120: .Ar src-window
                   1121: is linked there.
                   1122: If
                   1123: .Fl k
                   1124: is given and
                   1125: .Ar dst-window
                   1126: exists, it is killed, otherwise an error is generated.
                   1127: If
                   1128: .Fl d
                   1129: is given, the newly linked window is not selected.
1.214     nicm     1130: .It Xo Ic list-panes
                   1131: .Op Fl as
                   1132: .Op Fl t Ar target
                   1133: .Xc
1.104     nicm     1134: .D1 (alias: Ic lsp )
1.214     nicm     1135: If
                   1136: .Fl a
                   1137: is given,
                   1138: .Ar target
                   1139: is ignored and all panes on the server are listed.
                   1140: If
                   1141: .Fl s
                   1142: is given,
                   1143: .Ar target
                   1144: is a session (or the current session).
                   1145: If neither is given,
                   1146: .Ar target
                   1147: is a window (or the current window).
                   1148: .It Xo Ic list-windows
                   1149: .Op Fl a
                   1150: .Op Fl t Ar target-session
                   1151: .Xc
1.1       nicm     1152: .D1 (alias: Ic lsw )
1.214     nicm     1153: If
                   1154: .Fl a
                   1155: is given, list all windows on the server.
                   1156: Otherwise, list windows in the current session or in
1.1       nicm     1157: .Ar target-session .
                   1158: .It Xo Ic move-window
1.175     nicm     1159: .Op Fl dk
1.1       nicm     1160: .Op Fl s Ar src-window
                   1161: .Op Fl t Ar dst-window
                   1162: .Xc
                   1163: .D1 (alias: Ic movew )
                   1164: This is similar to
                   1165: .Ic link-window ,
                   1166: except the window at
                   1167: .Ar src-window
                   1168: is moved to
                   1169: .Ar dst-window .
                   1170: .It Xo Ic new-window
1.201     nicm     1171: .Op Fl adkP
1.1       nicm     1172: .Op Fl n Ar window-name
                   1173: .Op Fl t Ar target-window
1.153     nicm     1174: .Op Ar shell-command
1.1       nicm     1175: .Xc
                   1176: .D1 (alias: Ic neww )
                   1177: Create a new window.
1.160     nicm     1178: With
                   1179: .Fl a ,
                   1180: the new window is inserted at the next index up from the specified
                   1181: .Ar target-window ,
                   1182: moving windows up if necessary,
                   1183: otherwise
                   1184: .Ar target-window
                   1185: is the new window location.
                   1186: .Pp
1.1       nicm     1187: If
                   1188: .Fl d
                   1189: is given, the session does not make the new window the current window.
                   1190: .Ar target-window
1.28      nicm     1191: represents the window to be created; if the target already exists an error is
                   1192: shown, unless the
                   1193: .Fl k
                   1194: flag is used, in which case it is destroyed.
1.153     nicm     1195: .Ar shell-command
1.1       nicm     1196: is the command to execute.
                   1197: If
1.153     nicm     1198: .Ar shell-command
                   1199: is not specified, the value of the
                   1200: .Ic default-command
                   1201: option is used.
                   1202: .Pp
                   1203: When the shell command completes, the window closes.
                   1204: See the
                   1205: .Ic remain-on-exit
                   1206: option to change this behaviour.
1.1       nicm     1207: .Pp
                   1208: The
                   1209: .Ev TERM
                   1210: environment variable must be set to
                   1211: .Dq screen
                   1212: for all programs running
                   1213: .Em inside
                   1214: .Nm .
                   1215: New windows will automatically have
                   1216: .Dq TERM=screen
                   1217: added to their environment, but care must be taken not to reset this in shell
                   1218: start-up files.
1.201     nicm     1219: .Pp
                   1220: The
                   1221: .Fl P
                   1222: option prints the location of the new window after it has been created.
1.56      jmc      1223: .It Ic next-layout Op Fl t Ar target-window
1.1       nicm     1224: .D1 (alias: Ic nextl )
                   1225: Move a window to the next layout and rearrange the panes to fit.
                   1226: .It Xo Ic next-window
1.9       nicm     1227: .Op Fl a
1.1       nicm     1228: .Op Fl t Ar target-session
                   1229: .Xc
                   1230: .D1 (alias: Ic next )
                   1231: Move to the next window in the session.
1.9       nicm     1232: If
1.12      jmc      1233: .Fl a
1.9       nicm     1234: is used, move to the next window with a bell, activity or content alert.
1.107     nicm     1235: .It Xo Ic pipe-pane
                   1236: .Op Fl o
                   1237: .Op Fl t Ar target-pane
1.153     nicm     1238: .Op Ar shell-command
1.107     nicm     1239: .Xc
                   1240: .D1 (alias: Ic pipep )
                   1241: Pipe any output sent by the program in
                   1242: .Ar target-pane
                   1243: to a shell command.
                   1244: A pane may only be piped to one command at a time, any existing pipe is
                   1245: closed before
1.153     nicm     1246: .Ar shell-command
1.107     nicm     1247: is executed.
1.174     nicm     1248: The
                   1249: .Ar shell-command
                   1250: string may contain the special character sequences supported by the
                   1251: .Ic status-left
                   1252: command.
1.107     nicm     1253: If no
1.153     nicm     1254: .Ar shell-command
1.107     nicm     1255: is given, the current pipe (if any) is closed.
                   1256: .Pp
                   1257: The
                   1258: .Fl o
                   1259: option only opens a new pipe if no previous pipe exists, allowing a pipe to
                   1260: be toggled with a single key, for example:
                   1261: .Bd -literal -offset indent
1.174     nicm     1262: bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1.107     nicm     1263: .Ed
1.176     nicm     1264: .It Xo Ic previous-layout
                   1265: .Op Fl t Ar target-window
                   1266: .Xc
                   1267: .D1 (alias: Ic prevl )
                   1268: Move to the previous layout in the session.
1.1       nicm     1269: .It Xo Ic previous-window
1.9       nicm     1270: .Op Fl a
1.1       nicm     1271: .Op Fl t Ar target-session
                   1272: .Xc
                   1273: .D1 (alias: Ic prev )
                   1274: Move to the previous window in the session.
1.9       nicm     1275: With
                   1276: .Fl a ,
                   1277: move to the previous window with a bell, activity or content alert.
1.1       nicm     1278: .It Xo Ic rename-window
                   1279: .Op Fl t Ar target-window
                   1280: .Ar new-name
                   1281: .Xc
                   1282: .D1 (alias: Ic renamew )
                   1283: Rename the current window, or the window at
                   1284: .Ar target-window
                   1285: if specified, to
                   1286: .Ar new-name .
                   1287: .It Xo Ic resize-pane
1.39      jmc      1288: .Op Fl DLRU
1.52      nicm     1289: .Op Fl t Ar target-pane
1.1       nicm     1290: .Op Ar adjustment
                   1291: .Xc
                   1292: .D1 (alias: Ic resizep )
1.57      jmc      1293: Resize a pane, upward with
                   1294: .Fl U
                   1295: (the default), downward with
                   1296: .Fl D ,
                   1297: to the left with
                   1298: .Fl L
                   1299: and to the right with
                   1300: .Fl R .
                   1301: The
                   1302: .Ar adjustment
                   1303: is given in lines or cells (the default is 1).
                   1304: .It Xo Ic respawn-window
                   1305: .Op Fl k
                   1306: .Op Fl t Ar target-window
1.153     nicm     1307: .Op Ar shell-command
1.57      jmc      1308: .Xc
                   1309: .D1 (alias: Ic respawnw )
1.153     nicm     1310: Reactivate a window in which the command has exited (see the
1.57      jmc      1311: .Ic remain-on-exit
                   1312: window option).
                   1313: If
1.153     nicm     1314: .Ar shell-command
1.57      jmc      1315: is not given, the command used when the window was created is executed.
                   1316: The window must be already inactive, unless
                   1317: .Fl k
                   1318: is given, in which case any existing command is killed.
                   1319: .It Xo Ic rotate-window
                   1320: .Op Fl DU
                   1321: .Op Fl t Ar target-window
                   1322: .Xc
                   1323: .D1 (alias: Ic rotatew )
                   1324: Rotate the positions of the panes within a window, either upward (numerically
                   1325: lower) with
                   1326: .Fl U
                   1327: or downward (numerically higher).
                   1328: .It Xo Ic select-layout
1.204     nicm     1329: .Op Fl np
1.57      jmc      1330: .Op Fl t Ar target-window
                   1331: .Op Ar layout-name
                   1332: .Xc
1.176     nicm     1333: .D1 (alias: Ic selectl )
1.57      jmc      1334: Choose a specific layout for a window.
                   1335: If
                   1336: .Ar layout-name
1.181     nicm     1337: is not given, the last preset layout used (if any) is reapplied.
1.204     nicm     1338: .Fl n
                   1339: and
                   1340: .Fl p
                   1341: are equivalent to the
                   1342: .Ic next-layout
                   1343: and
                   1344: .Ic previous-layout
                   1345: commands.
1.156     nicm     1346: .It Xo Ic select-pane
1.204     nicm     1347: .Op Fl lDLRU
1.156     nicm     1348: .Op Fl t Ar target-pane
                   1349: .Xc
1.57      jmc      1350: .D1 (alias: Ic selectp )
                   1351: Make pane
                   1352: .Ar target-pane
                   1353: the active pane in window
                   1354: .Ar target-window .
1.156     nicm     1355: If one of
                   1356: .Fl D ,
                   1357: .Fl L ,
                   1358: .Fl R ,
                   1359: or
                   1360: .Fl U
                   1361: is used, respectively the pane below, to the left, to the right, or above the
                   1362: target pane is used.
1.204     nicm     1363: .Fl l
                   1364: is the same as using the
                   1365: .Ic last-pane
                   1366: command.
                   1367: .It Xo Ic select-window
                   1368: .Op Fl lnp
                   1369: .Op Fl t Ar target-window
                   1370: .Xc
1.57      jmc      1371: .D1 (alias: Ic selectw )
                   1372: Select the window at
                   1373: .Ar target-window .
1.204     nicm     1374: .Fl l ,
                   1375: .Fl n
                   1376: and
                   1377: .Fl p
                   1378: are equivalent to the
                   1379: .Ic last-window ,
                   1380: .Ic next-window
                   1381: and
                   1382: .Ic previous-window
                   1383: commands.
1.57      jmc      1384: .It Xo Ic split-window
1.201     nicm     1385: .Op Fl dhvP
1.57      jmc      1386: .Oo Fl l
                   1387: .Ar size |
                   1388: .Fl p Ar percentage Oc
1.136     nicm     1389: .Op Fl t Ar target-pane
1.153     nicm     1390: .Op Ar shell-command
1.57      jmc      1391: .Xc
1.176     nicm     1392: .D1 (alias: Ic splitw )
1.136     nicm     1393: Create a new pane by splitting
                   1394: .Ar target-pane :
1.57      jmc      1395: .Fl h
                   1396: does a horizontal split and
                   1397: .Fl v
                   1398: a vertical split; if neither is specified,
                   1399: .Fl v
                   1400: is assumed.
                   1401: The
                   1402: .Fl l
                   1403: and
                   1404: .Fl p
1.136     nicm     1405: options specify the size of the new pane in lines (for vertical split) or in
1.57      jmc      1406: cells (for horizontal split), or as a percentage, respectively.
1.136     nicm     1407: All other options have the same meaning as for the
1.57      jmc      1408: .Ic new-window
                   1409: command.
                   1410: .It Xo Ic swap-pane
                   1411: .Op Fl dDU
                   1412: .Op Fl s Ar src-pane
                   1413: .Op Fl t Ar dst-pane
                   1414: .Xc
                   1415: .D1 (alias: Ic swapp )
                   1416: Swap two panes.
                   1417: If
                   1418: .Fl U
                   1419: is used and no source pane is specified with
                   1420: .Fl s ,
                   1421: .Ar dst-pane
                   1422: is swapped with the previous pane (before it numerically);
                   1423: .Fl D
                   1424: swaps with the next pane (after it numerically).
1.138     nicm     1425: .Fl d
                   1426: instructs
                   1427: .Nm
                   1428: not to change the active pane.
1.57      jmc      1429: .It Xo Ic swap-window
                   1430: .Op Fl d
                   1431: .Op Fl s Ar src-window
                   1432: .Op Fl t Ar dst-window
                   1433: .Xc
                   1434: .D1 (alias: Ic swapw )
                   1435: This is similar to
                   1436: .Ic link-window ,
                   1437: except the source and destination windows are swapped.
                   1438: It is an error if no window exists at
                   1439: .Ar src-window .
                   1440: .It Xo Ic unlink-window
1.1       nicm     1441: .Op Fl k
                   1442: .Op Fl t Ar target-window
                   1443: .Xc
1.57      jmc      1444: .D1 (alias: Ic unlinkw )
                   1445: Unlink
                   1446: .Ar target-window .
                   1447: Unless
                   1448: .Fl k
                   1449: is given, a window may be unlinked only if it is linked to multiple sessions -
                   1450: windows may not be linked to no sessions;
                   1451: if
1.1       nicm     1452: .Fl k
1.57      jmc      1453: is specified and the window is linked to only one session, it is unlinked and
                   1454: destroyed.
                   1455: .El
                   1456: .Sh KEY BINDINGS
1.93      nicm     1457: .Nm
                   1458: allows a command to be bound to most keys, with or without a prefix key.
                   1459: When specifying keys, most represent themselves (for example
                   1460: .Ql A
                   1461: to
1.95      jmc      1462: .Ql Z ) .
1.93      nicm     1463: Ctrl keys may be prefixed with
                   1464: .Ql C-
                   1465: or
1.95      jmc      1466: .Ql ^ ,
                   1467: and Alt (meta) with
1.93      nicm     1468: .Ql M- .
                   1469: In addition, the following special key names are accepted:
1.126     nicm     1470: .Em Up ,
                   1471: .Em Down ,
                   1472: .Em Left ,
                   1473: .Em Right ,
1.93      nicm     1474: .Em BSpace ,
                   1475: .Em BTab ,
                   1476: .Em DC
                   1477: (Delete),
                   1478: .Em End ,
                   1479: .Em Enter ,
                   1480: .Em Escape ,
                   1481: .Em F1
                   1482: to
                   1483: .Em F20 ,
                   1484: .Em Home ,
                   1485: .Em IC
                   1486: (Insert),
                   1487: .Em NPage
                   1488: (Page Up),
                   1489: .Em PPage
                   1490: (Page Down),
                   1491: .Em Space ,
                   1492: and
                   1493: .Em Tab .
                   1494: Note that to bind the
                   1495: .Ql \&"
                   1496: or
                   1497: .Ql '
                   1498: keys, quotation marks are necessary, for example:
                   1499: .Bd -literal -offset indent
                   1500: bind-key '"' split-window
1.167     nicm     1501: bind-key "'" new-window
1.93      nicm     1502: .Ed
                   1503: .Pp
1.57      jmc      1504: Commands related to key bindings are as follows:
                   1505: .Bl -tag -width Ds
                   1506: .It Xo Ic bind-key
                   1507: .Op Fl cnr
                   1508: .Op Fl t Ar key-table
                   1509: .Ar key Ar command Op Ar arguments
1.1       nicm     1510: .Xc
1.57      jmc      1511: .D1 (alias: Ic bind )
                   1512: Bind key
                   1513: .Ar key
                   1514: to
                   1515: .Ar command .
                   1516: By default (without
                   1517: .Fl t )
                   1518: the primary key bindings are modified (those normally activated with the prefix
                   1519: key); in this case, if
                   1520: .Fl n
                   1521: is specified, it is not necessary to use the prefix key,
                   1522: .Ar command
                   1523: is bound to
                   1524: .Ar key
                   1525: alone.
1.1       nicm     1526: The
1.57      jmc      1527: .Fl r
                   1528: flag indicates this key may repeat, see the
                   1529: .Ic repeat-time
                   1530: option.
                   1531: .Pp
                   1532: If
                   1533: .Fl t
                   1534: is present,
                   1535: .Ar key
                   1536: is bound in
                   1537: .Ar key-table :
                   1538: the binding for command mode with
                   1539: .Fl c
                   1540: or for normal mode without.
                   1541: To view the default bindings and possible commands, see the
                   1542: .Ic list-keys
                   1543: command.
                   1544: .It Ic list-keys Op Fl t Ar key-table
                   1545: .D1 (alias: Ic lsk )
                   1546: List all key bindings.
                   1547: Without
                   1548: .Fl t
                   1549: the primary key bindings - those executed when preceded by the prefix key -
                   1550: are printed.
                   1551: Keys bound without the prefix key (see
                   1552: .Ic bind-key
                   1553: .Fl n )
1.119     nicm     1554: are marked with
                   1555: .Ql (no prefix) .
1.57      jmc      1556: .Pp
                   1557: With
                   1558: .Fl t ,
                   1559: the key bindings in
                   1560: .Ar key-table
                   1561: are listed; this may be one of:
                   1562: .Em vi-edit ,
                   1563: .Em emacs-edit ,
                   1564: .Em vi-choice ,
                   1565: .Em emacs-choice ,
                   1566: .Em vi-copy
                   1567: or
                   1568: .Em emacs-copy .
                   1569: .It Xo Ic send-keys
1.72      nicm     1570: .Op Fl t Ar target-pane
1.57      jmc      1571: .Ar key Ar ...
1.1       nicm     1572: .Xc
1.57      jmc      1573: .D1 (alias: Ic send )
                   1574: Send a key or keys to a window.
                   1575: Each argument
                   1576: .Ar key
                   1577: is the name of the key (such as
                   1578: .Ql C-a
                   1579: or
                   1580: .Ql npage
                   1581: ) to send; if the string is not recognised as a key, it is sent as a series of
                   1582: characters.
                   1583: All arguments are sent sequentially from first to last.
1.72      nicm     1584: .It Ic send-prefix Op Fl t Ar target-pane
1.57      jmc      1585: Send the prefix key to a window as if it was pressed.
1.89      nicm     1586: If multiple prefix keys are configured, only the first is sent.
1.57      jmc      1587: .It Xo Ic unbind-key
1.189     nicm     1588: .Op Fl acn
1.57      jmc      1589: .Op Fl t Ar key-table
                   1590: .Ar key
1.2       nicm     1591: .Xc
1.57      jmc      1592: .D1 (alias: Ic unbind )
                   1593: Unbind the command bound to
                   1594: .Ar key .
                   1595: Without
                   1596: .Fl t
                   1597: the primary key bindings are modified; in this case, if
                   1598: .Fl n
                   1599: is specified, the command bound to
                   1600: .Ar key
                   1601: without a prefix (if any) is removed.
1.189     nicm     1602: If
                   1603: .Fl a
                   1604: is present, all key bindings are removed.
1.57      jmc      1605: .Pp
1.47      nicm     1606: If
1.57      jmc      1607: .Fl t
                   1608: is present,
                   1609: .Ar key
                   1610: in
                   1611: .Ar key-table
                   1612: is unbound: the binding for command mode with
                   1613: .Fl c
                   1614: or for normal mode without.
                   1615: .El
                   1616: .Sh OPTIONS
                   1617: The appearance and behaviour of
                   1618: .Nm
                   1619: may be modified by changing the value of various options.
1.133     nicm     1620: There are three types of option:
                   1621: .Em server options ,
1.57      jmc      1622: .Em session options
                   1623: and
                   1624: .Em window options .
                   1625: .Pp
1.133     nicm     1626: The
                   1627: .Nm
                   1628: server has a set of global options which do not apply to any particular
                   1629: window or session.
                   1630: These are altered with the
                   1631: .Ic set-option
                   1632: .Fl s
                   1633: command, or displayed with the
                   1634: .Ic show-options
                   1635: .Fl s
                   1636: command.
                   1637: .Pp
                   1638: In addition, each individual session may have a set of session options, and
                   1639: there is a separate set of global session options.
1.57      jmc      1640: Sessions which do not have a particular option configured inherit the value
                   1641: from the global session options.
                   1642: Session options are set or unset with the
                   1643: .Ic set-option
                   1644: command and may be listed with the
                   1645: .Ic show-options
                   1646: command.
1.133     nicm     1647: The available server and session options are listed under the
1.57      jmc      1648: .Ic set-option
                   1649: command.
                   1650: .Pp
                   1651: Similarly, a set of window options is attached to each window, and there is
                   1652: a set of global window options from which any unset options are inherited.
                   1653: Window options are altered with the
                   1654: .Ic set-window-option
                   1655: command and can be listed with the
                   1656: .Ic show-window-options
                   1657: command.
                   1658: All window options are documented with the
                   1659: .Ic set-window-option
                   1660: command.
                   1661: .Pp
                   1662: Commands which set options are as follows:
                   1663: .Bl -tag -width Ds
1.1       nicm     1664: .It Xo Ic set-option
1.133     nicm     1665: .Op Fl agsuw
1.129     nicm     1666: .Op Fl t Ar target-session | Ar target-window
1.1       nicm     1667: .Ar option Ar value
                   1668: .Xc
                   1669: .D1 (alias: Ic set )
1.133     nicm     1670: Set a window option with
                   1671: .Fl w
                   1672: (equivalent to the
                   1673: .Ic set-window-option
                   1674: command),
                   1675: a server option with
                   1676: .Fl s ,
                   1677: otherwise a session option.
                   1678: .Pp
                   1679: If
                   1680: .Fl g
                   1681: is specified, the global session or window option is set.
1.58      nicm     1682: With
                   1683: .Fl a ,
                   1684: and if the option expects a string,
                   1685: .Ar value
                   1686: is appended to the existing setting.
1.1       nicm     1687: The
                   1688: .Fl u
                   1689: flag unsets an option, so a session inherits the option from the global
1.133     nicm     1690: options.
                   1691: It is not possible to unset a global option.
1.1       nicm     1692: .Pp
1.133     nicm     1693: Available window options are listed under
                   1694: .Ic set-window-option .
                   1695: .Pp
                   1696: Available server options are:
                   1697: .Bl -tag -width Ds
1.198     nicm     1698: .It Ic buffer-limit Ar number
                   1699: Set the number of buffers; as new buffers are added to the top of the stack,
                   1700: old ones are removed from the bottom if necessary to maintain this maximum
                   1701: length.
1.206     nicm     1702: .It Ic escape-time Ar time
1.134     nicm     1703: Set the time in milliseconds for which
                   1704: .Nm
                   1705: waits after an escape is input to determine if it is part of a function or meta
                   1706: key sequences.
                   1707: The default is 500 milliseconds.
1.206     nicm     1708: .It Xo Ic exit-unattached
                   1709: .Op Ic on | off
                   1710: .Xc
1.207     nicm     1711: If enabled, the server will exit when there are no attached clients.
1.206     nicm     1712: .It Xo Ic quiet
                   1713: .Op Ic on | off
                   1714: .Xc
1.134     nicm     1715: Enable or disable the display of various informational messages (see also the
1.133     nicm     1716: .Fl q
                   1717: command line flag).
                   1718: .El
1.129     nicm     1719: .Pp
1.18      nicm     1720: Available session options are:
1.1       nicm     1721: .Bl -tag -width Ds
1.69      nicm     1722: .It Ic base-index Ar index
                   1723: Set the base index from which an unused index should be searched when a new
                   1724: window is created.
                   1725: The default is zero.
1.1       nicm     1726: .It Xo Ic bell-action
1.56      jmc      1727: .Op Ic any | none | current
1.1       nicm     1728: .Xc
                   1729: Set action on window bell.
                   1730: .Ic any
                   1731: means a bell in any window linked to a session causes a bell in the current
                   1732: window of that session,
                   1733: .Ic none
                   1734: means all bells are ignored and
                   1735: .Ic current
                   1736: means only bell in windows other than the current window are ignored.
1.153     nicm     1737: .It Ic default-command Ar shell-command
1.1       nicm     1738: Set the command used for new windows (if not specified when the window is
                   1739: created) to
1.153     nicm     1740: .Ar shell-command ,
1.79      nicm     1741: which may be any
                   1742: .Xr sh 1
                   1743: command.
1.19      nicm     1744: The default is an empty string, which instructs
                   1745: .Nm
1.79      nicm     1746: to create a login shell using the value of the
                   1747: .Ic default-shell
                   1748: option.
1.196     nicm     1749: .It Ic default-path Ar path
                   1750: Set the default working directory for processes created from keys, or
                   1751: interactively from the prompt.
                   1752: The default is empty, which means to use the working directory of the shell
                   1753: from which the server was started if it is available or the user's home if not.
1.79      nicm     1754: .It Ic default-shell Ar path
                   1755: Specify the default shell.
                   1756: This is used as the login shell for new windows when the
                   1757: .Ic default-command
                   1758: option is set to empty, and must be the full path of the executable.
                   1759: When started
                   1760: .Nm
                   1761: tries to set a default value from the first suitable of the
1.19      nicm     1762: .Ev SHELL
1.79      nicm     1763: environment variable, the shell returned by
                   1764: .Xr getpwuid 3 ,
                   1765: or
                   1766: .Pa /bin/sh .
                   1767: This option should be configured when
                   1768: .Nm
                   1769: is used as a login shell.
1.22      nicm     1770: .It Ic default-terminal Ar terminal
                   1771: Set the default terminal for new windows created in this session - the
                   1772: default value of the
                   1773: .Ev TERM
                   1774: environment variable.
                   1775: For
                   1776: .Nm
                   1777: to work correctly, this
                   1778: .Em must
                   1779: be set to
                   1780: .Ql screen
                   1781: or a derivative of it.
1.206     nicm     1782: .It Xo Ic destroy-unattached
                   1783: .Op Ic on | off
                   1784: .Xc
1.185     nicm     1785: If enabled and the session is no longer attached to any clients, it is
                   1786: destroyed.
1.206     nicm     1787: .It Xo Ic detach-on-destroy
                   1788: .Op Ic on | off
                   1789: .Xc
1.184     nicm     1790: If on (the default), the client is detached when the session it is attached to
                   1791: is destroyed.
                   1792: If off, the client is switched to the most recently active of the remaining
                   1793: sessions.
1.145     nicm     1794: .It Ic display-panes-active-colour Ar colour
                   1795: Set the colour used by the
                   1796: .Ic display-panes
                   1797: command to show the indicator for the active pane.
1.78      nicm     1798: .It Ic display-panes-colour Ar colour
1.145     nicm     1799: Set the colour used by the
1.78      nicm     1800: .Ic display-panes
1.145     nicm     1801: command to show the indicators for inactive panes.
1.78      nicm     1802: .It Ic display-panes-time Ar time
                   1803: Set the time in milliseconds for which the indicators shown by the
                   1804: .Ic display-panes
                   1805: command appear.
1.21      nicm     1806: .It Ic display-time Ar time
1.78      nicm     1807: Set the amount of time for which status line messages and other on-screen
                   1808: indicators are displayed.
1.21      nicm     1809: .Ar time
                   1810: is in milliseconds.
1.1       nicm     1811: .It Ic history-limit Ar lines
                   1812: Set the maximum number of lines held in window history.
                   1813: This setting applies only to new windows - existing window histories are not
                   1814: resized and retain the limit at the point they were created.
                   1815: .It Ic lock-after-time Ar number
1.100     nicm     1816: Lock the session (like the
                   1817: .Ic lock-session
1.90      nicm     1818: command) after
1.1       nicm     1819: .Ar number
1.100     nicm     1820: seconds of inactivity, or the entire server (all sessions) if the
                   1821: .Ic lock-server
                   1822: option is set.
                   1823: The default is not to lock (set to 0).
1.153     nicm     1824: .It Ic lock-command Ar shell-command
1.90      nicm     1825: Command to run when locking each client.
                   1826: The default is to run
                   1827: .Xr lock 1
                   1828: with
                   1829: .Fl np .
1.100     nicm     1830: .It Xo Ic lock-server
                   1831: .Op Ic on | off
                   1832: .Xc
                   1833: If this option is
1.102     nicm     1834: .Ic on
1.100     nicm     1835: (the default),
                   1836: instead of each session locking individually as each has been
                   1837: idle for
1.108     jmc      1838: .Ic lock-after-time ,
                   1839: the entire server will lock after
1.100     nicm     1840: .Em all
                   1841: sessions would have locked.
                   1842: This has no effect as a session option; it must be set as a global option.
1.1       nicm     1843: .It Ic message-attr Ar attributes
                   1844: Set status line message attributes, where
                   1845: .Ar attributes
                   1846: is either
1.168     nicm     1847: .Ic none
1.1       nicm     1848: or a comma-delimited list of one or more of:
                   1849: .Ic bright
                   1850: (or
                   1851: .Ic bold ) ,
                   1852: .Ic dim ,
                   1853: .Ic underscore ,
                   1854: .Ic blink ,
                   1855: .Ic reverse ,
                   1856: .Ic hidden ,
                   1857: or
                   1858: .Ic italics .
                   1859: .It Ic message-bg Ar colour
                   1860: Set status line message background colour, where
                   1861: .Ar colour
                   1862: is one of:
                   1863: .Ic black ,
                   1864: .Ic red ,
                   1865: .Ic green ,
                   1866: .Ic yellow ,
                   1867: .Ic blue ,
                   1868: .Ic magenta ,
                   1869: .Ic cyan ,
1.85      nicm     1870: .Ic white ,
                   1871: .Ic colour0
                   1872: to
                   1873: .Ic colour255
1.205     nicm     1874: from the 256-colour set,
                   1875: .Ic default ,
                   1876: or a hexadecimal RGB string such as
                   1877: .Ql #ffffff ,
                   1878: which chooses the closest match from the default 256-colour set.
1.1       nicm     1879: .It Ic message-fg Ar colour
                   1880: Set status line message foreground colour.
1.120     nicm     1881: .It Ic message-limit Ar number
                   1882: Set the number of error or information messages to save in the message log for
                   1883: each client.
                   1884: The default is 20.
1.102     nicm     1885: .It Xo Ic mouse-select-pane
                   1886: .Op Ic on | off
                   1887: .Xc
                   1888: If on,
                   1889: .Nm
                   1890: captures the mouse and when a window is split into multiple panes the mouse may
                   1891: be used to select the current pane.
                   1892: The mouse click is also passed through to the application as normal.
1.196     nicm     1893: .It Ic pane-active-border-bg Ar colour
                   1894: .It Ic pane-active-border-fg Ar colour
                   1895: Set the pane border colour for the currently active pane.
                   1896: .It Ic pane-border-bg Ar colour
1.135     nicm     1897: .It Ic pane-border-fg Ar colour
                   1898: Set the pane border colour for panes aside from the active pane.
1.89      nicm     1899: .It Ic prefix Ar keys
                   1900: Set the keys accepted as a prefix key.
                   1901: .Ar keys
                   1902: is a comma-separated list of key names, each of which individually behave as
                   1903: the prefix key.
1.21      nicm     1904: .It Ic repeat-time Ar time
1.1       nicm     1905: Allow multiple commands to be entered without pressing the prefix-key again
                   1906: in the specified
1.21      nicm     1907: .Ar time
1.1       nicm     1908: milliseconds (the default is 500).
                   1909: Whether a key repeats may be set when it is bound using the
                   1910: .Fl r
                   1911: flag to
                   1912: .Ic bind-key .
1.52      nicm     1913: Repeat is enabled for the default keys bound to the
                   1914: .Ic resize-pane
                   1915: command.
1.203     nicm     1916: .It Xo Ic mouse-utf8
                   1917: .Op Ic on | off
                   1918: .Xc
                   1919: If enabled, request mouse input as UTF-8 on UTF-8 terminals.
1.1       nicm     1920: .It Xo Ic set-remain-on-exit
1.56      jmc      1921: .Op Ic on | off
1.1       nicm     1922: .Xc
                   1923: Set the
                   1924: .Ic remain-on-exit
                   1925: window option for any windows first created in this session.
1.153     nicm     1926: When this option is true, windows in which the running program has
                   1927: exited do not close, instead remaining open but inactivate.
                   1928: Use the
                   1929: .Ic respawn-window
                   1930: command to reactivate such a window, or the
                   1931: .Ic kill-window
                   1932: command to destroy it.
1.1       nicm     1933: .It Xo Ic set-titles
1.56      jmc      1934: .Op Ic on | off
1.1       nicm     1935: .Xc
1.77      stsp     1936: Attempt to set the window title using the \ee]2;...\e007 xterm code if
1.1       nicm     1937: the terminal appears to be an xterm.
1.11      nicm     1938: This option is off by default.
1.6       jmc      1939: Note that elinks
1.1       nicm     1940: will only attempt to set the window title if the STY environment
                   1941: variable is set.
1.86      nicm     1942: .It Ic set-titles-string Ar string
                   1943: String used to set the window title if
                   1944: .Ic set-titles
                   1945: is on.
                   1946: Character sequences are replaced as for the
                   1947: .Ic status-left
                   1948: option.
1.1       nicm     1949: .It Xo Ic status
1.56      jmc      1950: .Op Ic on | off
1.1       nicm     1951: .Xc
                   1952: Show or hide the status line.
                   1953: .It Ic status-attr Ar attributes
                   1954: Set status line attributes.
                   1955: .It Ic status-bg Ar colour
                   1956: Set status line background colour.
                   1957: .It Ic status-fg Ar colour
                   1958: Set status line foreground colour.
                   1959: .It Ic status-interval Ar interval
                   1960: Update the status bar every
                   1961: .Ar interval
                   1962: seconds.
                   1963: By default, updates will occur every 15 seconds.
                   1964: A setting of zero disables redrawing at interval.
1.41      nicm     1965: .It Xo Ic status-justify
1.56      jmc      1966: .Op Ic left | centre | right
1.41      nicm     1967: .Xc
                   1968: Set the position of the window list component of the status line: left, centre
                   1969: or right justified.
1.1       nicm     1970: .It Xo Ic status-keys
1.56      jmc      1971: .Op Ic vi | emacs
1.1       nicm     1972: .Xc
1.6       jmc      1973: Use vi or emacs-style
1.1       nicm     1974: key bindings in the status line, for example at the command prompt.
1.191     nicm     1975: The default is emacs, unless the
                   1976: .Ev VISUAL
                   1977: or
                   1978: .Ev EDITOR
                   1979: environment variables are set and contain the string
                   1980: .Ql vi .
1.1       nicm     1981: .It Ic status-left Ar string
                   1982: Display
                   1983: .Ar string
                   1984: to the left of the status bar.
                   1985: .Ar string
                   1986: will be passed through
                   1987: .Xr strftime 3
                   1988: before being used.
                   1989: By default, the session name is shown.
                   1990: .Ar string
1.83      nicm     1991: may contain any of the following special character sequences:
1.1       nicm     1992: .Bl -column "Character pair" "Replaced with" -offset indent
                   1993: .It Sy "Character pair" Ta Sy "Replaced with"
1.153     nicm     1994: .It Li "#(shell-command)" Ta "First line of the command's output"
1.83      nicm     1995: .It Li "#[attributes]" Ta "Colour or attribute change"
1.1       nicm     1996: .It Li "#H" Ta "Hostname of local host"
1.125     nicm     1997: .It Li "#F" Ta "Current window flag"
1.35      nicm     1998: .It Li "#I" Ta "Current window index"
                   1999: .It Li "#P" Ta "Current pane index"
1.1       nicm     2000: .It Li "#S" Ta "Session name"
                   2001: .It Li "#T" Ta "Current window title"
1.35      nicm     2002: .It Li "#W" Ta "Current window name"
1.1       nicm     2003: .It Li "##" Ta "A literal" Ql #
                   2004: .El
1.83      nicm     2005: .Pp
1.153     nicm     2006: The #(shell-command) form executes
                   2007: .Ql shell-command
                   2008: and inserts the first line of its output.
1.103     nicm     2009: Note that shell commands are only executed once at the interval specified by
                   2010: the
                   2011: .Ic status-interval
                   2012: option: if the status line is redrawn in the meantime, the previous result is
                   2013: used.
1.161     nicm     2014: Shell commands are executed with the
                   2015: .Nm
                   2016: global environment set (see the
1.162     jmc      2017: .Sx ENVIRONMENT
                   2018: section).
1.163     nicm     2019: .Pp
                   2020: The window title (#T) is the title set by the program running within the window
                   2021: using the OSC title setting sequence, for example:
                   2022: .Bd -literal -offset indent
                   2023: $ printf '\e033]2;My Title\e033\e\e'
                   2024: .Ed
                   2025: .Pp
                   2026: When a window is first created, its title is the hostname.
1.109     nicm     2027: .Pp
1.83      nicm     2028: #[attributes] allows a comma-separated list of attributes to be specified,
                   2029: these may be
                   2030: .Ql fg=colour
                   2031: to set the foreground colour,
                   2032: .Ql bg=colour
1.131     nicm     2033: to set the background colour, the name of one of the attributes (listed under
                   2034: the
1.83      nicm     2035: .Ic message-attr
1.109     nicm     2036: option) to turn an attribute on, or an attribute prefixed with
                   2037: .Ql no
                   2038: to turn one off, for example
                   2039: .Ic nobright .
1.83      nicm     2040: Examples are:
                   2041: .Bd -literal -offset indent
                   2042: #(sysctl vm.loadavg)
                   2043: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
                   2044: .Ed
1.1       nicm     2045: .Pp
1.109     nicm     2046: Where appropriate, special character sequences may be prefixed with a number to
                   2047: specify the maximum length, for example
1.1       nicm     2048: .Ql #24T .
1.10      nicm     2049: .Pp
1.12      jmc      2050: By default, UTF-8 in
1.10      nicm     2051: .Ar string
                   2052: is not interpreted, to enable UTF-8, use the
                   2053: .Ic status-utf8
                   2054: option.
1.62      nicm     2055: .It Ic status-left-attr Ar attributes
1.66      jmc      2056: Set the attribute of the left part of the status line.
1.196     nicm     2057: .It Ic status-left-bg Ar colour
                   2058: Set the background colour of the left part of the status line.
1.62      nicm     2059: .It Ic status-left-fg Ar colour
                   2060: Set the foreground colour of the left part of the status line.
1.1       nicm     2061: .It Ic status-left-length Ar length
                   2062: Set the maximum
                   2063: .Ar length
                   2064: of the left component of the status bar.
                   2065: The default is 10.
                   2066: .It Ic status-right Ar string
                   2067: Display
                   2068: .Ar string
                   2069: to the right of the status bar.
1.151     nicm     2070: By default, the current window title in double quotes, the date and the time
                   2071: are shown.
1.1       nicm     2072: As with
                   2073: .Ic status-left ,
                   2074: .Ar string
                   2075: will be passed to
1.10      nicm     2076: .Xr strftime 3 ,
                   2077: character pairs are replaced, and UTF-8 is dependent on the
                   2078: .Ic status-utf8
                   2079: option.
1.62      nicm     2080: .It Ic status-right-attr Ar attributes
1.66      jmc      2081: Set the attribute of the right part of the status line.
1.196     nicm     2082: .It Ic status-right-bg Ar colour
                   2083: Set the background colour of the right part of the status line.
1.62      nicm     2084: .It Ic status-right-fg Ar colour
                   2085: Set the foreground colour of the right part of the status line.
1.1       nicm     2086: .It Ic status-right-length Ar length
                   2087: Set the maximum
                   2088: .Ar length
                   2089: of the right component of the status bar.
                   2090: The default is 40.
1.10      nicm     2091: .It Xo Ic status-utf8
1.56      jmc      2092: .Op Ic on | off
1.10      nicm     2093: .Xc
                   2094: Instruct
                   2095: .Nm
                   2096: to treat top-bit-set characters in the
                   2097: .Ic status-left
                   2098: and
                   2099: .Ic status-right
                   2100: strings as UTF-8; notably, this is important for wide characters.
                   2101: This option defaults to off.
1.55      jmc      2102: .It Ic terminal-overrides Ar string
1.54      nicm     2103: Contains a list of entries which override terminal descriptions read using
                   2104: .Xr terminfo 5 .
                   2105: .Ar string
                   2106: is a comma-separated list of items each a colon-separated string made up of a
                   2107: terminal type pattern (matched using
                   2108: .Xr fnmatch 3 )
                   2109: and a set of
                   2110: .Em name=value
                   2111: entries.
                   2112: .Pp
                   2113: For example, to set the
                   2114: .Ql clear
                   2115: .Xr terminfo 5
                   2116: entry to
                   2117: .Ql \ee[H\ee[2J
                   2118: for all terminal types and the
                   2119: .Ql dch1
                   2120: entry to
                   2121: .Ql \ee[P
1.55      jmc      2122: for the
1.54      nicm     2123: .Ql rxvt
                   2124: terminal type, the option could be set to the string:
                   2125: .Bd -literal -offset indent
                   2126: "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
                   2127: .Ed
                   2128: .Pp
                   2129: The terminal entry value is passed through
                   2130: .Xr strunvis 3
                   2131: before interpretation.
                   2132: The default value forcibly corrects the
                   2133: .Ql colors
                   2134: entry for terminals which support 88 or 256 colours:
                   2135: .Bd -literal -offset indent
                   2136: "*88col*:colors=88,*256col*:colors=256"
                   2137: .Ed
1.63      nicm     2138: .It Ic update-environment Ar variables
                   2139: Set a space-separated string containing a list of environment variables to be
                   2140: copied into the session environment when a new session is created or an
                   2141: existing session is attached.
                   2142: Any variables that do not exist in the source environment are set to be
                   2143: removed from the session environment (as if
                   2144: .Fl r
                   2145: was given to the
                   2146: .Ic set-environment
                   2147: command).
                   2148: The default is
1.190     nicm     2149: "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
                   2150: XAUTHORITY".
1.37      nicm     2151: .It Xo Ic visual-activity
1.56      jmc      2152: .Op Ic on | off
1.37      nicm     2153: .Xc
                   2154: If on, display a status line message when activity occurs in a window
1.39      jmc      2155: for which the
1.37      nicm     2156: .Ic monitor-activity
                   2157: window option is enabled.
                   2158: .It Xo Ic visual-bell
1.56      jmc      2159: .Op Ic on | off
1.37      nicm     2160: .Xc
                   2161: If this option is on, a message is shown on a bell instead of it being passed
                   2162: through to the terminal (which normally makes a sound).
                   2163: Also see the
                   2164: .Ic bell-action
                   2165: option.
                   2166: .It Xo Ic visual-content
1.56      jmc      2167: .Op Ic on | off
1.37      nicm     2168: .Xc
                   2169: Like
                   2170: .Ic visual-activity ,
                   2171: display a message when content is present in a window
1.39      jmc      2172: for which the
1.37      nicm     2173: .Ic monitor-content
                   2174: window option is enabled.
1.192     nicm     2175: .It Xo Ic visual-silence
                   2176: .Op Ic on | off
                   2177: .Xc
                   2178: If
                   2179: .Ic monitor-silence
                   2180: is enabled, prints a message after the interval has expired on a given window.
1.1       nicm     2181: .El
                   2182: .It Xo Ic set-window-option
1.58      nicm     2183: .Op Fl agu
1.1       nicm     2184: .Op Fl t Ar target-window
                   2185: .Ar option Ar value
                   2186: .Xc
                   2187: .D1 (alias: Ic setw )
1.18      nicm     2188: Set a window option.
1.1       nicm     2189: The
1.58      nicm     2190: .Fl a ,
1.1       nicm     2191: .Fl g
                   2192: and
                   2193: .Fl u
                   2194: flags work similarly to the
                   2195: .Ic set-option
                   2196: command.
                   2197: .Pp
1.18      nicm     2198: Supported window options are:
1.56      jmc      2199: .Pp
                   2200: .Bl -tag -width Ds -compact
1.1       nicm     2201: .It Xo Ic aggressive-resize
1.56      jmc      2202: .Op Ic on | off
1.1       nicm     2203: .Xc
                   2204: Aggressively resize the chosen window.
                   2205: This means that
                   2206: .Nm
                   2207: will resize the window to the size of the smallest session for which it is the
                   2208: current window, rather than the smallest session to which it is attached.
                   2209: The window may resize when the current window is changed on another sessions;
1.6       jmc      2210: this option is good for full-screen programs which support
                   2211: .Dv SIGWINCH
                   2212: and poor for interactive programs such as shells.
1.56      jmc      2213: .Pp
1.196     nicm     2214: .It Xo Ic alternate-screen
                   2215: .Op Ic on | off
                   2216: .Xc
                   2217: This option configures whether programs running inside
                   2218: .Nm
                   2219: may use the terminal alternate screen feature, which allows the
                   2220: .Em smcup
                   2221: and
                   2222: .Em rmcup
                   2223: .Xr terminfo 5
1.209     nicm     2224: capabilities.
                   2225: The alternate screen feature preserves the contents of the window when an
                   2226: interactive application starts and restores it on exit, so that any output
                   2227: visible before the application starts reappears unchanged after it exits.
                   2228: The default is on.
1.196     nicm     2229: .Pp
1.1       nicm     2230: .It Xo Ic automatic-rename
1.56      jmc      2231: .Op Ic on | off
1.1       nicm     2232: .Xc
                   2233: Control automatic window renaming.
                   2234: When this setting is enabled,
                   2235: .Nm
                   2236: will attempt - on supported platforms - to rename the window to reflect the
                   2237: command currently running in it.
                   2238: This flag is automatically disabled for an individual window when a name
                   2239: is specified at creation with
1.186     nicm     2240: .Ic new-window
                   2241: or
1.1       nicm     2242: .Ic new-session ,
                   2243: or later with
                   2244: .Ic rename-window .
                   2245: It may be switched off globally with:
                   2246: .Bd -literal -offset indent
                   2247: set-window-option -g automatic-rename off
                   2248: .Ed
1.56      jmc      2249: .Pp
1.1       nicm     2250: .It Ic clock-mode-colour Ar colour
                   2251: Set clock colour.
1.56      jmc      2252: .Pp
1.1       nicm     2253: .It Xo Ic clock-mode-style
1.56      jmc      2254: .Op Ic 12 | 24
1.1       nicm     2255: .Xc
                   2256: Set clock hour format.
1.56      jmc      2257: .Pp
1.1       nicm     2258: .It Ic force-height Ar height
                   2259: .It Ic force-width Ar width
                   2260: Prevent
                   2261: .Nm
                   2262: from resizing a window to greater than
                   2263: .Ar width
                   2264: or
                   2265: .Ar height .
                   2266: A value of zero restores the default unlimited setting.
1.56      jmc      2267: .Pp
1.196     nicm     2268: .It Ic main-pane-height Ar height
1.2       nicm     2269: .It Ic main-pane-width Ar width
                   2270: Set the width or height of the main (left or top) pane in the
                   2271: .Ic main-horizontal
                   2272: or
                   2273: .Ic main-vertical
                   2274: layouts.
1.56      jmc      2275: .Pp
1.1       nicm     2276: .It Ic mode-attr Ar attributes
                   2277: Set window modes attributes.
1.56      jmc      2278: .Pp
1.1       nicm     2279: .It Ic mode-bg Ar colour
                   2280: Set window modes background colour.
1.56      jmc      2281: .Pp
1.1       nicm     2282: .It Ic mode-fg Ar colour
                   2283: Set window modes foreground colour.
1.56      jmc      2284: .Pp
1.1       nicm     2285: .It Xo Ic mode-keys
1.56      jmc      2286: .Op Ic vi | emacs
1.1       nicm     2287: .Xc
1.105     nicm     2288: Use vi or emacs-style key bindings in copy and choice modes.
1.191     nicm     2289: As with the
                   2290: .Ic status-keys
                   2291: option, the default is emacs, unless
                   2292: .Ev VISUAL
                   2293: or
                   2294: .Ev EDITOR
                   2295: contains
                   2296: .Ql vi .
1.56      jmc      2297: .Pp
1.50      nicm     2298: .It Xo Ic mode-mouse
1.56      jmc      2299: .Op Ic on | off
1.50      nicm     2300: .Xc
1.51      jmc      2301: Mouse state in modes.
1.173     nicm     2302: If on, the mouse may be used to copy a selection by dragging in copy mode, or
                   2303: to select an option in choice mode.
1.56      jmc      2304: .Pp
1.1       nicm     2305: .It Xo Ic monitor-activity
1.56      jmc      2306: .Op Ic on | off
1.1       nicm     2307: .Xc
                   2308: Monitor for activity in the window.
                   2309: Windows with activity are highlighted in the status line.
1.56      jmc      2310: .Pp
                   2311: .It Ic monitor-content Ar match-string
1.6       jmc      2312: Monitor content in the window.
                   2313: When
1.16      nicm     2314: .Xr fnmatch 3
                   2315: pattern
1.1       nicm     2316: .Ar match-string
                   2317: appears in the window, it is highlighted in the status line.
1.56      jmc      2318: .Pp
1.192     nicm     2319: .It Xo Ic monitor-silence
                   2320: .Op Ic interval
                   2321: .Xc
                   2322: Monitor for silence (no activity) in the window within
                   2323: .Ic interval
                   2324: seconds.
                   2325: Windows that have been silent for the interval are highlighted in the
                   2326: status line.
                   2327: An interval of zero disables the monitoring.
1.195     nicm     2328: .Pp
                   2329: .It Ic other-pane-height Ar height
                   2330: Set the height of the other panes (not the main pane) in the
                   2331: .Ic main-horizontal
                   2332: layout.
                   2333: If this option is set to 0 (the default), it will have no effect.
                   2334: If both the
                   2335: .Ic main-pane-height
                   2336: and
                   2337: .Ic other-pane-height
                   2338: options are set, the main pane will grow taller to make the other panes the
                   2339: specified height, but will never shrink to do so.
                   2340: .Pp
                   2341: .It Ic other-pane-width Ar width
                   2342: Like
                   2343: .Ic other-pane-height ,
                   2344: but set the width of other panes in the
                   2345: .Ic main-vertical
                   2346: layout.
1.192     nicm     2347: .Pp
1.1       nicm     2348: .It Xo Ic remain-on-exit
1.56      jmc      2349: .Op Ic on | off
1.1       nicm     2350: .Xc
                   2351: A window with this flag set is not destroyed when the program running in it
                   2352: exits.
                   2353: The window may be reactivated with the
                   2354: .Ic respawn-window
                   2355: command.
1.56      jmc      2356: .Pp
1.99      nicm     2357: .It Xo Ic synchronize-panes
                   2358: .Op Ic on | off
                   2359: .Xc
1.164     nicm     2360: Duplicate input to any pane to all other panes in the same window (only
                   2361: for panes that are not in any special mode).
1.139     nicm     2362: .Pp
1.1       nicm     2363: .It Xo Ic utf8
1.56      jmc      2364: .Op Ic on | off
1.1       nicm     2365: .Xc
                   2366: Instructs
                   2367: .Nm
                   2368: to expect UTF-8 sequences to appear in this window.
1.56      jmc      2369: .Pp
1.1       nicm     2370: .It Ic window-status-attr Ar attributes
                   2371: Set status line attributes for a single window.
1.56      jmc      2372: .Pp
1.1       nicm     2373: .It Ic window-status-bg Ar colour
                   2374: Set status line background colour for a single window.
1.56      jmc      2375: .Pp
1.1       nicm     2376: .It Ic window-status-fg Ar colour
                   2377: Set status line foreground colour for a single window.
1.56      jmc      2378: .Pp
1.125     nicm     2379: .It Ic window-status-format Ar string
                   2380: Set the format in which the window is displayed in the status line window list.
                   2381: See the
                   2382: .Ar status-left
                   2383: option for details of special character sequences available.
                   2384: The default is
                   2385: .Ql #I:#W#F .
1.169     nicm     2386: .Pp
                   2387: .It Ic window-status-alert-attr Ar attributes
                   2388: Set status line attributes for windows which have an alert (bell, activity
                   2389: or content).
                   2390: .Pp
                   2391: .It Ic window-status-alert-bg Ar colour
                   2392: Set status line background colour for windows with an alert.
                   2393: .Pp
                   2394: .It Ic window-status-alert-fg Ar colour
                   2395: Set status line foreground colour for windows with an alert.
1.125     nicm     2396: .Pp
1.40      nicm     2397: .It Ic window-status-current-attr Ar attributes
                   2398: Set status line attributes for the currently active window.
1.56      jmc      2399: .Pp
1.40      nicm     2400: .It Ic window-status-current-bg Ar colour
                   2401: Set status line background colour for the currently active window.
1.56      jmc      2402: .Pp
1.40      nicm     2403: .It Ic window-status-current-fg Ar colour
                   2404: Set status line foreground colour for the currently active window.
1.56      jmc      2405: .Pp
1.125     nicm     2406: .It Ic window-status-current-format Ar string
                   2407: Like
                   2408: .Ar window-status-format ,
                   2409: but is the format used when the window is the current window.
1.154     nicm     2410: .Pp
                   2411: .It Ic word-separators Ar string
                   2412: Sets the window's conception of what characters are considered word
                   2413: separators, for the purposes of the next and previous word commands in
                   2414: copy mode.
                   2415: The default is
                   2416: .Ql \ -_@ .
1.125     nicm     2417: .Pp
1.1       nicm     2418: .It Xo Ic xterm-keys
1.56      jmc      2419: .Op Ic on | off
1.1       nicm     2420: .Xc
                   2421: If this option is set,
                   2422: .Nm
                   2423: will generate
1.57      jmc      2424: .Xr xterm 1 -style
                   2425: function key sequences; these have a number included to indicate modifiers such
                   2426: as Shift, Alt or Ctrl.
1.123     nicm     2427: The default is off.
1.57      jmc      2428: .El
                   2429: .It Xo Ic show-options
1.133     nicm     2430: .Op Fl gsw
1.129     nicm     2431: .Op Fl t Ar target-session | Ar target-window
1.57      jmc      2432: .Xc
                   2433: .D1 (alias: Ic show )
1.133     nicm     2434: Show the window options with
1.129     nicm     2435: .Fl w
1.133     nicm     2436: (equivalent to
1.134     nicm     2437: .Ic show-window-options ) ,
1.133     nicm     2438: the server options with
                   2439: .Fl s ,
                   2440: otherwise the session options for
                   2441: .Ar target session .
                   2442: Global session or window options are listed if
                   2443: .Fl g
                   2444: is used.
1.57      jmc      2445: .It Xo Ic show-window-options
                   2446: .Op Fl g
                   2447: .Op Fl t Ar target-window
                   2448: .Xc
                   2449: .D1 (alias: Ic showw )
                   2450: List the window options for
                   2451: .Ar target-window ,
                   2452: or the global window options if
                   2453: .Fl g
                   2454: is used.
1.63      nicm     2455: .El
                   2456: .Sh ENVIRONMENT
                   2457: When the server is started,
                   2458: .Nm
                   2459: copies the environment into the
                   2460: .Em global environment ;
                   2461: in addition, each session has a
                   2462: .Em session environment .
1.193     nicm     2463: When a window is created, the session and global environments are merged.
                   2464: If a variable exists in both, the value from the session environment is used.
                   2465: The result is the initial environment passed to the new process.
1.63      nicm     2466: .Pp
                   2467: The
                   2468: .Ic update-environment
                   2469: session option may be used to update the session environment from the client
                   2470: when a new session is created or an old reattached.
                   2471: .Nm
                   2472: also initialises the
                   2473: .Ev TMUX
                   2474: variable with some internal information to allow commands to be executed
                   2475: from inside, and the
                   2476: .Ev TERM
                   2477: variable with the correct terminal setting of
                   2478: .Ql screen .
                   2479: .Pp
                   2480: Commands to alter and view the environment are:
                   2481: .Bl -tag -width Ds
                   2482: .It Xo Ic set-environment
                   2483: .Op Fl gru
                   2484: .Op Fl t Ar target-session
                   2485: .Ar name Op Ar value
                   2486: .Xc
1.115     nicm     2487: .D1 (alias: Ic setenv )
1.63      nicm     2488: Set or unset an environment variable.
                   2489: If
                   2490: .Fl g
                   2491: is used, the change is made in the global environment; otherwise, it is applied
                   2492: to the session environment for
                   2493: .Ar target-session .
                   2494: The
                   2495: .Fl u
                   2496: flag unsets a variable.
                   2497: .Fl r
                   2498: indicates the variable is to be removed from the environment before starting a
                   2499: new process.
                   2500: .It Xo Ic show-environment
                   2501: .Op Fl g
                   2502: .Op Fl t Ar target-session
                   2503: .Xc
1.115     nicm     2504: .D1 (alias: Ic showenv )
1.63      nicm     2505: Display the environment for
                   2506: .Ar target-session
                   2507: or the global environment with
                   2508: .Fl g .
                   2509: Variables removed from the environment are prefixed with
                   2510: .Ql - .
1.57      jmc      2511: .El
                   2512: .Sh STATUS LINE
                   2513: .Nm
                   2514: includes an optional status line which is displayed in the bottom line of each
                   2515: terminal.
                   2516: By default, the status line is enabled (it may be disabled with the
                   2517: .Ic status
                   2518: session option) and contains, from left-to-right: the name of the current
                   2519: session in square brackets; the window list; the current window title in double
                   2520: quotes; and the time and date.
                   2521: .Pp
                   2522: The status line is made of three parts: configurable left and right sections
                   2523: (which may contain dynamic content such as the time or output from a shell
                   2524: command, see the
                   2525: .Ic status-left ,
                   2526: .Ic status-left-length ,
                   2527: .Ic status-right ,
                   2528: and
                   2529: .Ic status-right-length
                   2530: options below), and a central window list.
1.125     nicm     2531: By default, the window list shows the index, name and (if any) flag of the
                   2532: windows present in the current session in ascending numerical order.
                   2533: It may be customised with the
                   2534: .Ar window-status-format
                   2535: and
                   2536: .Ar window-status-current-format
                   2537: options.
1.57      jmc      2538: The flag is one of the following symbols appended to the window name:
                   2539: .Bl -column "Symbol" "Meaning" -offset indent
                   2540: .It Sy "Symbol" Ta Sy "Meaning"
                   2541: .It Li "*" Ta "Denotes the current window."
                   2542: .It Li "-" Ta "Marks the last window (previously selected)."
                   2543: .It Li "#" Ta "Window is monitored and activity has been detected."
                   2544: .It Li "!" Ta "A bell has occurred in the window."
                   2545: .It Li "+" Ta "Window is monitored for content and it has appeared."
1.192     nicm     2546: .It Li "~" Ta "The window has been silent for the monitor-silence interval."
1.57      jmc      2547: .El
                   2548: .Pp
                   2549: The # symbol relates to the
                   2550: .Ic monitor-activity
                   2551: and + to the
                   2552: .Ic monitor-content
                   2553: window options.
                   2554: The window name is printed in inverted colours if an alert (bell, activity or
                   2555: content) is present.
                   2556: .Pp
1.131     nicm     2557: The colour and attributes of the status line may be configured, the entire
                   2558: status line using the
1.57      jmc      2559: .Ic status-attr ,
                   2560: .Ic status-fg
                   2561: and
                   2562: .Ic status-bg
                   2563: session options and individual windows using the
                   2564: .Ic window-status-attr ,
                   2565: .Ic window-status-fg
                   2566: and
                   2567: .Ic window-status-bg
                   2568: window options.
                   2569: .Pp
1.131     nicm     2570: The status line is automatically refreshed at interval if it has changed, the
                   2571: interval may be controlled with the
1.57      jmc      2572: .Ic status-interval
                   2573: session option.
                   2574: .Pp
                   2575: Commands related to the status line are as follows:
                   2576: .Bl -tag -width Ds
                   2577: .It Xo Ic command-prompt
1.73      nicm     2578: .Op Fl p Ar prompts
1.57      jmc      2579: .Op Fl t Ar target-client
                   2580: .Op Ar template
                   2581: .Xc
                   2582: Open the command prompt in a client.
                   2583: This may be used from inside
                   2584: .Nm
                   2585: to execute commands interactively.
                   2586: If
                   2587: .Ar template
1.73      nicm     2588: is specified, it is used as the command.
                   2589: If
                   2590: .Fl p
                   2591: is given,
                   2592: .Ar prompts
                   2593: is a comma-separated list of prompts which are displayed in order; otherwise
                   2594: a single prompt is displayed, constructed from
                   2595: .Ar template
                   2596: if it is present, or
                   2597: .Ql \&:
                   2598: if not.
                   2599: Before the command is executed, the first occurrence of the string
                   2600: .Ql %%
1.74      jmc      2601: and all occurrences of
1.73      nicm     2602: .Ql %1
                   2603: are replaced by the response to the first prompt, the second
                   2604: .Ql %%
                   2605: and all
                   2606: .Ql %2
                   2607: are replaced with the response to the second prompt, and so on for further
1.74      jmc      2608: prompts.
                   2609: Up to nine prompt responses may be replaced
                   2610: .Po
                   2611: .Ql %1
1.73      nicm     2612: to
1.74      jmc      2613: .Ql %9
                   2614: .Pc .
1.57      jmc      2615: .It Xo Ic confirm-before
                   2616: .Op Fl t Ar target-client
                   2617: .Ar command
                   2618: .Xc
                   2619: .D1 (alias: Ic confirm )
                   2620: Ask for confirmation before executing
                   2621: .Ar command .
                   2622: This command works only from inside
                   2623: .Nm .
                   2624: .It Xo Ic display-message
1.127     nicm     2625: .Op Fl p
1.215     nicm     2626: .Op Fl c Ar target-client
                   2627: .Op Fl t Ar target-pane
1.57      jmc      2628: .Op Ar message
                   2629: .Xc
                   2630: .D1 (alias: Ic display )
1.127     nicm     2631: Display a message.
                   2632: If
                   2633: .Fl p
                   2634: is given, the output is printed to stdout, otherwise it is displayed in the
                   2635: .Ar target-client
                   2636: status line.
1.122     nicm     2637: The format of
1.124     jmc      2638: .Ar message
                   2639: is as for
1.122     nicm     2640: .Ic status-left ,
1.215     nicm     2641: with the exception that #() are not handled; information is taken from
                   2642: .Ar target-pane
                   2643: if
                   2644: .Fl t
                   2645: is given, otherwise the active pane for the session attached to
                   2646: .Ar target-client .
1.57      jmc      2647: .El
                   2648: .Sh BUFFERS
                   2649: .Nm
                   2650: maintains a stack of
1.199     nicm     2651: .Em paste buffers .
1.57      jmc      2652: Up to the value of the
                   2653: .Ic buffer-limit
                   2654: option are kept; when a new buffer is added, the buffer at the bottom of the
                   2655: stack is removed.
                   2656: Buffers may be added using
                   2657: .Ic copy-mode
                   2658: or the
                   2659: .Ic set-buffer
                   2660: command, and pasted into a window using the
                   2661: .Ic paste-buffer
                   2662: command.
                   2663: .Pp
                   2664: A configurable history buffer is also maintained for each window.
                   2665: By default, up to 2000 lines are kept; this can be altered with the
                   2666: .Ic history-limit
                   2667: option (see the
                   2668: .Ic set-option
                   2669: command above).
                   2670: .Pp
                   2671: The buffer commands are as follows:
                   2672: .Bl -tag -width Ds
1.178     nicm     2673: .It Xo
                   2674: .Ic choose-buffer
                   2675: .Op Fl t Ar target-window
                   2676: .Op Ar template
                   2677: .Xc
                   2678: Put a window into buffer choice mode, where a buffer may be chosen
                   2679: interactively from a list.
                   2680: After a buffer is selected,
                   2681: .Ql %%
                   2682: is replaced by the buffer index in
                   2683: .Ar template
                   2684: and the result executed as a command.
                   2685: If
                   2686: .Ar template
                   2687: is not given, "paste-buffer -b '%%'" is used.
                   2688: This command works only from inside
                   2689: .Nm .
1.57      jmc      2690: .It Ic clear-history Op Fl t Ar target-pane
                   2691: .D1 (alias: Ic clearhist )
                   2692: Remove and free the history for the specified pane.
1.198     nicm     2693: .It Ic delete-buffer Op Fl b Ar buffer-index
1.57      jmc      2694: .D1 (alias: Ic deleteb )
                   2695: Delete the buffer at
                   2696: .Ar buffer-index ,
                   2697: or the top buffer if not specified.
1.198     nicm     2698: .It Ic list-buffers
1.57      jmc      2699: .D1 (alias: Ic lsb )
1.198     nicm     2700: List the global buffers.
1.200     jmc      2701: .It Xo Ic load-buffer
1.57      jmc      2702: .Op Fl b Ar buffer-index
                   2703: .Ar path
                   2704: .Xc
                   2705: .D1 (alias: Ic loadb )
                   2706: Load the contents of the specified paste buffer from
                   2707: .Ar path .
                   2708: .It Xo Ic paste-buffer
                   2709: .Op Fl dr
                   2710: .Op Fl b Ar buffer-index
1.170     nicm     2711: .Op Fl s Ar separator
1.158     nicm     2712: .Op Fl t Ar target-pane
1.57      jmc      2713: .Xc
                   2714: .D1 (alias: Ic pasteb )
1.158     nicm     2715: Insert the contents of a paste buffer into the specified pane.
                   2716: If not specified, paste into the current one.
1.57      jmc      2717: With
                   2718: .Fl d ,
                   2719: also delete the paste buffer from the stack.
                   2720: When output, any linefeed (LF) characters in the paste buffer are replaced with
1.170     nicm     2721: a separator, by default carriage return (CR).
                   2722: A custom separator may be specified using the
                   2723: .Fl s
                   2724: flag.
                   2725: The
1.57      jmc      2726: .Fl r
1.170     nicm     2727: flag means to do no replacement (equivalent to a separator of LF).
1.57      jmc      2728: .It Xo Ic save-buffer
                   2729: .Op Fl a
                   2730: .Op Fl b Ar buffer-index
                   2731: .Ar path
                   2732: .Xc
                   2733: .D1 (alias: Ic saveb )
                   2734: Save the contents of the specified paste buffer to
                   2735: .Ar path .
                   2736: The
                   2737: .Fl a
                   2738: option appends to rather than overwriting the file.
                   2739: .It Xo Ic set-buffer
                   2740: .Op Fl b Ar buffer-index
                   2741: .Ar data
                   2742: .Xc
                   2743: .D1 (alias: Ic setb )
                   2744: Set the contents of the specified buffer to
                   2745: .Ar data .
1.1       nicm     2746: .It Xo Ic show-buffer
                   2747: .Op Fl b Ar buffer-index
                   2748: .Xc
                   2749: .D1 (alias: Ic showb )
                   2750: Display the contents of the specified buffer.
1.57      jmc      2751: .El
                   2752: .Sh MISCELLANEOUS
                   2753: Miscellaneous commands are as follows:
                   2754: .Bl -tag -width Ds
1.72      nicm     2755: .It Ic clock-mode Op Fl t Ar target-pane
1.57      jmc      2756: Display a large clock.
                   2757: .It Ic if-shell Ar shell-command command
                   2758: .D1 (alias: Ic if )
                   2759: Execute
                   2760: .Ar command
                   2761: if
                   2762: .Ar shell-command
                   2763: returns success.
                   2764: .It Ic lock-server
                   2765: .D1 (alias: Ic lock )
1.90      nicm     2766: Lock each client individually by running the command specified by the
                   2767: .Ic lock-command
                   2768: option.
1.153     nicm     2769: .It Ic run-shell Ar shell-command
1.87      nicm     2770: .D1 (alias: Ic run )
                   2771: Execute
1.153     nicm     2772: .Ar shell-command
1.106     nicm     2773: in the background without creating a window.
1.164     nicm     2774: After it finishes, any output to stdout is displayed in copy mode.
1.153     nicm     2775: If the command doesn't return success, the exit status is also displayed.
1.57      jmc      2776: .It Ic server-info
                   2777: .D1 (alias: Ic info )
                   2778: Show server information and terminal details.
1.1       nicm     2779: .El
                   2780: .Sh FILES
1.26      nicm     2781: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1       nicm     2782: .It Pa ~/.tmux.conf
1.6       jmc      2783: Default
1.1       nicm     2784: .Nm
1.6       jmc      2785: configuration file.
1.26      nicm     2786: .It Pa /etc/tmux.conf
                   2787: System-wide configuration file.
1.1       nicm     2788: .El
1.57      jmc      2789: .Sh EXAMPLES
                   2790: To create a new
                   2791: .Nm
                   2792: session running
                   2793: .Xr vi 1 :
                   2794: .Pp
                   2795: .Dl $ tmux new-session vi
                   2796: .Pp
                   2797: Most commands have a shorter form, known as an alias.
                   2798: For new-session, this is
                   2799: .Ic new :
                   2800: .Pp
                   2801: .Dl $ tmux new vi
                   2802: .Pp
                   2803: Alternatively, the shortest unambiguous form of a command is accepted.
                   2804: If there are several options, they are listed:
                   2805: .Bd -literal -offset indent
                   2806: $ tmux n
                   2807: ambiguous command: n, could be: new-session, new-window, next-window
                   2808: .Ed
                   2809: .Pp
                   2810: Within an active session, a new window may be created by typing
                   2811: .Ql C-b c
                   2812: (Ctrl
                   2813: followed by the
                   2814: .Ql b
                   2815: key
                   2816: followed by the
                   2817: .Ql c
                   2818: key).
                   2819: .Pp
                   2820: Windows may be navigated with:
                   2821: .Ql C-b 0
                   2822: (to select window 0),
                   2823: .Ql C-b 1
                   2824: (to select window 1), and so on;
                   2825: .Ql C-b n
                   2826: to select the next window; and
                   2827: .Ql C-b p
                   2828: to select the previous window.
                   2829: .Pp
                   2830: A session may be detached using
                   2831: .Ql C-b d
1.64      nicm     2832: (or by an external event such as
                   2833: .Xr ssh 1
                   2834: disconnection) and reattached with:
1.57      jmc      2835: .Pp
                   2836: .Dl $ tmux attach-session
                   2837: .Pp
                   2838: Typing
                   2839: .Ql C-b \&?
                   2840: lists the current key bindings in the current window; up and down may be used
                   2841: to navigate the list or
                   2842: .Ql q
                   2843: to exit from it.
                   2844: .Pp
                   2845: Commands to be run when the
                   2846: .Nm
                   2847: server is started may be placed in the
                   2848: .Pa ~/.tmux.conf
                   2849: configuration file.
                   2850: Common examples include:
                   2851: .Pp
                   2852: Changing the default prefix key:
                   2853: .Bd -literal -offset indent
                   2854: set-option -g prefix C-a
                   2855: unbind-key C-b
                   2856: bind-key C-a send-prefix
                   2857: .Ed
                   2858: .Pp
                   2859: Turning the status line off, or changing its colour:
                   2860: .Bd -literal -offset indent
                   2861: set-option -g status off
                   2862: set-option -g status-bg blue
                   2863: .Ed
                   2864: .Pp
                   2865: Setting other options, such as the default command,
                   2866: or locking after 30 minutes of inactivity:
                   2867: .Bd -literal -offset indent
                   2868: set-option -g default-command "exec /bin/ksh"
                   2869: set-option -g lock-after-time 1800
                   2870: .Ed
                   2871: .Pp
                   2872: Creating new key bindings:
                   2873: .Bd -literal -offset indent
                   2874: bind-key b set-option status
                   2875: bind-key / command-prompt "split-window 'exec man %%'"
1.73      nicm     2876: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57      jmc      2877: .Ed
1.1       nicm     2878: .Sh SEE ALSO
                   2879: .Xr pty 4
                   2880: .Sh AUTHORS
                   2881: .An Nicholas Marriott Aq nicm@users.sourceforge.net