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

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