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

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