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

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