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

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