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

1.125   ! nicm        1: .\" $OpenBSD: tmux.1,v 1.124 2009/11/19 15:00:32 jmc 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.123     nicm       17: .Dd $Mdocdate: November 19 2009 $
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.1       nicm      114: .It Fl f Ar file
                    115: Specify an alternative configuration file.
                    116: By default,
                    117: .Nm
1.26      nicm      118: loads the system configuration file from
                    119: .Pa /etc/tmux.conf ,
                    120: if present, then looks for a user configuration file at
1.1       nicm      121: .Pa ~/.tmux.conf .
                    122: The configuration file is a set of
                    123: .Nm
                    124: commands which are executed in sequence when the server is first started.
1.61      nicm      125: .Pp
                    126: If a command in the configuration file fails,
                    127: .Nm
                    128: will report an error and exit without executing further commands.
1.82      nicm      129: .It Fl l
                    130: Behave as a login shell.
                    131: This flag currently has no effect and is for compatibility with other shells
                    132: when using tmux as a login shell.
1.1       nicm      133: .It Fl L Ar socket-name
                    134: .Nm
                    135: stores the server socket in a directory under
                    136: .Pa /tmp ;
                    137: the default socket is named
                    138: .Em default .
                    139: This option allows a different socket name to be specified, allowing several
                    140: independent
                    141: .Nm
                    142: servers to be run.
                    143: Unlike
                    144: .Fl S
                    145: a full path is not necessary: the sockets are all created in the same
                    146: directory.
1.2       nicm      147: .Pp
                    148: If the socket is accidentally removed, the
1.6       jmc       149: .Dv SIGUSR1
1.2       nicm      150: signal may be sent to the
                    151: .Nm
                    152: server process to recreate it.
1.4       sobrado   153: .It Fl q
1.6       jmc       154: Prevent the server sending various informational messages, for example when
1.4       sobrado   155: window flags are altered.
1.1       nicm      156: .It Fl S Ar socket-path
                    157: Specify a full alternative path to the server socket.
                    158: If
                    159: .Fl S
                    160: is specified, the default socket directory is not used and any
                    161: .Fl L
                    162: flag is ignored.
                    163: .It Fl u
                    164: .Nm
1.14      nicm      165: attempts to guess if the terminal is likely to support UTF-8 by checking the
                    166: first of the
                    167: .Ev LC_ALL ,
                    168: .Ev LC_CTYPE
                    169: and
1.2       nicm      170: .Ev LANG
1.14      nicm      171: environment variables to be set for the string "UTF-8".
1.5       nicm      172: This is not always correct: the
1.2       nicm      173: .Fl u
                    174: flag explicitly informs
                    175: .Nm
1.6       jmc       176: that UTF-8 is supported.
1.33      nicm      177: .Pp
                    178: If the server is started from a client passed
                    179: .Fl u
                    180: or where UTF-8 is detected, the
                    181: .Ic utf8
                    182: and
                    183: .Ic status-utf8
                    184: options are enabled in the global window and session options respectively.
1.1       nicm      185: .It Fl v
                    186: Request verbose logging.
                    187: This option may be specified multiple times for increasing verbosity.
                    188: Log messages will be saved into
                    189: .Pa tmux-client-PID.log
                    190: and
                    191: .Pa tmux-server-PID.log
                    192: files in the current directory, where
                    193: .Em PID
1.6       jmc       194: is the PID of the server or client process.
1.1       nicm      195: .It Ar command Op Ar flags
                    196: This specifies one of a set of commands used to control
                    197: .Nm ,
1.6       jmc       198: as described in the following sections.
1.59      jmc       199: If no commands are specified, the
1.1       nicm      200: .Ic new-session
                    201: command is assumed.
1.57      jmc       202: .El
1.64      nicm      203: .Sh KEY BINDINGS
                    204: .Nm
                    205: may be controlled from an attached client by using a key combination of a
                    206: prefix key,
                    207: .Ql C-b
                    208: (Ctrl-b) by default, followed by a command key.
                    209: .Pp
                    210: Some of the default key bindings are:
                    211: .Pp
1.67      jmc       212: .Bl -tag -width Ds -offset indent -compact
1.64      nicm      213: .It c
1.65      nicm      214: Create a new window.
1.64      nicm      215: .It d
1.65      nicm      216: Detach the current client.
1.64      nicm      217: .It l
1.65      nicm      218: Move to the previously selected window.
1.64      nicm      219: .It n
1.65      nicm      220: Change to the next window.
1.64      nicm      221: .It p
1.65      nicm      222: Change to the previous window.
                    223: .It &
                    224: Kill the current window.
                    225: .It ,
                    226: Rename the current window.
1.64      nicm      227: .It \&?
1.65      nicm      228: List all key bindings.
1.64      nicm      229: .El
                    230: .Pp
                    231: A complete list may be obtained with the
                    232: .Ic list-keys
                    233: command (bound to
                    234: .Ql \&?
                    235: by default).
                    236: Key bindings may be changed with the
                    237: .Ic bind-key
                    238: and
                    239: .Ic unbind-key
                    240: commands.
1.57      jmc       241: .Sh COMMANDS
                    242: This section contains a list of the commands supported by
                    243: .Nm .
                    244: Most commands accept the optional
                    245: .Fl t
                    246: argument with one of
                    247: .Ar target-client ,
                    248: .Ar target-session
                    249: .Ar target-window ,
                    250: or
                    251: .Ar target-pane .
                    252: These specify the client, session, window or pane which a command should affect.
                    253: .Ar target-client
                    254: is the name of the
                    255: .Xr pty 4
                    256: file to which the client is connected, for example either of
                    257: .Pa /dev/ttyp1
                    258: or
                    259: .Pa ttyp1
                    260: for the client attached to
                    261: .Pa /dev/ttyp1 .
                    262: If no client is specified, the current client is chosen, if possible, or an
                    263: error is reported.
                    264: Clients may be listed with the
                    265: .Ic list-clients
                    266: command.
1.1       nicm      267: .Pp
1.57      jmc       268: .Ar target-session
                    269: is either the name of a session (as listed by the
                    270: .Ic list-sessions
                    271: command) or the name of a client with the same syntax as
                    272: .Ar target-client ,
                    273: in which case the session attached to the client is used.
                    274: When looking for the session name,
                    275: .Nm
                    276: initially searches for an exact match; if none is found, the session names
                    277: are checked for any for which
                    278: .Ar target-session
                    279: is a prefix or for which it matches as an
                    280: .Xr fnmatch 3
                    281: pattern.
                    282: If a single match is found, it is used as the target session; multiple matches
                    283: produce an error.
                    284: If a session is omitted, the current session is used if available; if no
1.117     nicm      285: current session is available, the most recently used is chosen.
1.1       nicm      286: .Pp
1.57      jmc       287: .Ar target-window
                    288: specifies a window in the form
                    289: .Em session Ns \&: Ns Em window .
                    290: .Em session
                    291: follows the same rules as for
                    292: .Ar target-session ,
                    293: and
                    294: .Em window
                    295: is looked for in order: as a window index, for example mysession:1; as an exact
                    296: window name, such as mysession:mywindow; then as an
                    297: .Xr fnmatch 3
                    298: pattern or the start of a window name, such as mysession:mywin* or
                    299: mysession:mywin.
                    300: An empty window name specifies the next unused index if appropriate (for
                    301: example the
                    302: .Ic new-window
                    303: and
                    304: .Ic link-window
                    305: commands)
                    306: otherwise the current window in
                    307: .Em session
                    308: is chosen.
                    309: When the argument does not contain a colon,
                    310: .Nm
                    311: first attempts to parse it as window; if that fails, an attempt is made to
                    312: match a session.
1.1       nicm      313: .Pp
1.57      jmc       314: .Ar target-pane
                    315: takes a similar form to
                    316: .Ar target-window
                    317: but with the optional addition of a period followed by a pane index, for
                    318: example: mysession:mywindow.1.
                    319: If the pane index is omitted, the currently active pane in the specified
                    320: window is used.
                    321: If neither a colon nor period appears,
1.13      nicm      322: .Nm
1.57      jmc       323: first attempts to use the argument as a pane index; if that fails, it is looked
                    324: up as for
                    325: .Ar target-window .
1.15      jmc       326: .Pp
1.57      jmc       327: Multiple commands may be specified together as part of a
                    328: .Em command sequence .
                    329: Each command should be separated by spaces and a semicolon;
                    330: commands are executed sequentially from left to right.
                    331: A literal semicolon may be included by escaping it with a backslash (for
                    332: example, when specifying a command sequence to
                    333: .Ic bind-key ) .
1.13      nicm      334: .Pp
1.57      jmc       335: Examples include:
1.13      nicm      336: .Bd -literal -offset indent
1.57      jmc       337: refresh-client -t/dev/ttyp2
                    338:
                    339: rename-session -tfirst newname
                    340:
                    341: set-window-option -t:0 monitor-activity on
                    342:
                    343: new-window ; split-window -d
1.13      nicm      344: .Ed
1.57      jmc       345: .Sh CLIENTS AND SESSIONS
                    346: The following commands are available:
                    347: .Bl -tag -width Ds
                    348: .It Xo Ic attach-session
                    349: .Op Fl d
                    350: .Op Fl t Ar target-session
                    351: .Xc
                    352: .D1 (alias: Ic attach )
                    353: If run from outside
                    354: .Nm ,
                    355: create a new client in the current terminal and attach it to
                    356: .Ar target-session .
                    357: If used from inside, switch the current client.
                    358: If
                    359: .Fl d
                    360: is specified, any other clients attached to the session are detached.
1.13      nicm      361: .Pp
1.57      jmc       362: If no server is started,
                    363: .Ic attach-session
                    364: will attempt to start it; this will fail unless sessions are created in the
                    365: configuration file.
                    366: .It Ic detach-client Op Fl t Ar target-client
                    367: .D1 (alias: Ic detach )
                    368: Detach the current client if bound to a key, or the specified client with
                    369: .Fl t .
                    370: .It Ic has-session Op Fl t Ar target-session
                    371: .D1 (alias: Ic has )
                    372: Report an error and exit with 1 if the specified session does not exist.
                    373: If it does exist, exit with 0.
                    374: .It Ic kill-server
                    375: Kill the
1.1       nicm      376: .Nm
1.57      jmc       377: server and clients and destroy all sessions.
                    378: .It Ic kill-session Op Fl t Ar target-session
                    379: Destroy the given session, closing any windows linked to it and no other
                    380: sessions, and detaching all clients attached to it.
                    381: .It Ic list-clients
                    382: .D1 (alias: Ic lsc )
                    383: List all clients attached to the server.
                    384: .It Ic list-commands
                    385: .D1 (alias: Ic lscm )
                    386: List the syntax of all commands supported by
                    387: .Nm .
                    388: .It Ic list-sessions
                    389: .D1 (alias: Ic ls )
                    390: List all sessions managed by the server.
1.92      nicm      391: .It Xo Ic lock-client
                    392: .Op Fl t Ar target-client
                    393: .Xc
                    394: Lock
                    395: .Ar target-client ,
                    396: see the
                    397: .Ic lock-server
                    398: command.
                    399: .It Xo Ic lock-session
                    400: .Op Fl t Ar target-session
                    401: .Xc
                    402: Lock all clients attached to
                    403: .Ar target-session .
1.57      jmc       404: .It Xo Ic new-session
                    405: .Op Fl d
                    406: .Op Fl n Ar window-name
                    407: .Op Fl s Ar session-name
1.101     nicm      408: .Op Fl t Ar target-session
1.57      jmc       409: .Op Ar command
                    410: .Xc
                    411: .D1 (alias: Ic new )
                    412: Create a new session with name
                    413: .Ar session-name .
                    414: The new session is attached to the current terminal unless
                    415: .Fl d
                    416: is given.
                    417: .Ar window-name
1.1       nicm      418: and
1.57      jmc       419: .Ar command
                    420: are the name of and command to execute in the initial window.
1.68      nicm      421: .Pp
                    422: If run from a terminal, any
                    423: .Xr termios 4
                    424: special characters are saved and used for new windows in the new session.
1.101     nicm      425: .Pp
                    426: If
                    427: .Fl t
                    428: is given, the new session is
                    429: .Em grouped
                    430: with
                    431: .Ar target-session .
                    432: This means they share the same set of windows - all windows from
                    433: .Ar target-session
                    434: are linked to the new session and any subsequent new windows or windows being
                    435: closed are applied to both sessions.
                    436: The current and previous window and any session options remain independent and
                    437: either session may be killed without affecting the other.
                    438: Giving
                    439: .Fl n
                    440: or
                    441: .Ar command
                    442: are invalid if
                    443: .Fl t
                    444: is used.
1.57      jmc       445: .It Ic refresh-client Op Fl t Ar target-client
                    446: .D1 (alias: Ic refresh )
                    447: Refresh the current client if bound to a key, or a single client if one is given
                    448: with
                    449: .Fl t .
                    450: .It Xo Ic rename-session
                    451: .Op Fl t Ar target-session
                    452: .Ar new-name
                    453: .Xc
                    454: .D1 (alias: Ic rename )
                    455: Rename the session to
                    456: .Ar new-name .
1.121     nicm      457: .It Xo Ic show-messages
1.120     nicm      458: .Op Fl t Ar target-client
                    459: .Xc
                    460: .D1 (alias: Ic showmsgs )
                    461: Any messages displayed on the status line are saved in a per-client message
                    462: log, up to a maximum of the limit set by the
                    463: .Ar message-limit
                    464: session option for the session attached to that client.
                    465: This command displays the log for
                    466: .Ar target-client .
1.57      jmc       467: .It Ic source-file Ar path
                    468: .D1 (alias: Ic source )
                    469: Execute commands from
                    470: .Ar path .
                    471: .It Ic start-server
                    472: .D1 (alias: Ic start )
                    473: Start the
1.1       nicm      474: .Nm
1.57      jmc       475: server, if not already running, without creating any sessions.
                    476: .It Xo Ic suspend-client
                    477: .Op Fl c Ar target-client
                    478: .Xc
                    479: .D1 (alias: Ic suspendc )
                    480: Suspend a client by sending
                    481: .Dv SIGTSTP
                    482: (tty stop).
                    483: .It Xo Ic switch-client
                    484: .Op Fl c Ar target-client
                    485: .Op Fl t Ar target-session
                    486: .Xc
                    487: .D1 (alias: Ic switchc )
                    488: Switch the current session for client
                    489: .Ar target-client
                    490: to
                    491: .Ar target-session .
                    492: .El
                    493: .Sh WINDOWS AND PANES
1.1       nicm      494: A
                    495: .Nm
                    496: window may be in one of several modes.
                    497: The default permits direct access to the terminal attached to the window.
                    498: The others are:
                    499: .Bl -tag -width Ds
                    500: .It Em output mode
                    501: This is entered when a command which produces output, such as
                    502: .Ic list-keys ,
                    503: is executed from a key binding.
                    504: .It Em copy mode
                    505: This permits a section of a window or its history to be copied to a
                    506: .Em paste buffer
                    507: for later insertion into another window.
                    508: This mode is entered with the
                    509: .Ic copy-mode
                    510: command, bound to
1.113     nicm      511: .Ql \&[
1.1       nicm      512: by default.
                    513: .El
                    514: .Pp
1.6       jmc       515: The keys available depend on whether emacs or vi mode is selected
                    516: (see the
1.1       nicm      517: .Ic mode-keys
                    518: option).
                    519: The following keys are supported as appropriate for the mode:
1.98      nicm      520: .Bl -column "FunctionXXXXXXXXXXXX" "viXXXXXXXXX" "emacs" -offset indent
1.1       nicm      521: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
1.27      nicm      522: .It Li "Back to indentation" Ta "^" Ta "M-m"
1.1       nicm      523: .It Li "Clear selection" Ta "Escape" Ta "C-g"
                    524: .It Li "Copy selection" Ta "Enter" Ta "M-w"
                    525: .It Li "Cursor down" Ta "j" Ta "Down"
1.70      nicm      526: .It Li "Cursor left" Ta "h" Ta "Left"
                    527: .It Li "Cursor right" Ta "l" Ta "Right"
1.116     nicm      528: .It Li "Cursor to bottom line" Ta "L" Ta ""
                    529: .It Li "Cursor to middle line" Ta "M" Ta "M-r"
                    530: .It Li "Cursor to top line" Ta "H" Ta "M-R"
1.70      nicm      531: .It Li "Cursor up" Ta "k" Ta "Up"
1.71      nicm      532: .It Li "Delete entire line" Ta "d" Ta "C-u"
1.70      nicm      533: .It Li "Delete to end of line" Ta "D" Ta "C-k"
1.1       nicm      534: .It Li "End of line" Ta "$" Ta "C-e"
1.94      nicm      535: .It Li "Goto line" Ta ":" Ta "g"
1.116     nicm      536: .It Li "Half page down" Ta "C-d" Ta "M-Down"
                    537: .It Li "Half page up" Ta "C-u" Ta "M-Up"
1.1       nicm      538: .It Li "Next page" Ta "C-f" Ta "Page down"
                    539: .It Li "Next word" Ta "w" Ta "M-f"
1.70      nicm      540: .It Li "Paste buffer" Ta "p" Ta "C-y"
1.116     nicm      541: .It Li "Previous page" Ta "C-b" Ta "Page up"
1.1       nicm      542: .It Li "Previous word" Ta "b" Ta "M-b"
                    543: .It Li "Quit mode" Ta "q" Ta "Escape"
1.98      nicm      544: .It Li "Scroll down" Ta "C-Down or J" Ta "C-Down"
                    545: .It Li "Scroll up" Ta "C-Up or K" Ta "C-Up"
1.70      nicm      546: .It Li "Search again" Ta "n" Ta "n"
                    547: .It Li "Search backward" Ta "?" Ta "C-r"
                    548: .It Li "Search forward" Ta "/" Ta "C-s"
                    549: .It Li "Start of line" Ta "0" Ta "C-a"
1.1       nicm      550: .It Li "Start selection" Ta "Space" Ta "C-Space"
1.80      nicm      551: .It Li "Transpose chars" Ta "" Ta "C-t"
1.1       nicm      552: .El
                    553: .Pp
1.48      nicm      554: These key bindings are defined in a set of named tables:
                    555: .Em vi-edit
                    556: and
                    557: .Em emacs-edit
                    558: for keys used when line editing at the command prompt;
                    559: .Em vi-choice
                    560: and
                    561: .Em emacs-choice
                    562: for keys used when choosing from lists (such as produced by the
                    563: .Ic window-choose
                    564: command) or in output mode; and
                    565: .Em vi-copy
                    566: and
                    567: .Em emacs-copy
1.97      nicm      568: used in copy mode.
1.48      nicm      569: The tables may be viewed with the
                    570: .Ic list-keys
1.49      nicm      571: command and keys modified or removed with
                    572: .Ic bind-key
                    573: and
                    574: .Ic unbind-key .
1.48      nicm      575: .Pp
1.2       nicm      576: The paste buffer key pastes the first line from the top paste buffer on the
                    577: stack.
1.57      jmc       578: .Pp
                    579: The mode commands are as follows:
                    580: .Bl -tag -width Ds
                    581: .It Xo Ic copy-mode
                    582: .Op Fl u
1.72      nicm      583: .Op Fl t Ar target-pane
1.57      jmc       584: .Xc
                    585: Enter copy mode.
                    586: The
                    587: .Fl u
                    588: option scrolls one page up.
                    589: .El
1.18      nicm      590: .Pp
1.1       nicm      591: Each window displayed by
                    592: .Nm
                    593: may be split into one or more
                    594: .Em panes ;
                    595: each pane takes up a certain area of the display and is a separate terminal.
                    596: A window may be split into panes using the
                    597: .Ic split-window
                    598: command.
1.38      nicm      599: Windows may be split horizontally (with the
                    600: .Fl h
                    601: flag) or vertically.
                    602: Panes may be resized with the
                    603: .Ic resize-pane
1.1       nicm      604: command (bound to
1.38      nicm      605: .Ql C-up ,
                    606: .Ql C-down
                    607: .Ql C-left
                    608: and
                    609: .Ql C-right
1.1       nicm      610: by default), the current pane may be changed with the
                    611: .Ic up-pane
                    612: and
                    613: .Ic down-pane
                    614: commands and the
                    615: .Ic rotate-window
                    616: and
                    617: .Ic swap-pane
1.38      nicm      618: commands may be used to swap panes without changing their position.
                    619: Panes are numbered beginning from zero in the order they are created.
                    620: .Pp
                    621: A number of preset
                    622: .Em layouts
                    623: are available.
                    624: These may be selected with the
                    625: .Ic select-layout
                    626: command or cycled with
                    627: .Ic next-layout
                    628: (bound to
                    629: .Ql C-space
                    630: by default); once a layout is chosen, panes within it may be moved and resized as normal.
1.1       nicm      631: .Pp
                    632: The following layouts are supported:
                    633: .Bl -tag -width Ds
                    634: .It Ic even-horizontal
                    635: Panes are spread out evenly from left to right across the window.
                    636: .It Ic even-vertical
                    637: Panes are spread evenly from top to bottom.
1.2       nicm      638: .It Ic main-horizontal
                    639: A large (main) pane is shown at the top of the window and the remaining panes are
1.6       jmc       640: spread from left to right in the leftover space at the bottom.
1.2       nicm      641: Use the
                    642: .Em main-pane-height
                    643: window option to specify the height of the top pane.
1.1       nicm      644: .It Ic main-vertical
1.2       nicm      645: Similar to
                    646: .Ic main-horizontal
                    647: but the large pane is placed on the left and the others spread from top to
                    648: bottom along the right.
                    649: See the
                    650: .Em main-pane-width
                    651: window option.
1.1       nicm      652: .El
1.8       nicm      653: .Pp
1.57      jmc       654: Commands related to windows and panes are as follows:
                    655: .Bl -tag -width Ds
                    656: .It Xo Ic break-pane
                    657: .Op Fl d
                    658: .Op Fl t Ar target-pane
                    659: .Xc
                    660: .D1 (alias: Ic breakp )
                    661: Break
                    662: .Ar target-pane
                    663: off from its containing window to make it the only pane in a new window.
                    664: If
                    665: .Fl d
                    666: is given, the new window does not become the current window.
1.76      nicm      667: .It Xo
                    668: .Ic choose-client
                    669: .Op Fl t Ar target-window
                    670: .Op Ar template
                    671: .Xc
                    672: Put a window into client choice mode, allowing a client to be selected
                    673: interactively from a list.
                    674: After a client is chosen,
                    675: .Ql %%
                    676: is replaced by the client
                    677: .Xr pty 4
                    678: path in
                    679: .Ar template
                    680: and the result executed as a command.
                    681: If
                    682: .Ar template
                    683: is not given, "detach-client -t '%%'" is used.
1.57      jmc       684: This command works only from inside
                    685: .Nm .
1.76      nicm      686: .It Xo
                    687: .Ic choose-session
                    688: .Op Fl t Ar target-window
                    689: .Op Ar template
                    690: .Xc
                    691: Put a window into session choice mode, where a session may be selected
                    692: interactively from a list.
                    693: When one is chosen,
                    694: .Ql %%
                    695: is replaced by the session name in
                    696: .Ar template
                    697: and the result executed as a command.
                    698: If
                    699: .Ar template
                    700: is not given, "switch-client -t '%%'" is used.
                    701: This command works only from inside
                    702: .Nm .
                    703: .It Xo
                    704: .Ic choose-window
                    705: .Op Fl t Ar target-window
                    706: .Op Ar template
                    707: .Xc
                    708: Put a window into window choice mode, where a window may be chosen
                    709: interactively from a list.
                    710: After a window is selected,
                    711: .Ql %%
                    712: is replaced by the session name and window index in
                    713: .Ar template
                    714: and the result executed as a command.
                    715: If
                    716: .Ar template
                    717: is not given, "select-window -t '%%'" is used.
1.57      jmc       718: This command works only from inside
                    719: .Nm .
1.78      nicm      720: .It Ic display-panes Op Fl t Ar target-client
                    721: .D1 (alias: Ic displayp)
                    722: Display a visible indicator of each pane shown by
                    723: .Ar target-client .
                    724: See the
                    725: .Ic display-panes-time
                    726: and
                    727: .Ic display-panes-colour
                    728: session options.
1.84      nicm      729: While the indicator is on screen, a pane may be selected with the
                    730: .Ql 0
                    731: to
                    732: .Ql 9
                    733: keys.
1.57      jmc       734: .It Ic down-pane Op Fl t Ar target-pane
                    735: .D1 (alias: Ic downp )
1.111     nicm      736: Change the active pane to the next pane (higher index).
1.57      jmc       737: .It Xo Ic find-window
                    738: .Op Fl t Ar target-window
                    739: .Ar match-string
                    740: .Xc
                    741: .D1 (alias: Ic findw )
                    742: Search for the
                    743: .Xr fnmatch 3
                    744: pattern
                    745: .Ar match-string
                    746: in window names, titles, and visible content (but not history).
                    747: If only one window is matched, it'll be automatically selected, otherwise a
                    748: choice list is shown.
                    749: This command only works from inside
1.1       nicm      750: .Nm .
1.112     nicm      751: .It Xo Ic kill-pane
                    752: .Op Fl a
                    753: .Op Fl t Ar target-pane
                    754: .Xc
1.57      jmc       755: .D1 (alias: Ic killp )
                    756: Destroy the given pane.
                    757: If no panes remain in the containing window, it is also destroyed.
1.112     nicm      758: The
                    759: .Fl a
                    760: option kills all but the pane given with
                    761: .Fl t .
1.57      jmc       762: .It Ic kill-window Op Fl t Ar target-window
                    763: .D1 (alias: Ic killw )
                    764: Kill the current window or the window at
                    765: .Ar target-window ,
1.1       nicm      766: removing it from any sessions to which it is linked.
1.56      jmc       767: .It Ic last-window Op Fl t Ar target-session
1.1       nicm      768: .D1 (alias: Ic last )
                    769: Select the last (previously selected) window.
                    770: If no
                    771: .Ar target-session
                    772: is specified, select the last window of the current session.
                    773: .It Xo Ic link-window
                    774: .Op Fl dk
                    775: .Op Fl s Ar src-window
                    776: .Op Fl t Ar dst-window
                    777: .Xc
                    778: .D1 (alias: Ic linkw )
                    779: Link the window at
                    780: .Ar src-window
                    781: to the specified
                    782: .Ar dst-window .
                    783: If
                    784: .Ar dst-window
                    785: is specified and no such window exists, the
                    786: .Ar src-window
                    787: is linked there.
                    788: If
                    789: .Fl k
                    790: is given and
                    791: .Ar dst-window
                    792: exists, it is killed, otherwise an error is generated.
                    793: If
                    794: .Fl d
                    795: is given, the newly linked window is not selected.
1.104     nicm      796: .It Ic list-panes Op Fl t Ar target-window
                    797: .D1 (alias: Ic lsp )
                    798: List the panes in the current window or in
                    799: .Ar target-window .
1.56      jmc       800: .It Ic list-windows Op Fl t Ar target-session
1.1       nicm      801: .D1 (alias: Ic lsw )
                    802: List windows in the current session or in
                    803: .Ar target-session .
                    804: .It Xo Ic move-window
                    805: .Op Fl d
                    806: .Op Fl s Ar src-window
                    807: .Op Fl t Ar dst-window
                    808: .Xc
                    809: .D1 (alias: Ic movew )
                    810: This is similar to
                    811: .Ic link-window ,
                    812: except the window at
                    813: .Ar src-window
                    814: is moved to
                    815: .Ar dst-window .
                    816: .It Xo Ic new-window
1.28      nicm      817: .Op Fl dk
1.1       nicm      818: .Op Fl n Ar window-name
                    819: .Op Fl t Ar target-window
                    820: .Op Ar command
                    821: .Xc
                    822: .D1 (alias: Ic neww )
                    823: Create a new window.
                    824: If
                    825: .Fl d
                    826: is given, the session does not make the new window the current window.
                    827: .Ar target-window
1.28      nicm      828: represents the window to be created; if the target already exists an error is
                    829: shown, unless the
                    830: .Fl k
                    831: flag is used, in which case it is destroyed.
1.1       nicm      832: .Ar command
                    833: is the command to execute.
                    834: If
                    835: .Ar command
                    836: is not specified, the default command is used.
                    837: .Pp
                    838: The
                    839: .Ev TERM
                    840: environment variable must be set to
                    841: .Dq screen
                    842: for all programs running
                    843: .Em inside
                    844: .Nm .
                    845: New windows will automatically have
                    846: .Dq TERM=screen
                    847: added to their environment, but care must be taken not to reset this in shell
                    848: start-up files.
1.56      jmc       849: .It Ic next-layout Op Fl t Ar target-window
1.1       nicm      850: .D1 (alias: Ic nextl )
                    851: Move a window to the next layout and rearrange the panes to fit.
                    852: .It Xo Ic next-window
1.9       nicm      853: .Op Fl a
1.1       nicm      854: .Op Fl t Ar target-session
                    855: .Xc
                    856: .D1 (alias: Ic next )
                    857: Move to the next window in the session.
1.9       nicm      858: If
1.12      jmc       859: .Fl a
1.9       nicm      860: is used, move to the next window with a bell, activity or content alert.
1.107     nicm      861: .It Xo Ic pipe-pane
                    862: .Op Fl o
                    863: .Op Fl t Ar target-pane
                    864: .Op Ar command
                    865: .Xc
                    866: .D1 (alias: Ic pipep )
                    867: Pipe any output sent by the program in
                    868: .Ar target-pane
                    869: to a shell command.
                    870: A pane may only be piped to one command at a time, any existing pipe is
                    871: closed before
                    872: .Ar command
                    873: is executed.
                    874: If no
                    875: .Ar command
                    876: is given, the current pipe (if any) is closed.
                    877: .Pp
                    878: The
                    879: .Fl o
                    880: option only opens a new pipe if no previous pipe exists, allowing a pipe to
                    881: be toggled with a single key, for example:
                    882: .Bd -literal -offset indent
                    883: bind-key C-p pipe-pane -o 'cat >>~/output'
                    884: .Ed
1.1       nicm      885: .It Xo Ic previous-window
1.9       nicm      886: .Op Fl a
1.1       nicm      887: .Op Fl t Ar target-session
                    888: .Xc
                    889: .D1 (alias: Ic prev )
                    890: Move to the previous window in the session.
1.9       nicm      891: With
                    892: .Fl a ,
                    893: move to the previous window with a bell, activity or content alert.
1.1       nicm      894: .It Xo Ic rename-window
                    895: .Op Fl t Ar target-window
                    896: .Ar new-name
                    897: .Xc
                    898: .D1 (alias: Ic renamew )
                    899: Rename the current window, or the window at
                    900: .Ar target-window
                    901: if specified, to
                    902: .Ar new-name .
                    903: .It Xo Ic resize-pane
1.39      jmc       904: .Op Fl DLRU
1.52      nicm      905: .Op Fl t Ar target-pane
1.1       nicm      906: .Op Ar adjustment
                    907: .Xc
                    908: .D1 (alias: Ic resizep )
1.57      jmc       909: Resize a pane, upward with
                    910: .Fl U
                    911: (the default), downward with
                    912: .Fl D ,
                    913: to the left with
                    914: .Fl L
                    915: and to the right with
                    916: .Fl R .
                    917: The
                    918: .Ar adjustment
                    919: is given in lines or cells (the default is 1).
                    920: .It Xo Ic respawn-window
                    921: .Op Fl k
                    922: .Op Fl t Ar target-window
                    923: .Op Ar command
                    924: .Xc
                    925: .D1 (alias: Ic respawnw )
                    926: Reactive a window in which the command has exited (see the
                    927: .Ic remain-on-exit
                    928: window option).
                    929: If
                    930: .Ar command
                    931: is not given, the command used when the window was created is executed.
                    932: The window must be already inactive, unless
                    933: .Fl k
                    934: is given, in which case any existing command is killed.
                    935: .It Xo Ic rotate-window
                    936: .Op Fl DU
                    937: .Op Fl t Ar target-window
                    938: .Xc
                    939: .D1 (alias: Ic rotatew )
                    940: Rotate the positions of the panes within a window, either upward (numerically
                    941: lower) with
                    942: .Fl U
                    943: or downward (numerically higher).
                    944: .It Xo Ic select-layout
                    945: .Op Fl t Ar target-window
                    946: .Op Ar layout-name
                    947: .Xc
                    948: .D1 (alias: selectl )
                    949: Choose a specific layout for a window.
                    950: If
                    951: .Ar layout-name
                    952: is not given, the last layout used (if any) is reapplied.
                    953: .It Ic select-pane Op Fl t Ar target-pane
                    954: .D1 (alias: Ic selectp )
                    955: Make pane
                    956: .Ar target-pane
                    957: the active pane in window
                    958: .Ar target-window .
                    959: .It Ic select-window Op Fl t Ar target-window
                    960: .D1 (alias: Ic selectw )
                    961: Select the window at
                    962: .Ar target-window .
                    963: .It Xo Ic split-window
                    964: .Op Fl dhv
                    965: .Oo Fl l
                    966: .Ar size |
                    967: .Fl p Ar percentage Oc
                    968: .Op Fl t Ar target-window
                    969: .Op Ar command
                    970: .Xc
                    971: .D1 (alias: splitw )
                    972: Creates a new pane by splitting the active pane:
                    973: .Fl h
                    974: does a horizontal split and
                    975: .Fl v
                    976: a vertical split; if neither is specified,
                    977: .Fl v
                    978: is assumed.
                    979: The
                    980: .Fl l
                    981: and
                    982: .Fl p
                    983: options specify the size of the new window in lines (for vertical split) or in
                    984: cells (for horizontal split), or as a percentage, respectively.
                    985: All other options have the same meaning as in the
                    986: .Ic new-window
                    987: command.
                    988: .It Xo Ic swap-pane
                    989: .Op Fl dDU
                    990: .Op Fl s Ar src-pane
                    991: .Op Fl t Ar dst-pane
                    992: .Xc
                    993: .D1 (alias: Ic swapp )
                    994: Swap two panes.
                    995: If
                    996: .Fl U
                    997: is used and no source pane is specified with
                    998: .Fl s ,
                    999: .Ar dst-pane
                   1000: is swapped with the previous pane (before it numerically);
                   1001: .Fl D
                   1002: swaps with the next pane (after it numerically).
                   1003: .It Xo Ic swap-window
                   1004: .Op Fl d
                   1005: .Op Fl s Ar src-window
                   1006: .Op Fl t Ar dst-window
                   1007: .Xc
                   1008: .D1 (alias: Ic swapw )
                   1009: This is similar to
                   1010: .Ic link-window ,
                   1011: except the source and destination windows are swapped.
                   1012: It is an error if no window exists at
                   1013: .Ar src-window .
                   1014: .It Xo Ic unlink-window
1.1       nicm     1015: .Op Fl k
                   1016: .Op Fl t Ar target-window
                   1017: .Xc
1.57      jmc      1018: .D1 (alias: Ic unlinkw )
                   1019: Unlink
                   1020: .Ar target-window .
                   1021: Unless
                   1022: .Fl k
                   1023: is given, a window may be unlinked only if it is linked to multiple sessions -
                   1024: windows may not be linked to no sessions;
                   1025: if
1.1       nicm     1026: .Fl k
1.57      jmc      1027: is specified and the window is linked to only one session, it is unlinked and
                   1028: destroyed.
                   1029: .It Ic up-pane Op Fl t Ar target-pane
                   1030: .D1 (alias: Ic upp )
1.111     nicm     1031: Change the active pane to the previous pane (lower index).
1.57      jmc      1032: .El
                   1033: .Sh KEY BINDINGS
1.93      nicm     1034: .Nm
                   1035: allows a command to be bound to most keys, with or without a prefix key.
                   1036: When specifying keys, most represent themselves (for example
                   1037: .Ql A
                   1038: to
1.95      jmc      1039: .Ql Z ) .
1.93      nicm     1040: Ctrl keys may be prefixed with
                   1041: .Ql C-
                   1042: or
1.95      jmc      1043: .Ql ^ ,
                   1044: and Alt (meta) with
1.93      nicm     1045: .Ql M- .
                   1046: In addition, the following special key names are accepted:
                   1047: .Em BSpace ,
                   1048: .Em BTab ,
                   1049: .Em DC
                   1050: (Delete),
                   1051: .Em End ,
                   1052: .Em Enter ,
                   1053: .Em Escape ,
                   1054: .Em F1
                   1055: to
                   1056: .Em F20 ,
                   1057: .Em Home ,
                   1058: .Em IC
                   1059: (Insert),
                   1060: .Em NPage
                   1061: (Page Up),
                   1062: .Em PPage
                   1063: (Page Down),
                   1064: .Em Space ,
                   1065: and
                   1066: .Em Tab .
                   1067: Note that to bind the
                   1068: .Ql \&"
                   1069: or
                   1070: .Ql '
                   1071: keys, quotation marks are necessary, for example:
                   1072: .Bd -literal -offset indent
                   1073: bind-key '"' split-window
                   1074: bind-key "'" select-prompt
                   1075: .Ed
                   1076: .Pp
1.57      jmc      1077: Commands related to key bindings are as follows:
                   1078: .Bl -tag -width Ds
                   1079: .It Xo Ic bind-key
                   1080: .Op Fl cnr
                   1081: .Op Fl t Ar key-table
                   1082: .Ar key Ar command Op Ar arguments
1.1       nicm     1083: .Xc
1.57      jmc      1084: .D1 (alias: Ic bind )
                   1085: Bind key
                   1086: .Ar key
                   1087: to
                   1088: .Ar command .
                   1089: By default (without
                   1090: .Fl t )
                   1091: the primary key bindings are modified (those normally activated with the prefix
                   1092: key); in this case, if
                   1093: .Fl n
                   1094: is specified, it is not necessary to use the prefix key,
                   1095: .Ar command
                   1096: is bound to
                   1097: .Ar key
                   1098: alone.
1.1       nicm     1099: The
1.57      jmc      1100: .Fl r
                   1101: flag indicates this key may repeat, see the
                   1102: .Ic repeat-time
                   1103: option.
                   1104: .Pp
                   1105: If
                   1106: .Fl t
                   1107: is present,
                   1108: .Ar key
                   1109: is bound in
                   1110: .Ar key-table :
                   1111: the binding for command mode with
                   1112: .Fl c
                   1113: or for normal mode without.
                   1114: To view the default bindings and possible commands, see the
                   1115: .Ic list-keys
                   1116: command.
                   1117: .It Ic list-keys Op Fl t Ar key-table
                   1118: .D1 (alias: Ic lsk )
                   1119: List all key bindings.
                   1120: Without
                   1121: .Fl t
                   1122: the primary key bindings - those executed when preceded by the prefix key -
                   1123: are printed.
                   1124: Keys bound without the prefix key (see
                   1125: .Ic bind-key
                   1126: .Fl n )
1.119     nicm     1127: are marked with
                   1128: .Ql (no prefix) .
1.57      jmc      1129: .Pp
                   1130: With
                   1131: .Fl t ,
                   1132: the key bindings in
                   1133: .Ar key-table
                   1134: are listed; this may be one of:
                   1135: .Em vi-edit ,
                   1136: .Em emacs-edit ,
                   1137: .Em vi-choice ,
                   1138: .Em emacs-choice ,
                   1139: .Em vi-copy
                   1140: or
                   1141: .Em emacs-copy .
                   1142: .It Xo Ic send-keys
1.72      nicm     1143: .Op Fl t Ar target-pane
1.57      jmc      1144: .Ar key Ar ...
1.1       nicm     1145: .Xc
1.57      jmc      1146: .D1 (alias: Ic send )
                   1147: Send a key or keys to a window.
                   1148: Each argument
                   1149: .Ar key
                   1150: is the name of the key (such as
                   1151: .Ql C-a
                   1152: or
                   1153: .Ql npage
                   1154: ) to send; if the string is not recognised as a key, it is sent as a series of
                   1155: characters.
                   1156: All arguments are sent sequentially from first to last.
1.72      nicm     1157: .It Ic send-prefix Op Fl t Ar target-pane
1.57      jmc      1158: Send the prefix key to a window as if it was pressed.
1.89      nicm     1159: If multiple prefix keys are configured, only the first is sent.
1.57      jmc      1160: .It Xo Ic unbind-key
                   1161: .Op Fl cn
                   1162: .Op Fl t Ar key-table
                   1163: .Ar key
1.2       nicm     1164: .Xc
1.57      jmc      1165: .D1 (alias: Ic unbind )
                   1166: Unbind the command bound to
                   1167: .Ar key .
                   1168: Without
                   1169: .Fl t
                   1170: the primary key bindings are modified; in this case, if
                   1171: .Fl n
                   1172: is specified, the command bound to
                   1173: .Ar key
                   1174: without a prefix (if any) is removed.
                   1175: .Pp
1.47      nicm     1176: If
1.57      jmc      1177: .Fl t
                   1178: is present,
                   1179: .Ar key
                   1180: in
                   1181: .Ar key-table
                   1182: is unbound: the binding for command mode with
                   1183: .Fl c
                   1184: or for normal mode without.
                   1185: .El
                   1186: .Sh OPTIONS
                   1187: The appearance and behaviour of
                   1188: .Nm
                   1189: may be modified by changing the value of various options.
                   1190: There are two types of option:
                   1191: .Em session options
                   1192: and
                   1193: .Em window options .
                   1194: .Pp
                   1195: Each individual session may have a set of session options, and there is a
                   1196: separate set of global session options.
                   1197: Sessions which do not have a particular option configured inherit the value
                   1198: from the global session options.
                   1199: Session options are set or unset with the
                   1200: .Ic set-option
                   1201: command and may be listed with the
                   1202: .Ic show-options
                   1203: command.
                   1204: The available session options are listed under the
                   1205: .Ic set-option
                   1206: command.
                   1207: .Pp
                   1208: Similarly, a set of window options is attached to each window, and there is
                   1209: a set of global window options from which any unset options are inherited.
                   1210: Window options are altered with the
                   1211: .Ic set-window-option
                   1212: command and can be listed with the
                   1213: .Ic show-window-options
                   1214: command.
                   1215: All window options are documented with the
                   1216: .Ic set-window-option
                   1217: command.
                   1218: .Pp
                   1219: Commands which set options are as follows:
                   1220: .Bl -tag -width Ds
1.1       nicm     1221: .It Xo Ic set-option
1.58      nicm     1222: .Op Fl agu
1.1       nicm     1223: .Op Fl t Ar target-session
                   1224: .Ar option Ar value
                   1225: .Xc
                   1226: .D1 (alias: Ic set )
1.18      nicm     1227: Set a session option.
1.58      nicm     1228: With
                   1229: .Fl a ,
                   1230: and if the option expects a string,
                   1231: .Ar value
                   1232: is appended to the existing setting.
1.1       nicm     1233: If
                   1234: .Fl g
1.18      nicm     1235: is specified, the global session option is set.
1.1       nicm     1236: The
                   1237: .Fl u
                   1238: flag unsets an option, so a session inherits the option from the global
                   1239: options - it is not possible to unset a global option.
                   1240: .Pp
1.18      nicm     1241: Available session options are:
1.1       nicm     1242: .Bl -tag -width Ds
1.69      nicm     1243: .It Ic base-index Ar index
                   1244: Set the base index from which an unused index should be searched when a new
                   1245: window is created.
                   1246: The default is zero.
1.1       nicm     1247: .It Xo Ic bell-action
1.56      jmc      1248: .Op Ic any | none | current
1.1       nicm     1249: .Xc
                   1250: Set action on window bell.
                   1251: .Ic any
                   1252: means a bell in any window linked to a session causes a bell in the current
                   1253: window of that session,
                   1254: .Ic none
                   1255: means all bells are ignored and
                   1256: .Ic current
                   1257: means only bell in windows other than the current window are ignored.
                   1258: .It Ic buffer-limit Ar number
                   1259: Set the number of buffers kept for each session; as new buffers are added to
                   1260: the top of the stack, old ones are removed from the bottom if necessary to
                   1261: maintain this maximum length.
                   1262: .It Ic default-command Ar command
                   1263: Set the command used for new windows (if not specified when the window is
                   1264: created) to
1.79      nicm     1265: .Ar command ,
                   1266: which may be any
                   1267: .Xr sh 1
                   1268: command.
1.19      nicm     1269: The default is an empty string, which instructs
                   1270: .Nm
1.79      nicm     1271: to create a login shell using the value of the
                   1272: .Ic default-shell
                   1273: option.
                   1274: .It Ic default-shell Ar path
                   1275: Specify the default shell.
                   1276: This is used as the login shell for new windows when the
                   1277: .Ic default-command
                   1278: option is set to empty, and must be the full path of the executable.
                   1279: When started
                   1280: .Nm
                   1281: tries to set a default value from the first suitable of the
1.19      nicm     1282: .Ev SHELL
1.79      nicm     1283: environment variable, the shell returned by
                   1284: .Xr getpwuid 3 ,
                   1285: or
                   1286: .Pa /bin/sh .
                   1287: This option should be configured when
                   1288: .Nm
                   1289: is used as a login shell.
1.1       nicm     1290: .It Ic default-path Ar path
                   1291: Set the default working directory for processes created from keys, or
                   1292: interactively from the prompt.
                   1293: The default is the current working directory when the server is started.
1.22      nicm     1294: .It Ic default-terminal Ar terminal
                   1295: Set the default terminal for new windows created in this session - the
                   1296: default value of the
                   1297: .Ev TERM
                   1298: environment variable.
                   1299: For
                   1300: .Nm
                   1301: to work correctly, this
                   1302: .Em must
                   1303: be set to
                   1304: .Ql screen
                   1305: or a derivative of it.
1.78      nicm     1306: .It Ic display-panes-colour Ar colour
                   1307: Set the colour used for the
                   1308: .Ic display-panes
                   1309: command.
                   1310: .It Ic display-panes-time Ar time
                   1311: Set the time in milliseconds for which the indicators shown by the
                   1312: .Ic display-panes
                   1313: command appear.
1.21      nicm     1314: .It Ic display-time Ar time
1.78      nicm     1315: Set the amount of time for which status line messages and other on-screen
                   1316: indicators are displayed.
1.21      nicm     1317: .Ar time
                   1318: is in milliseconds.
1.1       nicm     1319: .It Ic history-limit Ar lines
                   1320: Set the maximum number of lines held in window history.
                   1321: This setting applies only to new windows - existing window histories are not
                   1322: resized and retain the limit at the point they were created.
                   1323: .It Ic lock-after-time Ar number
1.100     nicm     1324: Lock the session (like the
                   1325: .Ic lock-session
1.90      nicm     1326: command) after
1.1       nicm     1327: .Ar number
1.100     nicm     1328: seconds of inactivity, or the entire server (all sessions) if the
                   1329: .Ic lock-server
                   1330: option is set.
                   1331: The default is not to lock (set to 0).
1.90      nicm     1332: .It Ic lock-command Ar command
                   1333: Command to run when locking each client.
                   1334: The default is to run
                   1335: .Xr lock 1
                   1336: with
                   1337: .Fl np .
1.100     nicm     1338: .It Xo Ic lock-server
                   1339: .Op Ic on | off
                   1340: .Xc
                   1341: If this option is
1.102     nicm     1342: .Ic on
1.100     nicm     1343: (the default),
                   1344: instead of each session locking individually as each has been
                   1345: idle for
1.108     jmc      1346: .Ic lock-after-time ,
                   1347: the entire server will lock after
1.100     nicm     1348: .Em all
                   1349: sessions would have locked.
                   1350: This has no effect as a session option; it must be set as a global option.
1.1       nicm     1351: .It Ic message-attr Ar attributes
                   1352: Set status line message attributes, where
                   1353: .Ar attributes
                   1354: is either
                   1355: .Ic default
                   1356: or a comma-delimited list of one or more of:
                   1357: .Ic bright
                   1358: (or
                   1359: .Ic bold ) ,
                   1360: .Ic dim ,
                   1361: .Ic underscore ,
                   1362: .Ic blink ,
                   1363: .Ic reverse ,
                   1364: .Ic hidden ,
                   1365: or
                   1366: .Ic italics .
                   1367: .It Ic message-bg Ar colour
                   1368: Set status line message background colour, where
                   1369: .Ar colour
                   1370: is one of:
                   1371: .Ic black ,
                   1372: .Ic red ,
                   1373: .Ic green ,
                   1374: .Ic yellow ,
                   1375: .Ic blue ,
                   1376: .Ic magenta ,
                   1377: .Ic cyan ,
1.85      nicm     1378: .Ic white ,
                   1379: .Ic colour0
                   1380: to
                   1381: .Ic colour255
                   1382: from the 256-colour palette, or
1.1       nicm     1383: .Ic default .
                   1384: .It Ic message-fg Ar colour
                   1385: Set status line message foreground colour.
1.120     nicm     1386: .It Ic message-limit Ar number
                   1387: Set the number of error or information messages to save in the message log for
                   1388: each client.
                   1389: The default is 20.
1.102     nicm     1390: .It Xo Ic mouse-select-pane
                   1391: .Op Ic on | off
                   1392: .Xc
                   1393: If on,
                   1394: .Nm
                   1395: captures the mouse and when a window is split into multiple panes the mouse may
                   1396: be used to select the current pane.
                   1397: The mouse click is also passed through to the application as normal.
1.89      nicm     1398: .It Ic prefix Ar keys
                   1399: Set the keys accepted as a prefix key.
                   1400: .Ar keys
                   1401: is a comma-separated list of key names, each of which individually behave as
                   1402: the prefix key.
1.21      nicm     1403: .It Ic repeat-time Ar time
1.1       nicm     1404: Allow multiple commands to be entered without pressing the prefix-key again
                   1405: in the specified
1.21      nicm     1406: .Ar time
1.1       nicm     1407: milliseconds (the default is 500).
                   1408: Whether a key repeats may be set when it is bound using the
                   1409: .Fl r
                   1410: flag to
                   1411: .Ic bind-key .
1.52      nicm     1412: Repeat is enabled for the default keys bound to the
                   1413: .Ic resize-pane
                   1414: command.
1.1       nicm     1415: .It Xo Ic set-remain-on-exit
1.56      jmc      1416: .Op Ic on | off
1.1       nicm     1417: .Xc
                   1418: Set the
                   1419: .Ic remain-on-exit
                   1420: window option for any windows first created in this session.
                   1421: .It Xo Ic set-titles
1.56      jmc      1422: .Op Ic on | off
1.1       nicm     1423: .Xc
1.77      stsp     1424: Attempt to set the window title using the \ee]2;...\e007 xterm code if
1.1       nicm     1425: the terminal appears to be an xterm.
1.11      nicm     1426: This option is off by default.
1.6       jmc      1427: Note that elinks
1.1       nicm     1428: will only attempt to set the window title if the STY environment
                   1429: variable is set.
1.86      nicm     1430: .It Ic set-titles-string Ar string
                   1431: String used to set the window title if
                   1432: .Ic set-titles
                   1433: is on.
                   1434: Character sequences are replaced as for the
                   1435: .Ic status-left
                   1436: option.
1.1       nicm     1437: .It Xo Ic status
1.56      jmc      1438: .Op Ic on | off
1.1       nicm     1439: .Xc
                   1440: Show or hide the status line.
                   1441: .It Ic status-attr Ar attributes
                   1442: Set status line attributes.
                   1443: .It Ic status-bg Ar colour
                   1444: Set status line background colour.
                   1445: .It Ic status-fg Ar colour
                   1446: Set status line foreground colour.
                   1447: .It Ic status-interval Ar interval
                   1448: Update the status bar every
                   1449: .Ar interval
                   1450: seconds.
                   1451: By default, updates will occur every 15 seconds.
                   1452: A setting of zero disables redrawing at interval.
1.41      nicm     1453: .It Xo Ic status-justify
1.56      jmc      1454: .Op Ic left | centre | right
1.41      nicm     1455: .Xc
                   1456: Set the position of the window list component of the status line: left, centre
                   1457: or right justified.
1.1       nicm     1458: .It Xo Ic status-keys
1.56      jmc      1459: .Op Ic vi | emacs
1.1       nicm     1460: .Xc
1.6       jmc      1461: Use vi or emacs-style
1.1       nicm     1462: key bindings in the status line, for example at the command prompt.
                   1463: Defaults to emacs.
                   1464: .It Ic status-left Ar string
                   1465: Display
                   1466: .Ar string
                   1467: to the left of the status bar.
                   1468: .Ar string
                   1469: will be passed through
                   1470: .Xr strftime 3
                   1471: before being used.
                   1472: By default, the session name is shown.
                   1473: .Ar string
1.83      nicm     1474: may contain any of the following special character sequences:
1.1       nicm     1475: .Bl -column "Character pair" "Replaced with" -offset indent
                   1476: .It Sy "Character pair" Ta Sy "Replaced with"
                   1477: .It Li "#(command)" Ta "First line of command's output"
1.83      nicm     1478: .It Li "#[attributes]" Ta "Colour or attribute change"
1.1       nicm     1479: .It Li "#H" Ta "Hostname of local host"
1.125   ! nicm     1480: .It Li "#F" Ta "Current window flag"
1.35      nicm     1481: .It Li "#I" Ta "Current window index"
                   1482: .It Li "#P" Ta "Current pane index"
1.1       nicm     1483: .It Li "#S" Ta "Session name"
                   1484: .It Li "#T" Ta "Current window title"
1.35      nicm     1485: .It Li "#W" Ta "Current window name"
1.1       nicm     1486: .It Li "##" Ta "A literal" Ql #
                   1487: .El
1.83      nicm     1488: .Pp
                   1489: The #(command) form executes
                   1490: .Ql command
                   1491: as a shell command and inserts the first line of its output.
1.103     nicm     1492: Note that shell commands are only executed once at the interval specified by
                   1493: the
                   1494: .Ic status-interval
                   1495: option: if the status line is redrawn in the meantime, the previous result is
                   1496: used.
1.109     nicm     1497: .Pp
1.83      nicm     1498: #[attributes] allows a comma-separated list of attributes to be specified,
                   1499: these may be
                   1500: .Ql fg=colour
                   1501: to set the foreground colour,
                   1502: .Ql bg=colour
1.109     nicm     1503: to set the background colour, the name of one of the attributes (listed under the
1.83      nicm     1504: .Ic message-attr
1.109     nicm     1505: option) to turn an attribute on, or an attribute prefixed with
                   1506: .Ql no
                   1507: to turn one off, for example
                   1508: .Ic nobright .
1.83      nicm     1509: Examples are:
                   1510: .Bd -literal -offset indent
                   1511: #(sysctl vm.loadavg)
                   1512: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
                   1513: .Ed
1.1       nicm     1514: .Pp
1.109     nicm     1515: Where appropriate, special character sequences may be prefixed with a number to
                   1516: specify the maximum length, for example
1.1       nicm     1517: .Ql #24T .
1.10      nicm     1518: .Pp
1.12      jmc      1519: By default, UTF-8 in
1.10      nicm     1520: .Ar string
                   1521: is not interpreted, to enable UTF-8, use the
                   1522: .Ic status-utf8
                   1523: option.
1.62      nicm     1524: .It Ic status-left-attr Ar attributes
1.66      jmc      1525: Set the attribute of the left part of the status line.
1.62      nicm     1526: .It Ic status-left-fg Ar colour
                   1527: Set the foreground colour of the left part of the status line.
                   1528: .It Ic status-left-bg Ar colour
                   1529: Set the background colour of the left part of the status line.
1.1       nicm     1530: .It Ic status-left-length Ar length
                   1531: Set the maximum
                   1532: .Ar length
                   1533: of the left component of the status bar.
                   1534: The default is 10.
                   1535: .It Ic status-right Ar string
                   1536: Display
                   1537: .Ar string
                   1538: to the right of the status bar.
                   1539: By default, the date and time will be shown.
                   1540: As with
                   1541: .Ic status-left ,
                   1542: .Ar string
                   1543: will be passed to
1.10      nicm     1544: .Xr strftime 3 ,
                   1545: character pairs are replaced, and UTF-8 is dependent on the
                   1546: .Ic status-utf8
                   1547: option.
1.62      nicm     1548: .It Ic status-right-attr Ar attributes
1.66      jmc      1549: Set the attribute of the right part of the status line.
1.62      nicm     1550: .It Ic status-right-fg Ar colour
                   1551: Set the foreground colour of the right part of the status line.
                   1552: .It Ic status-right-bg Ar colour
                   1553: Set the background colour of the right part of the status line.
1.1       nicm     1554: .It Ic status-right-length Ar length
                   1555: Set the maximum
                   1556: .Ar length
                   1557: of the right component of the status bar.
                   1558: The default is 40.
1.10      nicm     1559: .Pp
                   1560: .It Xo Ic status-utf8
1.56      jmc      1561: .Op Ic on | off
1.10      nicm     1562: .Xc
                   1563: Instruct
                   1564: .Nm
                   1565: to treat top-bit-set characters in the
                   1566: .Ic status-left
                   1567: and
                   1568: .Ic status-right
                   1569: strings as UTF-8; notably, this is important for wide characters.
                   1570: This option defaults to off.
1.55      jmc      1571: .It Ic terminal-overrides Ar string
1.54      nicm     1572: Contains a list of entries which override terminal descriptions read using
                   1573: .Xr terminfo 5 .
                   1574: .Ar string
                   1575: is a comma-separated list of items each a colon-separated string made up of a
                   1576: terminal type pattern (matched using
                   1577: .Xr fnmatch 3 )
                   1578: and a set of
                   1579: .Em name=value
                   1580: entries.
                   1581: .Pp
                   1582: For example, to set the
                   1583: .Ql clear
                   1584: .Xr terminfo 5
                   1585: entry to
                   1586: .Ql \ee[H\ee[2J
                   1587: for all terminal types and the
                   1588: .Ql dch1
                   1589: entry to
                   1590: .Ql \ee[P
1.55      jmc      1591: for the
1.54      nicm     1592: .Ql rxvt
                   1593: terminal type, the option could be set to the string:
                   1594: .Bd -literal -offset indent
                   1595: "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
                   1596: .Ed
                   1597: .Pp
                   1598: The terminal entry value is passed through
                   1599: .Xr strunvis 3
                   1600: before interpretation.
                   1601: The default value forcibly corrects the
                   1602: .Ql colors
                   1603: entry for terminals which support 88 or 256 colours:
                   1604: .Bd -literal -offset indent
                   1605: "*88col*:colors=88,*256col*:colors=256"
                   1606: .Ed
1.63      nicm     1607: .It Ic update-environment Ar variables
                   1608: Set a space-separated string containing a list of environment variables to be
                   1609: copied into the session environment when a new session is created or an
                   1610: existing session is attached.
                   1611: Any variables that do not exist in the source environment are set to be
                   1612: removed from the session environment (as if
                   1613: .Fl r
                   1614: was given to the
                   1615: .Ic set-environment
                   1616: command).
                   1617: The default is
1.75      nicm     1618: "DISPLAY WINDOWID SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION".
1.37      nicm     1619: .It Xo Ic visual-activity
1.56      jmc      1620: .Op Ic on | off
1.37      nicm     1621: .Xc
                   1622: If on, display a status line message when activity occurs in a window
1.39      jmc      1623: for which the
1.37      nicm     1624: .Ic monitor-activity
                   1625: window option is enabled.
                   1626: .It Xo Ic visual-bell
1.56      jmc      1627: .Op Ic on | off
1.37      nicm     1628: .Xc
                   1629: If this option is on, a message is shown on a bell instead of it being passed
                   1630: through to the terminal (which normally makes a sound).
                   1631: Also see the
                   1632: .Ic bell-action
                   1633: option.
                   1634: .It Xo Ic visual-content
1.56      jmc      1635: .Op Ic on | off
1.37      nicm     1636: .Xc
                   1637: Like
                   1638: .Ic visual-activity ,
                   1639: display a message when content is present in a window
1.39      jmc      1640: for which the
1.37      nicm     1641: .Ic monitor-content
                   1642: window option is enabled.
1.1       nicm     1643: .El
                   1644: .It Xo Ic set-window-option
1.58      nicm     1645: .Op Fl agu
1.1       nicm     1646: .Op Fl t Ar target-window
                   1647: .Ar option Ar value
                   1648: .Xc
                   1649: .D1 (alias: Ic setw )
1.18      nicm     1650: Set a window option.
1.1       nicm     1651: The
1.58      nicm     1652: .Fl a ,
1.1       nicm     1653: .Fl g
                   1654: and
                   1655: .Fl u
                   1656: flags work similarly to the
                   1657: .Ic set-option
                   1658: command.
                   1659: .Pp
1.18      nicm     1660: Supported window options are:
1.56      jmc      1661: .Pp
                   1662: .Bl -tag -width Ds -compact
1.1       nicm     1663: .It Xo Ic aggressive-resize
1.56      jmc      1664: .Op Ic on | off
1.1       nicm     1665: .Xc
                   1666: Aggressively resize the chosen window.
                   1667: This means that
                   1668: .Nm
                   1669: will resize the window to the size of the smallest session for which it is the
                   1670: current window, rather than the smallest session to which it is attached.
                   1671: The window may resize when the current window is changed on another sessions;
1.6       jmc      1672: this option is good for full-screen programs which support
                   1673: .Dv SIGWINCH
                   1674: and poor for interactive programs such as shells.
1.56      jmc      1675: .Pp
1.1       nicm     1676: .It Xo Ic automatic-rename
1.56      jmc      1677: .Op Ic on | off
1.1       nicm     1678: .Xc
                   1679: Control automatic window renaming.
                   1680: When this setting is enabled,
                   1681: .Nm
                   1682: will attempt - on supported platforms - to rename the window to reflect the
                   1683: command currently running in it.
                   1684: This flag is automatically disabled for an individual window when a name
                   1685: is specified at creation with
                   1686: .Ic new-window or
                   1687: .Ic new-session ,
                   1688: or later with
                   1689: .Ic rename-window .
                   1690: It may be switched off globally with:
                   1691: .Bd -literal -offset indent
                   1692: set-window-option -g automatic-rename off
                   1693: .Ed
1.56      jmc      1694: .Pp
1.1       nicm     1695: .It Ic clock-mode-colour Ar colour
                   1696: Set clock colour.
1.56      jmc      1697: .Pp
1.1       nicm     1698: .It Xo Ic clock-mode-style
1.56      jmc      1699: .Op Ic 12 | 24
1.1       nicm     1700: .Xc
                   1701: Set clock hour format.
1.56      jmc      1702: .Pp
1.1       nicm     1703: .It Ic force-height Ar height
                   1704: .It Ic force-width Ar width
                   1705: Prevent
                   1706: .Nm
                   1707: from resizing a window to greater than
                   1708: .Ar width
                   1709: or
                   1710: .Ar height .
                   1711: A value of zero restores the default unlimited setting.
1.56      jmc      1712: .Pp
1.2       nicm     1713: .It Ic main-pane-width Ar width
                   1714: .It Ic main-pane-height Ar height
                   1715: Set the width or height of the main (left or top) pane in the
                   1716: .Ic main-horizontal
                   1717: or
                   1718: .Ic main-vertical
                   1719: layouts.
1.56      jmc      1720: .Pp
1.1       nicm     1721: .It Ic mode-attr Ar attributes
                   1722: Set window modes attributes.
1.56      jmc      1723: .Pp
1.1       nicm     1724: .It Ic mode-bg Ar colour
                   1725: Set window modes background colour.
1.56      jmc      1726: .Pp
1.1       nicm     1727: .It Ic mode-fg Ar colour
                   1728: Set window modes foreground colour.
1.56      jmc      1729: .Pp
1.1       nicm     1730: .It Xo Ic mode-keys
1.56      jmc      1731: .Op Ic vi | emacs
1.1       nicm     1732: .Xc
1.105     nicm     1733: Use vi or emacs-style key bindings in copy and choice modes.
1.1       nicm     1734: Key bindings default to emacs.
1.56      jmc      1735: .Pp
1.50      nicm     1736: .It Xo Ic mode-mouse
1.56      jmc      1737: .Op Ic on | off
1.50      nicm     1738: .Xc
1.51      jmc      1739: Mouse state in modes.
                   1740: If on,
1.50      nicm     1741: .Nm
                   1742: will respond to mouse clicks by moving the cursor in copy mode or selecting an
                   1743: option in choice mode.
1.56      jmc      1744: .Pp
1.1       nicm     1745: .It Xo Ic monitor-activity
1.56      jmc      1746: .Op Ic on | off
1.1       nicm     1747: .Xc
                   1748: Monitor for activity in the window.
                   1749: Windows with activity are highlighted in the status line.
1.56      jmc      1750: .Pp
                   1751: .It Ic monitor-content Ar match-string
1.6       jmc      1752: Monitor content in the window.
                   1753: When
1.16      nicm     1754: .Xr fnmatch 3
                   1755: pattern
1.1       nicm     1756: .Ar match-string
                   1757: appears in the window, it is highlighted in the status line.
1.56      jmc      1758: .Pp
1.1       nicm     1759: .It Xo Ic remain-on-exit
1.56      jmc      1760: .Op Ic on | off
1.1       nicm     1761: .Xc
                   1762: A window with this flag set is not destroyed when the program running in it
                   1763: exits.
                   1764: The window may be reactivated with the
                   1765: .Ic respawn-window
                   1766: command.
1.56      jmc      1767: .Pp
1.99      nicm     1768: .It Xo Ic synchronize-panes
                   1769: .Op Ic on | off
                   1770: .Xc
                   1771: Duplicate input to any pane to all other panes in the same window, except
                   1772: for panes that are not in output mode.
1.1       nicm     1773: .It Xo Ic utf8
1.56      jmc      1774: .Op Ic on | off
1.1       nicm     1775: .Xc
                   1776: Instructs
                   1777: .Nm
                   1778: to expect UTF-8 sequences to appear in this window.
1.56      jmc      1779: .Pp
1.1       nicm     1780: .It Ic window-status-attr Ar attributes
                   1781: Set status line attributes for a single window.
1.56      jmc      1782: .Pp
1.1       nicm     1783: .It Ic window-status-bg Ar colour
                   1784: Set status line background colour for a single window.
1.56      jmc      1785: .Pp
1.1       nicm     1786: .It Ic window-status-fg Ar colour
                   1787: Set status line foreground colour for a single window.
1.56      jmc      1788: .Pp
1.125   ! nicm     1789: .It Ic window-status-format Ar string
        !          1790: Set the format in which the window is displayed in the status line window list.
        !          1791: See the
        !          1792: .Ar status-left
        !          1793: option for details of special character sequences available.
        !          1794: The default is
        !          1795: .Ql #I:#W#F .
        !          1796: .Pp
1.40      nicm     1797: .It Ic window-status-current-attr Ar attributes
                   1798: Set status line attributes for the currently active window.
1.56      jmc      1799: .Pp
1.40      nicm     1800: .It Ic window-status-current-bg Ar colour
                   1801: Set status line background colour for the currently active window.
1.56      jmc      1802: .Pp
1.40      nicm     1803: .It Ic window-status-current-fg Ar colour
                   1804: Set status line foreground colour for the currently active window.
1.56      jmc      1805: .Pp
1.125   ! nicm     1806: .It Ic window-status-current-format Ar string
        !          1807: Like
        !          1808: .Ar window-status-format ,
        !          1809: but is the format used when the window is the current window.
        !          1810: .Pp
1.1       nicm     1811: .It Xo Ic xterm-keys
1.56      jmc      1812: .Op Ic on | off
1.1       nicm     1813: .Xc
                   1814: If this option is set,
                   1815: .Nm
                   1816: will generate
1.57      jmc      1817: .Xr xterm 1 -style
                   1818: function key sequences; these have a number included to indicate modifiers such
                   1819: as Shift, Alt or Ctrl.
1.123     nicm     1820: The default is off.
1.57      jmc      1821: .El
                   1822: .It Xo Ic show-options
                   1823: .Op Fl g
                   1824: .Op Fl t Ar target-session
                   1825: .Xc
                   1826: .D1 (alias: Ic show )
                   1827: Show the session options for
                   1828: .Ar target session ,
                   1829: or the global session options with
                   1830: .Fl g .
                   1831: .It Xo Ic show-window-options
                   1832: .Op Fl g
                   1833: .Op Fl t Ar target-window
                   1834: .Xc
                   1835: .D1 (alias: Ic showw )
                   1836: List the window options for
                   1837: .Ar target-window ,
                   1838: or the global window options if
                   1839: .Fl g
                   1840: is used.
1.63      nicm     1841: .El
                   1842: .Sh ENVIRONMENT
                   1843: When the server is started,
                   1844: .Nm
                   1845: copies the environment into the
                   1846: .Em global environment ;
                   1847: in addition, each session has a
                   1848: .Em session environment .
                   1849: When a window is created, the session and global environments are merged with
                   1850: the session environment overriding any variable present in both.
                   1851: This is the initial environment passed to the new process.
                   1852: .Pp
                   1853: The
                   1854: .Ic update-environment
                   1855: session option may be used to update the session environment from the client
                   1856: when a new session is created or an old reattached.
                   1857: .Nm
                   1858: also initialises the
                   1859: .Ev TMUX
                   1860: variable with some internal information to allow commands to be executed
                   1861: from inside, and the
                   1862: .Ev TERM
                   1863: variable with the correct terminal setting of
                   1864: .Ql screen .
                   1865: .Pp
                   1866: Commands to alter and view the environment are:
                   1867: .Bl -tag -width Ds
                   1868: .It Xo Ic set-environment
                   1869: .Op Fl gru
                   1870: .Op Fl t Ar target-session
                   1871: .Ar name Op Ar value
                   1872: .Xc
1.115     nicm     1873: .D1 (alias: Ic setenv )
1.63      nicm     1874: Set or unset an environment variable.
                   1875: If
                   1876: .Fl g
                   1877: is used, the change is made in the global environment; otherwise, it is applied
                   1878: to the session environment for
                   1879: .Ar target-session .
                   1880: The
                   1881: .Fl u
                   1882: flag unsets a variable.
                   1883: .Fl r
                   1884: indicates the variable is to be removed from the environment before starting a
                   1885: new process.
                   1886: .It Xo Ic show-environment
                   1887: .Op Fl g
                   1888: .Op Fl t Ar target-session
                   1889: .Xc
1.115     nicm     1890: .D1 (alias: Ic showenv )
1.63      nicm     1891: Display the environment for
                   1892: .Ar target-session
                   1893: or the global environment with
                   1894: .Fl g .
                   1895: Variables removed from the environment are prefixed with
                   1896: .Ql - .
1.57      jmc      1897: .El
                   1898: .Sh STATUS LINE
                   1899: .Nm
                   1900: includes an optional status line which is displayed in the bottom line of each
                   1901: terminal.
                   1902: By default, the status line is enabled (it may be disabled with the
                   1903: .Ic status
                   1904: session option) and contains, from left-to-right: the name of the current
                   1905: session in square brackets; the window list; the current window title in double
                   1906: quotes; and the time and date.
                   1907: .Pp
                   1908: The status line is made of three parts: configurable left and right sections
                   1909: (which may contain dynamic content such as the time or output from a shell
                   1910: command, see the
                   1911: .Ic status-left ,
                   1912: .Ic status-left-length ,
                   1913: .Ic status-right ,
                   1914: and
                   1915: .Ic status-right-length
                   1916: options below), and a central window list.
1.125   ! nicm     1917: By default, the window list shows the index, name and (if any) flag of the
        !          1918: windows present in the current session in ascending numerical order.
        !          1919: It may be customised with the
        !          1920: .Ar window-status-format
        !          1921: and
        !          1922: .Ar window-status-current-format
        !          1923: options.
1.57      jmc      1924: The flag is one of the following symbols appended to the window name:
                   1925: .Bl -column "Symbol" "Meaning" -offset indent
                   1926: .It Sy "Symbol" Ta Sy "Meaning"
                   1927: .It Li "*" Ta "Denotes the current window."
                   1928: .It Li "-" Ta "Marks the last window (previously selected)."
                   1929: .It Li "#" Ta "Window is monitored and activity has been detected."
                   1930: .It Li "!" Ta "A bell has occurred in the window."
                   1931: .It Li "+" Ta "Window is monitored for content and it has appeared."
                   1932: .El
                   1933: .Pp
                   1934: The # symbol relates to the
                   1935: .Ic monitor-activity
                   1936: and + to the
                   1937: .Ic monitor-content
                   1938: window options.
                   1939: The window name is printed in inverted colours if an alert (bell, activity or
                   1940: content) is present.
                   1941: .Pp
                   1942: The colour and attributes of the status line may be configured, the entire status line using
                   1943: the
                   1944: .Ic status-attr ,
                   1945: .Ic status-fg
                   1946: and
                   1947: .Ic status-bg
                   1948: session options and individual windows using the
                   1949: .Ic window-status-attr ,
                   1950: .Ic window-status-fg
                   1951: and
                   1952: .Ic window-status-bg
                   1953: window options.
                   1954: .Pp
                   1955: The status line is automatically refreshed at interval if it has changed, the interval may be
                   1956: controlled with the
                   1957: .Ic status-interval
                   1958: session option.
                   1959: .Pp
                   1960: Commands related to the status line are as follows:
                   1961: .Bl -tag -width Ds
                   1962: .It Xo Ic command-prompt
1.73      nicm     1963: .Op Fl p Ar prompts
1.57      jmc      1964: .Op Fl t Ar target-client
                   1965: .Op Ar template
                   1966: .Xc
                   1967: Open the command prompt in a client.
                   1968: This may be used from inside
                   1969: .Nm
                   1970: to execute commands interactively.
                   1971: If
                   1972: .Ar template
1.73      nicm     1973: is specified, it is used as the command.
                   1974: If
                   1975: .Fl p
                   1976: is given,
                   1977: .Ar prompts
                   1978: is a comma-separated list of prompts which are displayed in order; otherwise
                   1979: a single prompt is displayed, constructed from
                   1980: .Ar template
                   1981: if it is present, or
                   1982: .Ql \&:
                   1983: if not.
                   1984: Before the command is executed, the first occurrence of the string
                   1985: .Ql %%
1.74      jmc      1986: and all occurrences of
1.73      nicm     1987: .Ql %1
                   1988: are replaced by the response to the first prompt, the second
                   1989: .Ql %%
                   1990: and all
                   1991: .Ql %2
                   1992: are replaced with the response to the second prompt, and so on for further
1.74      jmc      1993: prompts.
                   1994: Up to nine prompt responses may be replaced
                   1995: .Po
                   1996: .Ql %1
1.73      nicm     1997: to
1.74      jmc      1998: .Ql %9
                   1999: .Pc .
1.57      jmc      2000: .It Xo Ic confirm-before
                   2001: .Op Fl t Ar target-client
                   2002: .Ar command
                   2003: .Xc
                   2004: .D1 (alias: Ic confirm )
                   2005: Ask for confirmation before executing
                   2006: .Ar command .
                   2007: This command works only from inside
                   2008: .Nm .
                   2009: .It Xo Ic display-message
                   2010: .Op Fl t Ar target-client
                   2011: .Op Ar message
                   2012: .Xc
                   2013: .D1 (alias: Ic display )
1.122     nicm     2014: Display a message in the status line.
                   2015: The format of
1.124     jmc      2016: .Ar message
                   2017: is as for
1.122     nicm     2018: .Ic status-left ,
                   2019: with the exception that #() are not handled.
1.57      jmc      2020: .It Ic select-prompt Op Fl t Ar target-client
                   2021: Open a prompt inside
                   2022: .Ar target-client
                   2023: allowing a window index to be entered interactively.
                   2024: .El
                   2025: .Sh BUFFERS
                   2026: .Nm
                   2027: maintains a stack of
                   2028: .Em paste buffers
                   2029: for each session.
                   2030: Up to the value of the
                   2031: .Ic buffer-limit
                   2032: option are kept; when a new buffer is added, the buffer at the bottom of the
                   2033: stack is removed.
                   2034: Buffers may be added using
                   2035: .Ic copy-mode
                   2036: or the
                   2037: .Ic set-buffer
                   2038: command, and pasted into a window using the
                   2039: .Ic paste-buffer
                   2040: command.
                   2041: .Pp
                   2042: A configurable history buffer is also maintained for each window.
                   2043: By default, up to 2000 lines are kept; this can be altered with the
                   2044: .Ic history-limit
                   2045: option (see the
                   2046: .Ic set-option
                   2047: command above).
                   2048: .Pp
                   2049: The buffer commands are as follows:
                   2050: .Bl -tag -width Ds
                   2051: .It Ic clear-history Op Fl t Ar target-pane
                   2052: .D1 (alias: Ic clearhist )
                   2053: Remove and free the history for the specified pane.
                   2054: .It Xo Ic copy-buffer
                   2055: .Op Fl a Ar src-index
                   2056: .Op Fl b Ar dst-index
                   2057: .Op Fl s Ar src-session
                   2058: .Op Fl t Ar dst-session
                   2059: .Xc
                   2060: .D1 (alias: Ic copyb )
                   2061: Copy a session paste buffer to another session.
                   2062: If no sessions are specified, the current one is used instead.
                   2063: .It Xo Ic delete-buffer
                   2064: .Op Fl b Ar buffer-index
                   2065: .Op Fl t Ar target-session
                   2066: .Xc
                   2067: .D1 (alias: Ic deleteb )
                   2068: Delete the buffer at
                   2069: .Ar buffer-index ,
                   2070: or the top buffer if not specified.
                   2071: .It Ic list-buffers Op Fl t Ar target-session
                   2072: .D1 (alias: Ic lsb )
                   2073: List the buffers in the given session.
                   2074: .It Xo Ic load-buffer
                   2075: .Op Fl b Ar buffer-index
                   2076: .Op Fl t Ar target-session
                   2077: .Ar path
                   2078: .Xc
                   2079: .D1 (alias: Ic loadb )
                   2080: Load the contents of the specified paste buffer from
                   2081: .Ar path .
                   2082: .It Xo Ic paste-buffer
                   2083: .Op Fl dr
                   2084: .Op Fl b Ar buffer-index
                   2085: .Op Fl t Ar target-window
                   2086: .Xc
                   2087: .D1 (alias: Ic pasteb )
                   2088: Insert the contents of a paste buffer into the current window.
                   2089: With
                   2090: .Fl d ,
                   2091: also delete the paste buffer from the stack.
                   2092: When output, any linefeed (LF) characters in the paste buffer are replaced with
                   2093: carriage returns (CR).
                   2094: This translation may be disabled with the
                   2095: .Fl r
                   2096: flag.
                   2097: .It Xo Ic save-buffer
                   2098: .Op Fl a
                   2099: .Op Fl b Ar buffer-index
                   2100: .Op Fl t Ar target-session
                   2101: .Ar path
                   2102: .Xc
                   2103: .D1 (alias: Ic saveb )
                   2104: Save the contents of the specified paste buffer to
                   2105: .Ar path .
                   2106: The
                   2107: .Fl a
                   2108: option appends to rather than overwriting the file.
                   2109: .It Xo Ic set-buffer
                   2110: .Op Fl b Ar buffer-index
                   2111: .Op Fl t Ar target-session
                   2112: .Ar data
                   2113: .Xc
                   2114: .D1 (alias: Ic setb )
                   2115: Set the contents of the specified buffer to
                   2116: .Ar data .
1.1       nicm     2117: .It Xo Ic show-buffer
                   2118: .Op Fl b Ar buffer-index
                   2119: .Op Fl t Ar target-session
                   2120: .Xc
                   2121: .D1 (alias: Ic showb )
                   2122: Display the contents of the specified buffer.
1.57      jmc      2123: .El
                   2124: .Sh MISCELLANEOUS
                   2125: .Pp
                   2126: Miscellaneous commands are as follows:
                   2127: .Bl -tag -width Ds
1.72      nicm     2128: .It Ic clock-mode Op Fl t Ar target-pane
1.57      jmc      2129: Display a large clock.
                   2130: .It Ic if-shell Ar shell-command command
                   2131: .D1 (alias: Ic if )
                   2132: Execute
                   2133: .Ar command
                   2134: if
                   2135: .Ar shell-command
                   2136: returns success.
                   2137: .It Ic lock-server
                   2138: .D1 (alias: Ic lock )
1.90      nicm     2139: Lock each client individually by running the command specified by the
                   2140: .Ic lock-command
                   2141: option.
1.87      nicm     2142: .It Ic run-shell Ar command
                   2143: .D1 (alias: Ic run )
                   2144: Execute
                   2145: .Ar command
1.106     nicm     2146: in the background without creating a window.
                   2147: After the command finishes, any output to stdout is displayed in output mode.
1.87      nicm     2148: If
1.88      jmc      2149: .Ar command
1.87      nicm     2150: doesn't return success, the exit status is also displayed.
1.57      jmc      2151: .It Ic server-info
                   2152: .D1 (alias: Ic info )
                   2153: Show server information and terminal details.
1.1       nicm     2154: .El
                   2155: .Sh FILES
1.26      nicm     2156: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1       nicm     2157: .It Pa ~/.tmux.conf
1.6       jmc      2158: Default
1.1       nicm     2159: .Nm
1.6       jmc      2160: configuration file.
1.26      nicm     2161: .It Pa /etc/tmux.conf
                   2162: System-wide configuration file.
1.1       nicm     2163: .El
1.57      jmc      2164: .Sh EXAMPLES
                   2165: To create a new
                   2166: .Nm
                   2167: session running
                   2168: .Xr vi 1 :
                   2169: .Pp
                   2170: .Dl $ tmux new-session vi
                   2171: .Pp
                   2172: Most commands have a shorter form, known as an alias.
                   2173: For new-session, this is
                   2174: .Ic new :
                   2175: .Pp
                   2176: .Dl $ tmux new vi
                   2177: .Pp
                   2178: Alternatively, the shortest unambiguous form of a command is accepted.
                   2179: If there are several options, they are listed:
                   2180: .Bd -literal -offset indent
                   2181: $ tmux n
                   2182: ambiguous command: n, could be: new-session, new-window, next-window
                   2183: .Ed
                   2184: .Pp
                   2185: Within an active session, a new window may be created by typing
                   2186: .Ql C-b c
                   2187: (Ctrl
                   2188: followed by the
                   2189: .Ql b
                   2190: key
                   2191: followed by the
                   2192: .Ql c
                   2193: key).
                   2194: .Pp
                   2195: Windows may be navigated with:
                   2196: .Ql C-b 0
                   2197: (to select window 0),
                   2198: .Ql C-b 1
                   2199: (to select window 1), and so on;
                   2200: .Ql C-b n
                   2201: to select the next window; and
                   2202: .Ql C-b p
                   2203: to select the previous window.
                   2204: .Pp
                   2205: A session may be detached using
                   2206: .Ql C-b d
1.64      nicm     2207: (or by an external event such as
                   2208: .Xr ssh 1
                   2209: disconnection) and reattached with:
1.57      jmc      2210: .Pp
                   2211: .Dl $ tmux attach-session
                   2212: .Pp
                   2213: Typing
                   2214: .Ql C-b \&?
                   2215: lists the current key bindings in the current window; up and down may be used
                   2216: to navigate the list or
                   2217: .Ql q
                   2218: to exit from it.
                   2219: .Pp
                   2220: Commands to be run when the
                   2221: .Nm
                   2222: server is started may be placed in the
                   2223: .Pa ~/.tmux.conf
                   2224: configuration file.
                   2225: Common examples include:
                   2226: .Pp
                   2227: Changing the default prefix key:
                   2228: .Bd -literal -offset indent
                   2229: set-option -g prefix C-a
                   2230: unbind-key C-b
                   2231: bind-key C-a send-prefix
                   2232: .Ed
                   2233: .Pp
                   2234: Turning the status line off, or changing its colour:
                   2235: .Bd -literal -offset indent
                   2236: set-option -g status off
                   2237: set-option -g status-bg blue
                   2238: .Ed
                   2239: .Pp
                   2240: Setting other options, such as the default command,
                   2241: or locking after 30 minutes of inactivity:
                   2242: .Bd -literal -offset indent
                   2243: set-option -g default-command "exec /bin/ksh"
                   2244: set-option -g lock-after-time 1800
                   2245: .Ed
                   2246: .Pp
                   2247: Creating new key bindings:
                   2248: .Bd -literal -offset indent
                   2249: bind-key b set-option status
                   2250: bind-key / command-prompt "split-window 'exec man %%'"
1.73      nicm     2251: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57      jmc      2252: .Ed
1.1       nicm     2253: .Sh SEE ALSO
                   2254: .Xr pty 4
                   2255: .Sh AUTHORS
                   2256: .An Nicholas Marriott Aq nicm@users.sourceforge.net