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

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