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

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