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

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