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

1.294   ! nicm        1: .\" $OpenBSD: tmux.1,v 1.293 2012/05/17 21:21:31 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.294   ! nicm       17: .Dd $Mdocdate: May 17 2012 $
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
1.270     nicm      388: is looked for in order: as a window index, for example mysession:1;
1.271     jmc       389: as a window ID, such as @1;
1.270     nicm      390: as an exact window name, such as mysession:mywindow; then as an
1.57      jmc       391: .Xr fnmatch 3
                    392: pattern or the start of a window name, such as mysession:mywin* or
                    393: mysession:mywin.
                    394: An empty window name specifies the next unused index if appropriate (for
                    395: example the
                    396: .Ic new-window
                    397: and
                    398: .Ic link-window
                    399: commands)
                    400: otherwise the current window in
                    401: .Em session
                    402: is chosen.
1.140     nicm      403: The special character
                    404: .Ql \&!
                    405: uses the last (previously current) window, or
                    406: .Ql +
                    407: and
                    408: .Ql -
                    409: are the next window or the previous window by number.
1.57      jmc       410: When the argument does not contain a colon,
                    411: .Nm
                    412: first attempts to parse it as window; if that fails, an attempt is made to
                    413: match a session.
1.1       nicm      414: .Pp
1.57      jmc       415: .Ar target-pane
                    416: takes a similar form to
                    417: .Ar target-window
                    418: but with the optional addition of a period followed by a pane index, for
                    419: example: mysession:mywindow.1.
                    420: If the pane index is omitted, the currently active pane in the specified
                    421: window is used.
                    422: If neither a colon nor period appears,
1.13      nicm      423: .Nm
1.57      jmc       424: first attempts to use the argument as a pane index; if that fails, it is looked
                    425: up as for
                    426: .Ar target-window .
1.156     nicm      427: A
                    428: .Ql +
                    429: or
                    430: .Ql -
                    431: indicate the next or previous pane index, respectively.
1.132     nicm      432: One of the strings
                    433: .Em top ,
                    434: .Em bottom ,
                    435: .Em left ,
                    436: .Em right ,
                    437: .Em top-left ,
                    438: .Em top-right ,
1.216     nicm      439: .Em bottom-left
                    440: or
1.132     nicm      441: .Em bottom-right
                    442: may be used instead of a pane index.
1.177     nicm      443: .Pp
                    444: The special characters
                    445: .Ql +
                    446: and
                    447: .Ql -
                    448: may be followed by an offset, for example:
                    449: .Bd -literal -offset indent
                    450: select-window -t:+2
                    451: .Ed
                    452: .Pp
                    453: When dealing with a session that doesn't contain sequential window indexes,
                    454: they will be correctly skipped.
1.212     nicm      455: .Pp
                    456: .Nm
                    457: also gives each pane created in a server an identifier consisting of a
                    458: .Ql %
                    459: and a number, starting from zero.
                    460: A pane's identifier is unique for the life of the
                    461: .Nm
                    462: server and is passed to the child process of the pane in the
                    463: .Ev TMUX_PANE
                    464: environment variable.
                    465: It may be used alone to target a pane or the window containing it.
1.15      jmc       466: .Pp
1.153     nicm      467: .Ar shell-command
                    468: arguments are
                    469: .Xr sh 1
                    470: commands.
                    471: These must be passed as a single item, which typically means quoting them, for
                    472: example:
                    473: .Bd -literal -offset indent
                    474: new-window 'vi /etc/passwd'
                    475: .Ed
                    476: .Pp
                    477: .Ar command
                    478: .Op Ar arguments
                    479: refers to a
                    480: .Nm
                    481: command, passed with the command and arguments separately, for example:
                    482: .Bd -literal -offset indent
                    483: bind-key F1 set-window-option force-width 81
                    484: .Ed
                    485: .Pp
                    486: Or if using
                    487: .Xr sh 1 :
                    488: .Bd -literal -offset indent
                    489: $ tmux bind-key F1 set-window-option force-width 81
                    490: .Ed
                    491: .Pp
1.57      jmc       492: Multiple commands may be specified together as part of a
                    493: .Em command sequence .
                    494: Each command should be separated by spaces and a semicolon;
1.244     nicm      495: commands are executed sequentially from left to right and
1.293     nicm      496: lines ending with a backslash continue on to the next line,
                    497: except when escaped by another backslash.
1.57      jmc       498: A literal semicolon may be included by escaping it with a backslash (for
                    499: example, when specifying a command sequence to
                    500: .Ic bind-key ) .
1.13      nicm      501: .Pp
1.153     nicm      502: Example
                    503: .Nm
                    504: commands include:
1.13      nicm      505: .Bd -literal -offset indent
1.57      jmc       506: refresh-client -t/dev/ttyp2
                    507:
                    508: rename-session -tfirst newname
                    509:
                    510: set-window-option -t:0 monitor-activity on
                    511:
                    512: new-window ; split-window -d
1.244     nicm      513:
                    514: bind-key R source-file ~/.tmux.conf \e; \e
                    515:        display-message "source-file done"
1.13      nicm      516: .Ed
1.153     nicm      517: .Pp
                    518: Or from
                    519: .Xr sh 1 :
                    520: .Bd -literal -offset indent
                    521: $ tmux kill-window -t :1
                    522:
1.159     jmc       523: $ tmux new-window \e; split-window -d
1.153     nicm      524:
1.159     jmc       525: $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
1.153     nicm      526: .Ed
1.57      jmc       527: .Sh CLIENTS AND SESSIONS
1.153     nicm      528: The
                    529: .Nm
                    530: server manages clients, sessions, windows and panes.
                    531: Clients are attached to sessions to interact with them, either
                    532: when they are created with the
                    533: .Ic new-session
                    534: command, or later with the
                    535: .Ic attach-session
                    536: command.
1.188     nicm      537: Each session has one or more windows
1.153     nicm      538: .Em linked
                    539: into it.
                    540: Windows may be linked to multiple sessions and are made up of one or
                    541: more panes,
                    542: each of which contains a pseudo terminal.
                    543: Commands for creating, linking and otherwise manipulating windows
                    544: are covered
                    545: in the
                    546: .Sx WINDOWS AND PANES
                    547: section.
                    548: .Pp
                    549: The following commands are available to manage clients and sessions:
1.57      jmc       550: .Bl -tag -width Ds
                    551: .It Xo Ic attach-session
1.148     nicm      552: .Op Fl dr
1.57      jmc       553: .Op Fl t Ar target-session
                    554: .Xc
                    555: .D1 (alias: Ic attach )
                    556: If run from outside
                    557: .Nm ,
                    558: create a new client in the current terminal and attach it to
                    559: .Ar target-session .
                    560: If used from inside, switch the current client.
                    561: If
                    562: .Fl d
                    563: is specified, any other clients attached to the session are detached.
1.148     nicm      564: .Fl r
                    565: signifies the client is read-only (only keys bound to the
                    566: .Ic detach-client
1.242     nicm      567: or
                    568: .Ic switch-client
                    569: commands have any effect)
1.13      nicm      570: .Pp
1.57      jmc       571: If no server is started,
                    572: .Ic attach-session
                    573: will attempt to start it; this will fail unless sessions are created in the
                    574: configuration file.
1.217     nicm      575: .Pp
                    576: The
                    577: .Ar target-session
                    578: rules for
                    579: .Ic attach-session
                    580: are slightly adjusted: if
                    581: .Nm
                    582: needs to select the most recently used session, it will prefer the most
                    583: recently used
                    584: .Em unattached
                    585: session.
1.211     nicm      586: .It Xo Ic detach-client
                    587: .Op Fl P
1.219     nicm      588: .Op Fl s Ar target-session
1.211     nicm      589: .Op Fl t Ar target-client
                    590: .Xc
1.57      jmc       591: .D1 (alias: Ic detach )
1.218     nicm      592: Detach the current client if bound to a key, the client specified with
                    593: .Fl t ,
1.258     jmc       594: or all clients currently attached to the session specified by
1.218     nicm      595: .Fl s .
1.211     nicm      596: If
                    597: .Fl P
                    598: is given, send SIGHUP to the parent process of the client, typically causing it
                    599: to exit.
1.57      jmc       600: .It Ic has-session Op Fl t Ar target-session
                    601: .D1 (alias: Ic has )
                    602: Report an error and exit with 1 if the specified session does not exist.
                    603: If it does exist, exit with 0.
                    604: .It Ic kill-server
                    605: Kill the
1.1       nicm      606: .Nm
1.57      jmc       607: server and clients and destroy all sessions.
                    608: .It Ic kill-session Op Fl t Ar target-session
                    609: Destroy the given session, closing any windows linked to it and no other
                    610: sessions, and detaching all clients attached to it.
1.250     nicm      611: .It Xo Ic list-clients
                    612: .Op Fl F Ar format
                    613: .Op Fl t Ar target-session
                    614: .Xc
1.57      jmc       615: .D1 (alias: Ic lsc )
1.221     jmc       616: List all clients attached to the server.
1.250     nicm      617: For the meaning of the
                    618: .Fl F
                    619: flag, see the
1.252     jmc       620: .Sx FORMATS
                    621: section.
1.221     jmc       622: If
1.220     nicm      623: .Ar target-session
                    624: is specified, list only clients connected to that session.
1.57      jmc       625: .It Ic list-commands
                    626: .D1 (alias: Ic lscm )
                    627: List the syntax of all commands supported by
                    628: .Nm .
1.247     nicm      629: .It Ic list-sessions Op Fl F Ar format
1.57      jmc       630: .D1 (alias: Ic ls )
                    631: List all sessions managed by the server.
1.247     nicm      632: For the meaning of the
                    633: .Fl F
                    634: flag, see the
                    635: .Sx FORMATS
                    636: section.
1.175     nicm      637: .It Ic lock-client Op Fl t Ar target-client
                    638: .D1 (alias: Ic lockc )
1.92      nicm      639: Lock
                    640: .Ar target-client ,
                    641: see the
                    642: .Ic lock-server
                    643: command.
1.175     nicm      644: .It Ic lock-session Op Fl t Ar target-session
                    645: .D1 (alias: Ic locks )
1.92      nicm      646: Lock all clients attached to
                    647: .Ar target-session .
1.57      jmc       648: .It Xo Ic new-session
                    649: .Op Fl d
                    650: .Op Fl n Ar window-name
                    651: .Op Fl s Ar session-name
1.101     nicm      652: .Op Fl t Ar target-session
1.210     nicm      653: .Op Fl x Ar width
                    654: .Op Fl y Ar height
1.153     nicm      655: .Op Ar shell-command
1.57      jmc       656: .Xc
                    657: .D1 (alias: Ic new )
                    658: Create a new session with name
                    659: .Ar session-name .
1.153     nicm      660: .Pp
1.57      jmc       661: The new session is attached to the current terminal unless
                    662: .Fl d
                    663: is given.
                    664: .Ar window-name
1.1       nicm      665: and
1.153     nicm      666: .Ar shell-command
                    667: are the name of and shell command to execute in the initial window.
1.210     nicm      668: If
                    669: .Fl d
                    670: is used,
                    671: .Fl x
                    672: and
                    673: .Fl y
                    674: specify the size of the initial window (80 by 24 if not given).
1.68      nicm      675: .Pp
                    676: If run from a terminal, any
                    677: .Xr termios 4
                    678: special characters are saved and used for new windows in the new session.
1.101     nicm      679: .Pp
                    680: If
                    681: .Fl t
                    682: is given, the new session is
                    683: .Em grouped
                    684: with
                    685: .Ar target-session .
                    686: This means they share the same set of windows - all windows from
                    687: .Ar target-session
                    688: are linked to the new session and any subsequent new windows or windows being
                    689: closed are applied to both sessions.
                    690: The current and previous window and any session options remain independent and
                    691: either session may be killed without affecting the other.
                    692: Giving
                    693: .Fl n
                    694: or
1.153     nicm      695: .Ar shell-command
1.101     nicm      696: are invalid if
                    697: .Fl t
                    698: is used.
1.248     nicm      699: .It Xo Ic refresh-client
                    700: .Op Fl S
                    701: .Op Fl t Ar target-client
                    702: .Xc
1.57      jmc       703: .D1 (alias: Ic refresh )
                    704: Refresh the current client if bound to a key, or a single client if one is given
                    705: with
                    706: .Fl t .
1.248     nicm      707: If
                    708: .Fl S
                    709: is specified, only update the client's status bar.
1.57      jmc       710: .It Xo Ic rename-session
                    711: .Op Fl t Ar target-session
                    712: .Ar new-name
                    713: .Xc
                    714: .D1 (alias: Ic rename )
                    715: Rename the session to
                    716: .Ar new-name .
1.121     nicm      717: .It Xo Ic show-messages
1.120     nicm      718: .Op Fl t Ar target-client
                    719: .Xc
                    720: .D1 (alias: Ic showmsgs )
                    721: Any messages displayed on the status line are saved in a per-client message
                    722: log, up to a maximum of the limit set by the
                    723: .Ar message-limit
                    724: session option for the session attached to that client.
                    725: This command displays the log for
                    726: .Ar target-client .
1.57      jmc       727: .It Ic source-file Ar path
                    728: .D1 (alias: Ic source )
                    729: Execute commands from
                    730: .Ar path .
                    731: .It Ic start-server
                    732: .D1 (alias: Ic start )
                    733: Start the
1.1       nicm      734: .Nm
1.57      jmc       735: server, if not already running, without creating any sessions.
                    736: .It Xo Ic suspend-client
1.202     nicm      737: .Op Fl t Ar target-client
1.57      jmc       738: .Xc
                    739: .D1 (alias: Ic suspendc )
                    740: Suspend a client by sending
                    741: .Dv SIGTSTP
                    742: (tty stop).
                    743: .It Xo Ic switch-client
1.242     nicm      744: .Op Fl lnpr
1.57      jmc       745: .Op Fl c Ar target-client
                    746: .Op Fl t Ar target-session
                    747: .Xc
                    748: .D1 (alias: Ic switchc )
                    749: Switch the current session for client
                    750: .Ar target-client
                    751: to
                    752: .Ar target-session .
1.183     nicm      753: If
1.197     jmc       754: .Fl l ,
1.183     nicm      755: .Fl n
                    756: or
                    757: .Fl p
1.194     nicm      758: is used, the client is moved to the last, next or previous session
                    759: respectively.
1.242     nicm      760: .Fl r
                    761: toggles whether a client is read-only (see the
                    762: .Ic attach-session
                    763: command).
1.57      jmc       764: .El
                    765: .Sh WINDOWS AND PANES
1.1       nicm      766: A
                    767: .Nm
                    768: window may be in one of several modes.
                    769: The default permits direct access to the terminal attached to the window.
1.164     nicm      770: The other is copy mode, which permits a section of a window or its
                    771: history to be copied to a
1.1       nicm      772: .Em paste buffer
                    773: for later insertion into another window.
                    774: This mode is entered with the
                    775: .Ic copy-mode
                    776: command, bound to
1.113     nicm      777: .Ql \&[
1.1       nicm      778: by default.
1.164     nicm      779: It is also entered when a command that produces output, such as
                    780: .Ic list-keys ,
                    781: is executed from a key binding.
1.1       nicm      782: .Pp
1.6       jmc       783: The keys available depend on whether emacs or vi mode is selected
                    784: (see the
1.1       nicm      785: .Ic mode-keys
                    786: option).
                    787: The following keys are supported as appropriate for the mode:
1.157     nicm      788: .Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
1.1       nicm      789: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
1.27      nicm      790: .It Li "Back to indentation" Ta "^" Ta "M-m"
1.142     nicm      791: .It Li "Bottom of history" Ta "G" Ta "M-<"
1.1       nicm      792: .It Li "Clear selection" Ta "Escape" Ta "C-g"
                    793: .It Li "Copy selection" Ta "Enter" Ta "M-w"
                    794: .It Li "Cursor down" Ta "j" Ta "Down"
1.70      nicm      795: .It Li "Cursor left" Ta "h" Ta "Left"
                    796: .It Li "Cursor right" Ta "l" Ta "Right"
1.116     nicm      797: .It Li "Cursor to bottom line" Ta "L" Ta ""
                    798: .It Li "Cursor to middle line" Ta "M" Ta "M-r"
                    799: .It Li "Cursor to top line" Ta "H" Ta "M-R"
1.70      nicm      800: .It Li "Cursor up" Ta "k" Ta "Up"
1.71      nicm      801: .It Li "Delete entire line" Ta "d" Ta "C-u"
1.227     nicm      802: .It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
1.1       nicm      803: .It Li "End of line" Ta "$" Ta "C-e"
1.142     nicm      804: .It Li "Go to line" Ta ":" Ta "g"
1.116     nicm      805: .It Li "Half page down" Ta "C-d" Ta "M-Down"
                    806: .It Li "Half page up" Ta "C-u" Ta "M-Up"
1.157     nicm      807: .It Li "Jump forward" Ta "f" Ta "f"
1.256     nicm      808: .It Li "Jump to forward" Ta "t" Ta ""
1.157     nicm      809: .It Li "Jump backward" Ta "F" Ta "F"
1.256     nicm      810: .It Li "Jump to backward" Ta "T" Ta ""
1.157     nicm      811: .It Li "Jump again" Ta ";" Ta ";"
                    812: .It Li "Jump again in reverse" Ta "," Ta ","
1.1       nicm      813: .It Li "Next page" Ta "C-f" Ta "Page down"
1.146     nicm      814: .It Li "Next space" Ta "W" Ta ""
                    815: .It Li "Next space, end of word" Ta "E" Ta ""
1.143     nicm      816: .It Li "Next word" Ta "w" Ta ""
                    817: .It Li "Next word end" Ta "e" Ta "M-f"
1.70      nicm      818: .It Li "Paste buffer" Ta "p" Ta "C-y"
1.116     nicm      819: .It Li "Previous page" Ta "C-b" Ta "Page up"
1.1       nicm      820: .It Li "Previous word" Ta "b" Ta "M-b"
1.146     nicm      821: .It Li "Previous space" Ta "B" Ta ""
1.1       nicm      822: .It Li "Quit mode" Ta "q" Ta "Escape"
1.147     nicm      823: .It Li "Rectangle toggle" Ta "v" Ta "R"
1.141     nicm      824: .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
                    825: .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
1.70      nicm      826: .It Li "Search again" Ta "n" Ta "n"
1.152     nicm      827: .It Li "Search again in reverse" Ta "N" Ta "N"
1.70      nicm      828: .It Li "Search backward" Ta "?" Ta "C-r"
                    829: .It Li "Search forward" Ta "/" Ta "C-s"
                    830: .It Li "Start of line" Ta "0" Ta "C-a"
1.1       nicm      831: .It Li "Start selection" Ta "Space" Ta "C-Space"
1.142     nicm      832: .It Li "Top of history" Ta "g" Ta "M->"
1.80      nicm      833: .It Li "Transpose chars" Ta "" Ta "C-t"
1.1       nicm      834: .El
1.146     nicm      835: .Pp
                    836: The next and previous word keys use space and the
                    837: .Ql - ,
1.154     nicm      838: .Ql _
1.146     nicm      839: and
                    840: .Ql @
1.154     nicm      841: characters as word delimiters by default, but this can be adjusted by
                    842: setting the
                    843: .Em word-separators
1.255     nicm      844: session option.
1.146     nicm      845: Next word moves to the start of the next word, next word end to the end of the
                    846: next word and previous word to the start of the previous word.
                    847: The three next and previous space keys work similarly but use a space alone as
                    848: the word separator.
1.157     nicm      849: .Pp
                    850: The jump commands enable quick movement within a line.
                    851: For instance, typing
                    852: .Ql f
                    853: followed by
                    854: .Ql /
                    855: will move the cursor to the next
                    856: .Ql /
                    857: character on the current line.
                    858: A
                    859: .Ql \&;
                    860: will then jump to the next occurrence.
1.1       nicm      861: .Pp
1.155     nicm      862: Commands in copy mode may be prefaced by an optional repeat count.
                    863: With vi key bindings, a prefix is entered using the number keys; with
                    864: emacs, the Alt (meta) key and a number begins prefix entry.
                    865: For example, to move the cursor forward by ten words, use
                    866: .Ql M-1 0 M-f
                    867: in emacs mode, and
                    868: .Ql 10w
                    869: in vi.
                    870: .Pp
1.254     nicm      871: When copying the selection, the repeat count indicates the buffer index to
                    872: replace, if used.
                    873: .Pp
1.155     nicm      874: Mode key bindings are defined in a set of named tables:
1.48      nicm      875: .Em vi-edit
                    876: and
                    877: .Em emacs-edit
                    878: for keys used when line editing at the command prompt;
                    879: .Em vi-choice
                    880: and
                    881: .Em emacs-choice
                    882: for keys used when choosing from lists (such as produced by the
1.144     nicm      883: .Ic choose-window
1.164     nicm      884: command); and
1.48      nicm      885: .Em vi-copy
                    886: and
                    887: .Em emacs-copy
1.97      nicm      888: used in copy mode.
1.48      nicm      889: The tables may be viewed with the
                    890: .Ic list-keys
1.49      nicm      891: command and keys modified or removed with
                    892: .Ic bind-key
                    893: and
                    894: .Ic unbind-key .
1.48      nicm      895: .Pp
1.2       nicm      896: The paste buffer key pastes the first line from the top paste buffer on the
                    897: stack.
1.57      jmc       898: .Pp
1.164     nicm      899: The synopsis for the
                    900: .Ic copy-mode
                    901: command is:
1.57      jmc       902: .Bl -tag -width Ds
                    903: .It Xo Ic copy-mode
                    904: .Op Fl u
1.72      nicm      905: .Op Fl t Ar target-pane
1.57      jmc       906: .Xc
                    907: Enter copy mode.
                    908: The
                    909: .Fl u
                    910: option scrolls one page up.
                    911: .El
1.18      nicm      912: .Pp
1.1       nicm      913: Each window displayed by
                    914: .Nm
                    915: may be split into one or more
                    916: .Em panes ;
                    917: each pane takes up a certain area of the display and is a separate terminal.
                    918: A window may be split into panes using the
                    919: .Ic split-window
                    920: command.
1.38      nicm      921: Windows may be split horizontally (with the
                    922: .Fl h
                    923: flag) or vertically.
                    924: Panes may be resized with the
                    925: .Ic resize-pane
1.1       nicm      926: command (bound to
1.38      nicm      927: .Ql C-up ,
                    928: .Ql C-down
                    929: .Ql C-left
                    930: and
                    931: .Ql C-right
1.1       nicm      932: by default), the current pane may be changed with the
1.156     nicm      933: .Ic select-pane
                    934: command and the
1.1       nicm      935: .Ic rotate-window
                    936: and
                    937: .Ic swap-pane
1.38      nicm      938: commands may be used to swap panes without changing their position.
                    939: Panes are numbered beginning from zero in the order they are created.
                    940: .Pp
                    941: A number of preset
                    942: .Em layouts
                    943: are available.
                    944: These may be selected with the
                    945: .Ic select-layout
                    946: command or cycled with
                    947: .Ic next-layout
                    948: (bound to
1.149     nicm      949: .Ql Space
1.131     nicm      950: by default); once a layout is chosen, panes within it may be moved and resized
                    951: as normal.
1.1       nicm      952: .Pp
                    953: The following layouts are supported:
                    954: .Bl -tag -width Ds
                    955: .It Ic even-horizontal
                    956: Panes are spread out evenly from left to right across the window.
                    957: .It Ic even-vertical
                    958: Panes are spread evenly from top to bottom.
1.2       nicm      959: .It Ic main-horizontal
1.131     nicm      960: A large (main) pane is shown at the top of the window and the remaining panes
                    961: are spread from left to right in the leftover space at the bottom.
1.2       nicm      962: Use the
                    963: .Em main-pane-height
                    964: window option to specify the height of the top pane.
1.1       nicm      965: .It Ic main-vertical
1.2       nicm      966: Similar to
                    967: .Ic main-horizontal
                    968: but the large pane is placed on the left and the others spread from top to
                    969: bottom along the right.
                    970: See the
                    971: .Em main-pane-width
                    972: window option.
1.165     nicm      973: .It Ic tiled
                    974: Panes are spread out as evenly as possible over the window in both rows and
                    975: columns.
1.1       nicm      976: .El
1.8       nicm      977: .Pp
1.181     nicm      978: In addition,
                    979: .Ic select-layout
                    980: may be used to apply a previously used layout - the
                    981: .Ic list-windows
                    982: command displays the layout of each window in a form suitable for use with
                    983: .Ic select-layout .
                    984: For example:
                    985: .Bd -literal -offset indent
                    986: $ tmux list-windows
                    987: 0: ksh [159x48]
                    988:     layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
                    989: $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
                    990: .Ed
1.196     nicm      991: .Pp
1.181     nicm      992: .Nm
                    993: automatically adjusts the size of the layout for the current window size.
                    994: Note that a layout cannot be applied to a window with more panes than that
                    995: from which the layout was originally defined.
                    996: .Pp
1.57      jmc       997: Commands related to windows and panes are as follows:
                    998: .Bl -tag -width Ds
                    999: .It Xo Ic break-pane
1.280     nicm     1000: .Op Fl dP
                   1001: .Op Fl F Ar format
1.57      jmc      1002: .Op Fl t Ar target-pane
                   1003: .Xc
                   1004: .D1 (alias: Ic breakp )
                   1005: Break
                   1006: .Ar target-pane
                   1007: off from its containing window to make it the only pane in a new window.
                   1008: If
                   1009: .Fl d
                   1010: is given, the new window does not become the current window.
1.280     nicm     1011: The
                   1012: .Fl P
                   1013: option prints information about the new window after it has been created.
                   1014: By default, it uses the format
                   1015: .Ql #{session_name}:#{window_index}
                   1016: but a different format may be specified with
                   1017: .Fl F .
1.128     nicm     1018: .It Xo Ic capture-pane
                   1019: .Op Fl b Ar buffer-index
1.213     nicm     1020: .Op Fl E Ar end-line
                   1021: .Op Fl S Ar start-line
1.128     nicm     1022: .Op Fl t Ar target-pane
                   1023: .Xc
                   1024: .D1 (alias: Ic capturep )
                   1025: Capture the contents of a pane to the specified buffer, or a new buffer if none
                   1026: is specified.
1.213     nicm     1027: .Pp
                   1028: .Fl S
                   1029: and
                   1030: .Fl E
                   1031: specify the starting and ending line numbers, zero is the first line of the
                   1032: visible pane and negative numbers are lines in the history.
                   1033: The default is to capture only the visible contents of the pane.
1.76      nicm     1034: .It Xo
                   1035: .Ic choose-client
1.294   ! nicm     1036: .Op Fl F Ar format
1.76      nicm     1037: .Op Fl t Ar target-window
                   1038: .Op Ar template
                   1039: .Xc
                   1040: Put a window into client choice mode, allowing a client to be selected
                   1041: interactively from a list.
                   1042: After a client is chosen,
                   1043: .Ql %%
                   1044: is replaced by the client
                   1045: .Xr pty 4
                   1046: path in
                   1047: .Ar template
                   1048: and the result executed as a command.
                   1049: If
                   1050: .Ar template
                   1051: is not given, "detach-client -t '%%'" is used.
1.294   ! nicm     1052: For the meaning of the
        !          1053: .Fl F
        !          1054: flag, see the
        !          1055: .Sx FORMATS
        !          1056: section.
1.57      jmc      1057: This command works only from inside
                   1058: .Nm .
1.76      nicm     1059: .It Xo
                   1060: .Ic choose-session
1.294   ! nicm     1061: .Op Fl F Ar format
1.76      nicm     1062: .Op Fl t Ar target-window
                   1063: .Op Ar template
                   1064: .Xc
                   1065: Put a window into session choice mode, where a session may be selected
                   1066: interactively from a list.
                   1067: When one is chosen,
                   1068: .Ql %%
                   1069: is replaced by the session name in
                   1070: .Ar template
                   1071: and the result executed as a command.
                   1072: If
                   1073: .Ar template
                   1074: is not given, "switch-client -t '%%'" is used.
1.294   ! nicm     1075: For the meaning of the
        !          1076: .Fl F
        !          1077: flag, see the
        !          1078: .Sx FORMATS
        !          1079: section.
1.76      nicm     1080: This command works only from inside
                   1081: .Nm .
                   1082: .It Xo
                   1083: .Ic choose-window
1.294   ! nicm     1084: .Op Fl F Ar format
1.76      nicm     1085: .Op Fl t Ar target-window
                   1086: .Op Ar template
                   1087: .Xc
                   1088: Put a window into window choice mode, where a window may be chosen
                   1089: interactively from a list.
                   1090: After a window is selected,
                   1091: .Ql %%
                   1092: is replaced by the session name and window index in
                   1093: .Ar template
                   1094: and the result executed as a command.
                   1095: If
                   1096: .Ar template
                   1097: is not given, "select-window -t '%%'" is used.
1.294   ! nicm     1098: For the meaning of the
        !          1099: .Fl F
        !          1100: flag, see the
        !          1101: .Sx FORMATS
        !          1102: section.
1.57      jmc      1103: This command works only from inside
                   1104: .Nm .
1.78      nicm     1105: .It Ic display-panes Op Fl t Ar target-client
                   1106: .D1 (alias: Ic displayp)
                   1107: Display a visible indicator of each pane shown by
                   1108: .Ar target-client .
                   1109: See the
1.145     nicm     1110: .Ic display-panes-time ,
                   1111: .Ic display-panes-colour ,
1.78      nicm     1112: and
1.145     nicm     1113: .Ic display-panes-active-colour
1.78      nicm     1114: session options.
1.84      nicm     1115: While the indicator is on screen, a pane may be selected with the
                   1116: .Ql 0
                   1117: to
                   1118: .Ql 9
                   1119: keys.
1.57      jmc      1120: .It Xo Ic find-window
1.285     nicm     1121: .Op Fl CNT
1.294   ! nicm     1122: .Op Fl F Ar format
1.57      jmc      1123: .Op Fl t Ar target-window
                   1124: .Ar match-string
                   1125: .Xc
                   1126: .D1 (alias: Ic findw )
                   1127: Search for the
                   1128: .Xr fnmatch 3
                   1129: pattern
                   1130: .Ar match-string
                   1131: in window names, titles, and visible content (but not history).
1.285     nicm     1132: The flags control matching behavior:
                   1133: .Fl C
                   1134: matches only visible window contents,
                   1135: .Fl N
                   1136: matches only the window name and
                   1137: .Fl T
                   1138: matches only the window title.
                   1139: The default is
                   1140: .Fl CNT .
                   1141: If only one window is matched, it'll be automatically selected,
                   1142: otherwise a choice list is shown.
1.294   ! nicm     1143: For the meaning of the
        !          1144: .Fl F
        !          1145: flag, see the
        !          1146: .Sx FORMATS
        !          1147: section.
1.57      jmc      1148: This command only works from inside
1.1       nicm     1149: .Nm .
1.137     nicm     1150: .It Xo Ic join-pane
1.277     nicm     1151: .Op Fl bdhv
1.137     nicm     1152: .Oo Fl l
                   1153: .Ar size |
                   1154: .Fl p Ar percentage Oc
                   1155: .Op Fl s Ar src-pane
                   1156: .Op Fl t Ar dst-pane
                   1157: .Xc
                   1158: .D1 (alias: Ic joinp )
                   1159: Like
                   1160: .Ic split-window ,
                   1161: but instead of splitting
                   1162: .Ar dst-pane
                   1163: and creating a new pane, split it and move
                   1164: .Ar src-pane
                   1165: into the space.
                   1166: This can be used to reverse
                   1167: .Ic break-pane .
1.277     nicm     1168: The
                   1169: .Fl b
                   1170: option causes
                   1171: .Ar src-pane
                   1172: to be joined to left of or above
                   1173: .Ar dst-pane .
1.112     nicm     1174: .It Xo Ic kill-pane
                   1175: .Op Fl a
                   1176: .Op Fl t Ar target-pane
                   1177: .Xc
1.57      jmc      1178: .D1 (alias: Ic killp )
                   1179: Destroy the given pane.
                   1180: If no panes remain in the containing window, it is also destroyed.
1.112     nicm     1181: The
                   1182: .Fl a
                   1183: option kills all but the pane given with
                   1184: .Fl t .
1.289     nicm     1185: .It Xo Ic kill-window
                   1186: .Op Fl a
                   1187: .Op Fl t Ar target-window
                   1188: .Xc
1.57      jmc      1189: .D1 (alias: Ic killw )
                   1190: Kill the current window or the window at
                   1191: .Ar target-window ,
1.1       nicm     1192: removing it from any sessions to which it is linked.
1.289     nicm     1193: The
                   1194: .Fl a
                   1195: option kills all but the window given with
                   1196: .Fl t .
1.187     nicm     1197: .It Ic last-pane Op Fl t Ar target-window
                   1198: .D1 (alias: Ic lastp )
                   1199: Select the last (previously selected) pane.
1.56      jmc      1200: .It Ic last-window Op Fl t Ar target-session
1.1       nicm     1201: .D1 (alias: Ic last )
                   1202: Select the last (previously selected) window.
                   1203: If no
                   1204: .Ar target-session
                   1205: is specified, select the last window of the current session.
                   1206: .It Xo Ic link-window
                   1207: .Op Fl dk
                   1208: .Op Fl s Ar src-window
                   1209: .Op Fl t Ar dst-window
                   1210: .Xc
                   1211: .D1 (alias: Ic linkw )
                   1212: Link the window at
                   1213: .Ar src-window
                   1214: to the specified
                   1215: .Ar dst-window .
                   1216: If
                   1217: .Ar dst-window
                   1218: is specified and no such window exists, the
                   1219: .Ar src-window
                   1220: is linked there.
                   1221: If
                   1222: .Fl k
                   1223: is given and
                   1224: .Ar dst-window
                   1225: exists, it is killed, otherwise an error is generated.
                   1226: If
                   1227: .Fl d
                   1228: is given, the newly linked window is not selected.
1.214     nicm     1229: .It Xo Ic list-panes
                   1230: .Op Fl as
1.245     nicm     1231: .Op Fl F Ar format
1.214     nicm     1232: .Op Fl t Ar target
                   1233: .Xc
1.104     nicm     1234: .D1 (alias: Ic lsp )
1.214     nicm     1235: If
                   1236: .Fl a
                   1237: is given,
                   1238: .Ar target
                   1239: is ignored and all panes on the server are listed.
                   1240: If
                   1241: .Fl s
                   1242: is given,
                   1243: .Ar target
                   1244: is a session (or the current session).
                   1245: If neither is given,
                   1246: .Ar target
                   1247: is a window (or the current window).
1.247     nicm     1248: For the meaning of the
                   1249: .Fl F
                   1250: flag, see the
                   1251: .Sx FORMATS
                   1252: section.
1.214     nicm     1253: .It Xo Ic list-windows
                   1254: .Op Fl a
1.245     nicm     1255: .Op Fl F Ar format
1.214     nicm     1256: .Op Fl t Ar target-session
                   1257: .Xc
1.1       nicm     1258: .D1 (alias: Ic lsw )
1.214     nicm     1259: If
                   1260: .Fl a
                   1261: is given, list all windows on the server.
                   1262: Otherwise, list windows in the current session or in
1.1       nicm     1263: .Ar target-session .
1.245     nicm     1264: For the meaning of the
                   1265: .Fl F
                   1266: flag, see the
                   1267: .Sx FORMATS
                   1268: section.
1.277     nicm     1269: .It Xo Ic move-pane
                   1270: .Op Fl bdhv
                   1271: .Oo Fl l
                   1272: .Ar size |
                   1273: .Fl p Ar percentage Oc
                   1274: .Op Fl s Ar src-pane
                   1275: .Op Fl t Ar dst-pane
                   1276: .Xc
                   1277: .D1 (alias: Ic movep )
                   1278: Like
                   1279: .Ic join-pane ,
                   1280: but
                   1281: .Ar src-pane
                   1282: and
                   1283: .Ar dst-pane
                   1284: may belong to the same window.
1.1       nicm     1285: .It Xo Ic move-window
1.291     nicm     1286: .Op Fl rdk
1.1       nicm     1287: .Op Fl s Ar src-window
                   1288: .Op Fl t Ar dst-window
                   1289: .Xc
                   1290: .D1 (alias: Ic movew )
                   1291: This is similar to
                   1292: .Ic link-window ,
                   1293: except the window at
                   1294: .Ar src-window
                   1295: is moved to
                   1296: .Ar dst-window .
1.291     nicm     1297: With
                   1298: .Fl r ,
                   1299: all windows in the session are renumbered in sequential order, respecting
                   1300: the
                   1301: .Ic base-index
                   1302: option.
1.1       nicm     1303: .It Xo Ic new-window
1.201     nicm     1304: .Op Fl adkP
1.272     nicm     1305: .Op Fl c Ar start-directory
1.1       nicm     1306: .Op Fl n Ar window-name
                   1307: .Op Fl t Ar target-window
1.279     nicm     1308: .Op Fl F Ar format
1.153     nicm     1309: .Op Ar shell-command
1.1       nicm     1310: .Xc
                   1311: .D1 (alias: Ic neww )
                   1312: Create a new window.
1.160     nicm     1313: With
                   1314: .Fl a ,
                   1315: the new window is inserted at the next index up from the specified
                   1316: .Ar target-window ,
                   1317: moving windows up if necessary,
                   1318: otherwise
                   1319: .Ar target-window
                   1320: is the new window location.
                   1321: .Pp
1.1       nicm     1322: If
                   1323: .Fl d
                   1324: is given, the session does not make the new window the current window.
                   1325: .Ar target-window
1.28      nicm     1326: represents the window to be created; if the target already exists an error is
                   1327: shown, unless the
                   1328: .Fl k
                   1329: flag is used, in which case it is destroyed.
1.153     nicm     1330: .Ar shell-command
1.1       nicm     1331: is the command to execute.
                   1332: If
1.153     nicm     1333: .Ar shell-command
                   1334: is not specified, the value of the
                   1335: .Ic default-command
                   1336: option is used.
1.272     nicm     1337: .Fl c
                   1338: specifies the working directory in which the new window is created.
                   1339: It may have an absolute path or one of the following values (or a subdirectory):
                   1340: .Bl -column "XXXXXXXXXXXX" "XXXXXXXXXXXXXXXXXXXXXXXX" -offset indent
                   1341: .It Li "Empty string" Ta "Current pane's directory"
                   1342: .It Li "~" Ta "User's home directory"
                   1343: .It Li "-" Ta "Where session was started"
                   1344: .It Li "." Ta "Where server was started"
                   1345: .El
1.153     nicm     1346: .Pp
                   1347: When the shell command completes, the window closes.
                   1348: See the
                   1349: .Ic remain-on-exit
                   1350: option to change this behaviour.
1.1       nicm     1351: .Pp
                   1352: The
                   1353: .Ev TERM
                   1354: environment variable must be set to
                   1355: .Dq screen
                   1356: for all programs running
                   1357: .Em inside
                   1358: .Nm .
                   1359: New windows will automatically have
                   1360: .Dq TERM=screen
                   1361: added to their environment, but care must be taken not to reset this in shell
                   1362: start-up files.
1.201     nicm     1363: .Pp
                   1364: The
                   1365: .Fl P
1.279     nicm     1366: option prints information about the new window after it has been created.
                   1367: By default, it uses the format
                   1368: .Ql #{session_name}:#{window_index}
                   1369: but a different format may be specified with
                   1370: .Fl F .
1.56      jmc      1371: .It Ic next-layout Op Fl t Ar target-window
1.1       nicm     1372: .D1 (alias: Ic nextl )
                   1373: Move a window to the next layout and rearrange the panes to fit.
                   1374: .It Xo Ic next-window
1.9       nicm     1375: .Op Fl a
1.1       nicm     1376: .Op Fl t Ar target-session
                   1377: .Xc
                   1378: .D1 (alias: Ic next )
                   1379: Move to the next window in the session.
1.9       nicm     1380: If
1.12      jmc      1381: .Fl a
1.9       nicm     1382: is used, move to the next window with a bell, activity or content alert.
1.107     nicm     1383: .It Xo Ic pipe-pane
                   1384: .Op Fl o
                   1385: .Op Fl t Ar target-pane
1.153     nicm     1386: .Op Ar shell-command
1.107     nicm     1387: .Xc
                   1388: .D1 (alias: Ic pipep )
                   1389: Pipe any output sent by the program in
                   1390: .Ar target-pane
                   1391: to a shell command.
                   1392: A pane may only be piped to one command at a time, any existing pipe is
                   1393: closed before
1.153     nicm     1394: .Ar shell-command
1.107     nicm     1395: is executed.
1.174     nicm     1396: The
                   1397: .Ar shell-command
                   1398: string may contain the special character sequences supported by the
                   1399: .Ic status-left
1.231     nicm     1400: option.
1.107     nicm     1401: If no
1.153     nicm     1402: .Ar shell-command
1.107     nicm     1403: is given, the current pipe (if any) is closed.
                   1404: .Pp
                   1405: The
                   1406: .Fl o
                   1407: option only opens a new pipe if no previous pipe exists, allowing a pipe to
                   1408: be toggled with a single key, for example:
                   1409: .Bd -literal -offset indent
1.174     nicm     1410: bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1.107     nicm     1411: .Ed
1.176     nicm     1412: .It Xo Ic previous-layout
                   1413: .Op Fl t Ar target-window
                   1414: .Xc
                   1415: .D1 (alias: Ic prevl )
                   1416: Move to the previous layout in the session.
1.1       nicm     1417: .It Xo Ic previous-window
1.9       nicm     1418: .Op Fl a
1.1       nicm     1419: .Op Fl t Ar target-session
                   1420: .Xc
                   1421: .D1 (alias: Ic prev )
                   1422: Move to the previous window in the session.
1.9       nicm     1423: With
                   1424: .Fl a ,
                   1425: move to the previous window with a bell, activity or content alert.
1.1       nicm     1426: .It Xo Ic rename-window
                   1427: .Op Fl t Ar target-window
                   1428: .Ar new-name
                   1429: .Xc
                   1430: .D1 (alias: Ic renamew )
                   1431: Rename the current window, or the window at
                   1432: .Ar target-window
                   1433: if specified, to
                   1434: .Ar new-name .
                   1435: .It Xo Ic resize-pane
1.39      jmc      1436: .Op Fl DLRU
1.52      nicm     1437: .Op Fl t Ar target-pane
1.1       nicm     1438: .Op Ar adjustment
                   1439: .Xc
                   1440: .D1 (alias: Ic resizep )
1.57      jmc      1441: Resize a pane, upward with
                   1442: .Fl U
                   1443: (the default), downward with
                   1444: .Fl D ,
                   1445: to the left with
                   1446: .Fl L
                   1447: and to the right with
                   1448: .Fl R .
                   1449: The
                   1450: .Ar adjustment
                   1451: is given in lines or cells (the default is 1).
1.234     nicm     1452: .It Xo Ic respawn-pane
                   1453: .Op Fl k
                   1454: .Op Fl t Ar target-pane
                   1455: .Op Ar shell-command
                   1456: .Xc
                   1457: .D1 (alias: Ic respawnp )
                   1458: Reactivate a pane in which the command has exited (see the
                   1459: .Ic remain-on-exit
                   1460: window option).
                   1461: If
                   1462: .Ar shell-command
                   1463: is not given, the command used when the pane was created is executed.
                   1464: The pane must be already inactive, unless
                   1465: .Fl k
                   1466: is given, in which case any existing command is killed.
1.57      jmc      1467: .It Xo Ic respawn-window
                   1468: .Op Fl k
                   1469: .Op Fl t Ar target-window
1.153     nicm     1470: .Op Ar shell-command
1.57      jmc      1471: .Xc
                   1472: .D1 (alias: Ic respawnw )
1.153     nicm     1473: Reactivate a window in which the command has exited (see the
1.57      jmc      1474: .Ic remain-on-exit
                   1475: window option).
                   1476: If
1.153     nicm     1477: .Ar shell-command
1.57      jmc      1478: is not given, the command used when the window was created is executed.
                   1479: The window must be already inactive, unless
                   1480: .Fl k
                   1481: is given, in which case any existing command is killed.
                   1482: .It Xo Ic rotate-window
                   1483: .Op Fl DU
                   1484: .Op Fl t Ar target-window
                   1485: .Xc
                   1486: .D1 (alias: Ic rotatew )
                   1487: Rotate the positions of the panes within a window, either upward (numerically
                   1488: lower) with
                   1489: .Fl U
                   1490: or downward (numerically higher).
                   1491: .It Xo Ic select-layout
1.288     nicm     1492: .Op Fl npUu
1.57      jmc      1493: .Op Fl t Ar target-window
                   1494: .Op Ar layout-name
                   1495: .Xc
1.176     nicm     1496: .D1 (alias: Ic selectl )
1.57      jmc      1497: Choose a specific layout for a window.
                   1498: If
                   1499: .Ar layout-name
1.181     nicm     1500: is not given, the last preset layout used (if any) is reapplied.
1.204     nicm     1501: .Fl n
                   1502: and
                   1503: .Fl p
                   1504: are equivalent to the
                   1505: .Ic next-layout
                   1506: and
                   1507: .Ic previous-layout
                   1508: commands.
1.288     nicm     1509: .Pp
                   1510: .Fl U
                   1511: and
                   1512: .Fl u
                   1513: step forward and back through previous layouts, up to the maximum set by the
                   1514: .Ic layout-history-limit
                   1515: option.
1.156     nicm     1516: .It Xo Ic select-pane
1.204     nicm     1517: .Op Fl lDLRU
1.156     nicm     1518: .Op Fl t Ar target-pane
                   1519: .Xc
1.57      jmc      1520: .D1 (alias: Ic selectp )
                   1521: Make pane
                   1522: .Ar target-pane
                   1523: the active pane in window
                   1524: .Ar target-window .
1.156     nicm     1525: If one of
                   1526: .Fl D ,
                   1527: .Fl L ,
                   1528: .Fl R ,
                   1529: or
                   1530: .Fl U
                   1531: is used, respectively the pane below, to the left, to the right, or above the
                   1532: target pane is used.
1.204     nicm     1533: .Fl l
                   1534: is the same as using the
                   1535: .Ic last-pane
                   1536: command.
                   1537: .It Xo Ic select-window
                   1538: .Op Fl lnp
                   1539: .Op Fl t Ar target-window
                   1540: .Xc
1.57      jmc      1541: .D1 (alias: Ic selectw )
                   1542: Select the window at
                   1543: .Ar target-window .
1.204     nicm     1544: .Fl l ,
                   1545: .Fl n
                   1546: and
                   1547: .Fl p
                   1548: are equivalent to the
                   1549: .Ic last-window ,
                   1550: .Ic next-window
                   1551: and
                   1552: .Ic previous-window
                   1553: commands.
1.57      jmc      1554: .It Xo Ic split-window
1.201     nicm     1555: .Op Fl dhvP
1.272     nicm     1556: .Op Fl c Ar start-directory
1.57      jmc      1557: .Oo Fl l
                   1558: .Ar size |
                   1559: .Fl p Ar percentage Oc
1.136     nicm     1560: .Op Fl t Ar target-pane
1.153     nicm     1561: .Op Ar shell-command
1.279     nicm     1562: .Op Fl F Ar format
1.57      jmc      1563: .Xc
1.176     nicm     1564: .D1 (alias: Ic splitw )
1.136     nicm     1565: Create a new pane by splitting
                   1566: .Ar target-pane :
1.57      jmc      1567: .Fl h
                   1568: does a horizontal split and
                   1569: .Fl v
                   1570: a vertical split; if neither is specified,
                   1571: .Fl v
                   1572: is assumed.
                   1573: The
                   1574: .Fl l
                   1575: and
                   1576: .Fl p
1.136     nicm     1577: options specify the size of the new pane in lines (for vertical split) or in
1.57      jmc      1578: cells (for horizontal split), or as a percentage, respectively.
1.136     nicm     1579: All other options have the same meaning as for the
1.57      jmc      1580: .Ic new-window
                   1581: command.
                   1582: .It Xo Ic swap-pane
                   1583: .Op Fl dDU
                   1584: .Op Fl s Ar src-pane
                   1585: .Op Fl t Ar dst-pane
                   1586: .Xc
                   1587: .D1 (alias: Ic swapp )
                   1588: Swap two panes.
                   1589: If
                   1590: .Fl U
                   1591: is used and no source pane is specified with
                   1592: .Fl s ,
                   1593: .Ar dst-pane
                   1594: is swapped with the previous pane (before it numerically);
                   1595: .Fl D
                   1596: swaps with the next pane (after it numerically).
1.138     nicm     1597: .Fl d
                   1598: instructs
                   1599: .Nm
                   1600: not to change the active pane.
1.57      jmc      1601: .It Xo Ic swap-window
                   1602: .Op Fl d
                   1603: .Op Fl s Ar src-window
                   1604: .Op Fl t Ar dst-window
                   1605: .Xc
                   1606: .D1 (alias: Ic swapw )
                   1607: This is similar to
                   1608: .Ic link-window ,
                   1609: except the source and destination windows are swapped.
                   1610: It is an error if no window exists at
                   1611: .Ar src-window .
                   1612: .It Xo Ic unlink-window
1.1       nicm     1613: .Op Fl k
                   1614: .Op Fl t Ar target-window
                   1615: .Xc
1.57      jmc      1616: .D1 (alias: Ic unlinkw )
                   1617: Unlink
                   1618: .Ar target-window .
                   1619: Unless
                   1620: .Fl k
                   1621: is given, a window may be unlinked only if it is linked to multiple sessions -
                   1622: windows may not be linked to no sessions;
                   1623: if
1.1       nicm     1624: .Fl k
1.57      jmc      1625: is specified and the window is linked to only one session, it is unlinked and
                   1626: destroyed.
                   1627: .El
                   1628: .Sh KEY BINDINGS
1.93      nicm     1629: .Nm
                   1630: allows a command to be bound to most keys, with or without a prefix key.
                   1631: When specifying keys, most represent themselves (for example
                   1632: .Ql A
                   1633: to
1.95      jmc      1634: .Ql Z ) .
1.93      nicm     1635: Ctrl keys may be prefixed with
                   1636: .Ql C-
                   1637: or
1.95      jmc      1638: .Ql ^ ,
                   1639: and Alt (meta) with
1.93      nicm     1640: .Ql M- .
                   1641: In addition, the following special key names are accepted:
1.126     nicm     1642: .Em Up ,
                   1643: .Em Down ,
                   1644: .Em Left ,
                   1645: .Em Right ,
1.93      nicm     1646: .Em BSpace ,
                   1647: .Em BTab ,
                   1648: .Em DC
                   1649: (Delete),
                   1650: .Em End ,
                   1651: .Em Enter ,
                   1652: .Em Escape ,
                   1653: .Em F1
                   1654: to
                   1655: .Em F20 ,
                   1656: .Em Home ,
                   1657: .Em IC
                   1658: (Insert),
1.254     nicm     1659: .Em NPage/PageDown/PgDn ,
                   1660: .Em PPage/PageUp/PgUp ,
1.93      nicm     1661: .Em Space ,
                   1662: and
                   1663: .Em Tab .
                   1664: Note that to bind the
                   1665: .Ql \&"
                   1666: or
                   1667: .Ql '
                   1668: keys, quotation marks are necessary, for example:
                   1669: .Bd -literal -offset indent
                   1670: bind-key '"' split-window
1.167     nicm     1671: bind-key "'" new-window
1.93      nicm     1672: .Ed
                   1673: .Pp
1.57      jmc      1674: Commands related to key bindings are as follows:
                   1675: .Bl -tag -width Ds
                   1676: .It Xo Ic bind-key
                   1677: .Op Fl cnr
                   1678: .Op Fl t Ar key-table
                   1679: .Ar key Ar command Op Ar arguments
1.1       nicm     1680: .Xc
1.57      jmc      1681: .D1 (alias: Ic bind )
                   1682: Bind key
                   1683: .Ar key
                   1684: to
                   1685: .Ar command .
                   1686: By default (without
                   1687: .Fl t )
                   1688: the primary key bindings are modified (those normally activated with the prefix
                   1689: key); in this case, if
                   1690: .Fl n
                   1691: is specified, it is not necessary to use the prefix key,
                   1692: .Ar command
                   1693: is bound to
                   1694: .Ar key
                   1695: alone.
1.1       nicm     1696: The
1.57      jmc      1697: .Fl r
                   1698: flag indicates this key may repeat, see the
                   1699: .Ic repeat-time
                   1700: option.
                   1701: .Pp
                   1702: If
                   1703: .Fl t
                   1704: is present,
                   1705: .Ar key
                   1706: is bound in
                   1707: .Ar key-table :
                   1708: the binding for command mode with
                   1709: .Fl c
                   1710: or for normal mode without.
                   1711: To view the default bindings and possible commands, see the
                   1712: .Ic list-keys
                   1713: command.
                   1714: .It Ic list-keys Op Fl t Ar key-table
                   1715: .D1 (alias: Ic lsk )
                   1716: List all key bindings.
                   1717: Without
                   1718: .Fl t
                   1719: the primary key bindings - those executed when preceded by the prefix key -
                   1720: are printed.
                   1721: Keys bound without the prefix key (see
                   1722: .Ic bind-key
                   1723: .Fl n )
1.119     nicm     1724: are marked with
                   1725: .Ql (no prefix) .
1.57      jmc      1726: .Pp
                   1727: With
                   1728: .Fl t ,
                   1729: the key bindings in
                   1730: .Ar key-table
                   1731: are listed; this may be one of:
                   1732: .Em vi-edit ,
                   1733: .Em emacs-edit ,
                   1734: .Em vi-choice ,
                   1735: .Em emacs-choice ,
                   1736: .Em vi-copy
                   1737: or
                   1738: .Em emacs-copy .
                   1739: .It Xo Ic send-keys
1.273     nicm     1740: .Op Fl lR
1.72      nicm     1741: .Op Fl t Ar target-pane
1.57      jmc      1742: .Ar key Ar ...
1.1       nicm     1743: .Xc
1.57      jmc      1744: .D1 (alias: Ic send )
                   1745: Send a key or keys to a window.
                   1746: Each argument
                   1747: .Ar key
                   1748: is the name of the key (such as
                   1749: .Ql C-a
                   1750: or
                   1751: .Ql npage
                   1752: ) to send; if the string is not recognised as a key, it is sent as a series of
                   1753: characters.
1.273     nicm     1754: The
                   1755: .Fl l
                   1756: flag disables key name lookup and sends the keys literally.
1.57      jmc      1757: All arguments are sent sequentially from first to last.
1.265     nicm     1758: The
                   1759: .Fl R
                   1760: flag causes the terminal state to be reset.
1.267     nicm     1761: .It Xo Ic send-prefix
                   1762: .Op Fl 2
                   1763: .Op Fl t Ar target-pane
                   1764: .Xc
                   1765: Send the prefix key, or with
                   1766: .Fl 2
                   1767: the secondary prefix key, to a window as if it was pressed.
1.57      jmc      1768: .It Xo Ic unbind-key
1.189     nicm     1769: .Op Fl acn
1.57      jmc      1770: .Op Fl t Ar key-table
                   1771: .Ar key
1.2       nicm     1772: .Xc
1.57      jmc      1773: .D1 (alias: Ic unbind )
                   1774: Unbind the command bound to
                   1775: .Ar key .
                   1776: Without
                   1777: .Fl t
                   1778: the primary key bindings are modified; in this case, if
                   1779: .Fl n
                   1780: is specified, the command bound to
                   1781: .Ar key
                   1782: without a prefix (if any) is removed.
1.189     nicm     1783: If
                   1784: .Fl a
                   1785: is present, all key bindings are removed.
1.57      jmc      1786: .Pp
1.47      nicm     1787: If
1.57      jmc      1788: .Fl t
                   1789: is present,
                   1790: .Ar key
                   1791: in
                   1792: .Ar key-table
                   1793: is unbound: the binding for command mode with
                   1794: .Fl c
                   1795: or for normal mode without.
                   1796: .El
                   1797: .Sh OPTIONS
                   1798: The appearance and behaviour of
                   1799: .Nm
                   1800: may be modified by changing the value of various options.
1.133     nicm     1801: There are three types of option:
                   1802: .Em server options ,
1.57      jmc      1803: .Em session options
                   1804: and
                   1805: .Em window options .
                   1806: .Pp
1.133     nicm     1807: The
                   1808: .Nm
                   1809: server has a set of global options which do not apply to any particular
                   1810: window or session.
                   1811: These are altered with the
                   1812: .Ic set-option
                   1813: .Fl s
                   1814: command, or displayed with the
                   1815: .Ic show-options
                   1816: .Fl s
                   1817: command.
                   1818: .Pp
                   1819: In addition, each individual session may have a set of session options, and
                   1820: there is a separate set of global session options.
1.57      jmc      1821: Sessions which do not have a particular option configured inherit the value
                   1822: from the global session options.
                   1823: Session options are set or unset with the
                   1824: .Ic set-option
                   1825: command and may be listed with the
                   1826: .Ic show-options
                   1827: command.
1.133     nicm     1828: The available server and session options are listed under the
1.57      jmc      1829: .Ic set-option
                   1830: command.
                   1831: .Pp
                   1832: Similarly, a set of window options is attached to each window, and there is
                   1833: a set of global window options from which any unset options are inherited.
                   1834: Window options are altered with the
                   1835: .Ic set-window-option
                   1836: command and can be listed with the
                   1837: .Ic show-window-options
                   1838: command.
                   1839: All window options are documented with the
                   1840: .Ic set-window-option
                   1841: command.
                   1842: .Pp
                   1843: Commands which set options are as follows:
                   1844: .Bl -tag -width Ds
1.1       nicm     1845: .It Xo Ic set-option
1.281     nicm     1846: .Op Fl agqsuw
1.129     nicm     1847: .Op Fl t Ar target-session | Ar target-window
1.1       nicm     1848: .Ar option Ar value
                   1849: .Xc
                   1850: .D1 (alias: Ic set )
1.133     nicm     1851: Set a window option with
                   1852: .Fl w
                   1853: (equivalent to the
                   1854: .Ic set-window-option
                   1855: command),
                   1856: a server option with
                   1857: .Fl s ,
                   1858: otherwise a session option.
                   1859: .Pp
                   1860: If
                   1861: .Fl g
                   1862: is specified, the global session or window option is set.
1.58      nicm     1863: With
                   1864: .Fl a ,
                   1865: and if the option expects a string,
                   1866: .Ar value
                   1867: is appended to the existing setting.
1.1       nicm     1868: The
                   1869: .Fl u
                   1870: flag unsets an option, so a session inherits the option from the global
1.133     nicm     1871: options.
                   1872: It is not possible to unset a global option.
1.1       nicm     1873: .Pp
1.281     nicm     1874: The
                   1875: .Fl q
                   1876: flag suppresses the informational message (as if the
                   1877: .Ic quiet
                   1878: server option was set).
                   1879: .Pp
1.133     nicm     1880: Available window options are listed under
                   1881: .Ic set-window-option .
1.274     nicm     1882: .Pp
                   1883: .Ar value
                   1884: depends on the option and may be a number, a string, or a flag (on, off, or
                   1885: omitted to toggle).
1.133     nicm     1886: .Pp
                   1887: Available server options are:
                   1888: .Bl -tag -width Ds
1.198     nicm     1889: .It Ic buffer-limit Ar number
                   1890: Set the number of buffers; as new buffers are added to the top of the stack,
                   1891: old ones are removed from the bottom if necessary to maintain this maximum
                   1892: length.
1.239     nicm     1893: .It Ic escape-time Ar time
                   1894: Set the time in milliseconds for which
                   1895: .Nm
                   1896: waits after an escape is input to determine if it is part of a function or meta
                   1897: key sequences.
                   1898: The default is 500 milliseconds.
                   1899: .It Xo Ic exit-unattached
                   1900: .Op Ic on | off
                   1901: .Xc
                   1902: If enabled, the server will exit when there are no attached clients.
                   1903: .It Xo Ic quiet
                   1904: .Op Ic on | off
                   1905: .Xc
                   1906: Enable or disable the display of various informational messages (see also the
                   1907: .Fl q
                   1908: command line flag).
1.228     nicm     1909: .It Xo Ic set-clipboard
                   1910: .Op Ic on | off
                   1911: .Xc
                   1912: Attempt to set the terminal clipboard content using the
                   1913: \ee]52;...\e007
                   1914: .Xr xterm 1
                   1915: escape sequences.
                   1916: This option is on by default if there is an
                   1917: .Em \&Ms
                   1918: entry in the
                   1919: .Xr terminfo 5
                   1920: description for the client terminal.
                   1921: Note that this feature needs to be enabled in
                   1922: .Xr xterm 1
                   1923: by setting the resource:
                   1924: .Bd -literal -offset indent
                   1925: disallowedWindowOps: 20,21,SetXprop
                   1926: .Ed
                   1927: .Pp
                   1928: Or changing this property from the
                   1929: .Xr xterm 1
                   1930: interactive menu when required.
1.133     nicm     1931: .El
1.129     nicm     1932: .Pp
1.18      nicm     1933: Available session options are:
1.1       nicm     1934: .Bl -tag -width Ds
1.69      nicm     1935: .It Ic base-index Ar index
                   1936: Set the base index from which an unused index should be searched when a new
                   1937: window is created.
                   1938: The default is zero.
1.1       nicm     1939: .It Xo Ic bell-action
1.56      jmc      1940: .Op Ic any | none | current
1.1       nicm     1941: .Xc
                   1942: Set action on window bell.
                   1943: .Ic any
                   1944: means a bell in any window linked to a session causes a bell in the current
                   1945: window of that session,
                   1946: .Ic none
                   1947: means all bells are ignored and
                   1948: .Ic current
                   1949: means only bell in windows other than the current window are ignored.
1.237     nicm     1950: .It Xo Ic bell-on-alert
                   1951: .Op Ic on | off
                   1952: .Xc
                   1953: If on, ring the terminal bell when an activity, content or silence alert
                   1954: occurs.
1.153     nicm     1955: .It Ic default-command Ar shell-command
1.1       nicm     1956: Set the command used for new windows (if not specified when the window is
                   1957: created) to
1.153     nicm     1958: .Ar shell-command ,
1.79      nicm     1959: which may be any
                   1960: .Xr sh 1
                   1961: command.
1.19      nicm     1962: The default is an empty string, which instructs
                   1963: .Nm
1.79      nicm     1964: to create a login shell using the value of the
                   1965: .Ic default-shell
                   1966: option.
1.196     nicm     1967: .It Ic default-path Ar path
1.257     nicm     1968: Set the default working directory for new panes.
                   1969: If empty (the default), the working directory is determined from the process
                   1970: running in the active pane, from the command line environment or from the
                   1971: working directory where the session was created.
1.292     nicm     1972: Otherwise the same options are available as for the
                   1973: .Fl c
                   1974: flag to
                   1975: .Ic new-window .
1.79      nicm     1976: .It Ic default-shell Ar path
                   1977: Specify the default shell.
                   1978: This is used as the login shell for new windows when the
                   1979: .Ic default-command
                   1980: option is set to empty, and must be the full path of the executable.
                   1981: When started
                   1982: .Nm
                   1983: tries to set a default value from the first suitable of the
1.19      nicm     1984: .Ev SHELL
1.79      nicm     1985: environment variable, the shell returned by
                   1986: .Xr getpwuid 3 ,
                   1987: or
                   1988: .Pa /bin/sh .
                   1989: This option should be configured when
                   1990: .Nm
                   1991: is used as a login shell.
1.22      nicm     1992: .It Ic default-terminal Ar terminal
                   1993: Set the default terminal for new windows created in this session - the
                   1994: default value of the
                   1995: .Ev TERM
                   1996: environment variable.
                   1997: For
                   1998: .Nm
                   1999: to work correctly, this
                   2000: .Em must
                   2001: be set to
                   2002: .Ql screen
                   2003: or a derivative of it.
1.206     nicm     2004: .It Xo Ic destroy-unattached
                   2005: .Op Ic on | off
                   2006: .Xc
1.185     nicm     2007: If enabled and the session is no longer attached to any clients, it is
                   2008: destroyed.
1.206     nicm     2009: .It Xo Ic detach-on-destroy
                   2010: .Op Ic on | off
                   2011: .Xc
1.184     nicm     2012: If on (the default), the client is detached when the session it is attached to
                   2013: is destroyed.
                   2014: If off, the client is switched to the most recently active of the remaining
                   2015: sessions.
1.145     nicm     2016: .It Ic display-panes-active-colour Ar colour
                   2017: Set the colour used by the
                   2018: .Ic display-panes
                   2019: command to show the indicator for the active pane.
1.78      nicm     2020: .It Ic display-panes-colour Ar colour
1.145     nicm     2021: Set the colour used by the
1.78      nicm     2022: .Ic display-panes
1.145     nicm     2023: command to show the indicators for inactive panes.
1.78      nicm     2024: .It Ic display-panes-time Ar time
                   2025: Set the time in milliseconds for which the indicators shown by the
                   2026: .Ic display-panes
                   2027: command appear.
1.21      nicm     2028: .It Ic display-time Ar time
1.78      nicm     2029: Set the amount of time for which status line messages and other on-screen
                   2030: indicators are displayed.
1.21      nicm     2031: .Ar time
                   2032: is in milliseconds.
1.1       nicm     2033: .It Ic history-limit Ar lines
                   2034: Set the maximum number of lines held in window history.
                   2035: This setting applies only to new windows - existing window histories are not
                   2036: resized and retain the limit at the point they were created.
                   2037: .It Ic lock-after-time Ar number
1.100     nicm     2038: Lock the session (like the
                   2039: .Ic lock-session
1.90      nicm     2040: command) after
1.1       nicm     2041: .Ar number
1.100     nicm     2042: seconds of inactivity, or the entire server (all sessions) if the
                   2043: .Ic lock-server
                   2044: option is set.
                   2045: The default is not to lock (set to 0).
1.153     nicm     2046: .It Ic lock-command Ar shell-command
1.90      nicm     2047: Command to run when locking each client.
                   2048: The default is to run
                   2049: .Xr lock 1
                   2050: with
                   2051: .Fl np .
1.100     nicm     2052: .It Xo Ic lock-server
                   2053: .Op Ic on | off
                   2054: .Xc
                   2055: If this option is
1.102     nicm     2056: .Ic on
1.100     nicm     2057: (the default),
                   2058: instead of each session locking individually as each has been
                   2059: idle for
1.108     jmc      2060: .Ic lock-after-time ,
                   2061: the entire server will lock after
1.100     nicm     2062: .Em all
                   2063: sessions would have locked.
                   2064: This has no effect as a session option; it must be set as a global option.
1.1       nicm     2065: .It Ic message-attr Ar attributes
                   2066: Set status line message attributes, where
                   2067: .Ar attributes
                   2068: is either
1.168     nicm     2069: .Ic none
1.1       nicm     2070: or a comma-delimited list of one or more of:
                   2071: .Ic bright
                   2072: (or
                   2073: .Ic bold ) ,
                   2074: .Ic dim ,
                   2075: .Ic underscore ,
                   2076: .Ic blink ,
                   2077: .Ic reverse ,
                   2078: .Ic hidden ,
                   2079: or
                   2080: .Ic italics .
                   2081: .It Ic message-bg Ar colour
                   2082: Set status line message background colour, where
                   2083: .Ar colour
                   2084: is one of:
                   2085: .Ic black ,
                   2086: .Ic red ,
                   2087: .Ic green ,
                   2088: .Ic yellow ,
                   2089: .Ic blue ,
                   2090: .Ic magenta ,
                   2091: .Ic cyan ,
1.85      nicm     2092: .Ic white ,
1.266     nicm     2093: aixterm bright variants (if supported:
                   2094: .Ic brightred ,
                   2095: .Ic brightgreen ,
                   2096: and so on),
1.85      nicm     2097: .Ic colour0
                   2098: to
                   2099: .Ic colour255
1.205     nicm     2100: from the 256-colour set,
                   2101: .Ic default ,
                   2102: or a hexadecimal RGB string such as
                   2103: .Ql #ffffff ,
                   2104: which chooses the closest match from the default 256-colour set.
1.253     nicm     2105: .It Ic message-command-attr Ar attributes
                   2106: Set status line message attributes when in command mode.
                   2107: .It Ic message-command-bg Ar colour
                   2108: Set status line message background colour when in command mode.
                   2109: .It Ic message-command-fg Ar colour
                   2110: Set status line message foreground colour when in command mode.
1.1       nicm     2111: .It Ic message-fg Ar colour
                   2112: Set status line message foreground colour.
1.120     nicm     2113: .It Ic message-limit Ar number
                   2114: Set the number of error or information messages to save in the message log for
                   2115: each client.
                   2116: The default is 20.
1.226     nicm     2117: .It Xo Ic mouse-resize-pane
                   2118: .Op Ic on | off
                   2119: .Xc
                   2120: If on,
                   2121: .Nm
                   2122: captures the mouse and allows panes to be resized by dragging on their borders.
1.102     nicm     2123: .It Xo Ic mouse-select-pane
                   2124: .Op Ic on | off
                   2125: .Xc
                   2126: If on,
                   2127: .Nm
                   2128: captures the mouse and when a window is split into multiple panes the mouse may
                   2129: be used to select the current pane.
                   2130: The mouse click is also passed through to the application as normal.
1.222     nicm     2131: .It Xo Ic mouse-select-window
                   2132: .Op Ic on | off
                   2133: .Xc
                   2134: If on, clicking the mouse on a window name in the status line will select that
                   2135: window.
1.239     nicm     2136: .It Xo Ic mouse-utf8
                   2137: .Op Ic on | off
                   2138: .Xc
                   2139: If enabled, request mouse input as UTF-8 on UTF-8 terminals.
1.196     nicm     2140: .It Ic pane-active-border-bg Ar colour
                   2141: .It Ic pane-active-border-fg Ar colour
                   2142: Set the pane border colour for the currently active pane.
                   2143: .It Ic pane-border-bg Ar colour
1.135     nicm     2144: .It Ic pane-border-fg Ar colour
                   2145: Set the pane border colour for panes aside from the active pane.
1.267     nicm     2146: .It Ic prefix Ar key
                   2147: Set the key accepted as a prefix key.
                   2148: .It Ic prefix2 Ar key
                   2149: Set a secondary key accepted as a prefix key.
1.291     nicm     2150: .It Xo Ic renumber-windows
                   2151: .Op Ic on | off
                   2152: .Xc
                   2153: If on, when a window is closed in a session, automatically renumber the other
                   2154: windows in numerical order.
                   2155: This respects the
                   2156: .Ic base-index
                   2157: option if it has been set.
                   2158: If off, do not renumber the windows.
1.21      nicm     2159: .It Ic repeat-time Ar time
1.1       nicm     2160: Allow multiple commands to be entered without pressing the prefix-key again
                   2161: in the specified
1.21      nicm     2162: .Ar time
1.1       nicm     2163: milliseconds (the default is 500).
                   2164: Whether a key repeats may be set when it is bound using the
                   2165: .Fl r
                   2166: flag to
                   2167: .Ic bind-key .
1.52      nicm     2168: Repeat is enabled for the default keys bound to the
                   2169: .Ic resize-pane
                   2170: command.
1.1       nicm     2171: .It Xo Ic set-remain-on-exit
1.56      jmc      2172: .Op Ic on | off
1.1       nicm     2173: .Xc
                   2174: Set the
                   2175: .Ic remain-on-exit
                   2176: window option for any windows first created in this session.
1.153     nicm     2177: When this option is true, windows in which the running program has
                   2178: exited do not close, instead remaining open but inactivate.
                   2179: Use the
                   2180: .Ic respawn-window
                   2181: command to reactivate such a window, or the
                   2182: .Ic kill-window
                   2183: command to destroy it.
1.1       nicm     2184: .It Xo Ic set-titles
1.56      jmc      2185: .Op Ic on | off
1.1       nicm     2186: .Xc
1.261     nicm     2187: Attempt to set the client terminal title using the
                   2188: .Em tsl
                   2189: and
                   2190: .Em fsl
                   2191: .Xr terminfo 5
                   2192: entries if they exist.
                   2193: .Nm
                   2194: automatically sets these to the \ee]2;...\e007 sequence if
1.1       nicm     2195: the terminal appears to be an xterm.
1.11      nicm     2196: This option is off by default.
1.6       jmc      2197: Note that elinks
1.1       nicm     2198: will only attempt to set the window title if the STY environment
                   2199: variable is set.
1.86      nicm     2200: .It Ic set-titles-string Ar string
                   2201: String used to set the window title if
                   2202: .Ic set-titles
                   2203: is on.
                   2204: Character sequences are replaced as for the
                   2205: .Ic status-left
                   2206: option.
1.1       nicm     2207: .It Xo Ic status
1.56      jmc      2208: .Op Ic on | off
1.1       nicm     2209: .Xc
                   2210: Show or hide the status line.
                   2211: .It Ic status-attr Ar attributes
                   2212: Set status line attributes.
                   2213: .It Ic status-bg Ar colour
                   2214: Set status line background colour.
                   2215: .It Ic status-fg Ar colour
                   2216: Set status line foreground colour.
                   2217: .It Ic status-interval Ar interval
                   2218: Update the status bar every
                   2219: .Ar interval
                   2220: seconds.
                   2221: By default, updates will occur every 15 seconds.
                   2222: A setting of zero disables redrawing at interval.
1.41      nicm     2223: .It Xo Ic status-justify
1.56      jmc      2224: .Op Ic left | centre | right
1.41      nicm     2225: .Xc
                   2226: Set the position of the window list component of the status line: left, centre
                   2227: or right justified.
1.1       nicm     2228: .It Xo Ic status-keys
1.56      jmc      2229: .Op Ic vi | emacs
1.1       nicm     2230: .Xc
1.6       jmc      2231: Use vi or emacs-style
1.1       nicm     2232: key bindings in the status line, for example at the command prompt.
1.191     nicm     2233: The default is emacs, unless the
                   2234: .Ev VISUAL
                   2235: or
                   2236: .Ev EDITOR
                   2237: environment variables are set and contain the string
                   2238: .Ql vi .
1.1       nicm     2239: .It Ic status-left Ar string
                   2240: Display
                   2241: .Ar string
                   2242: to the left of the status bar.
                   2243: .Ar string
                   2244: will be passed through
                   2245: .Xr strftime 3
                   2246: before being used.
                   2247: By default, the session name is shown.
                   2248: .Ar string
1.83      nicm     2249: may contain any of the following special character sequences:
1.1       nicm     2250: .Bl -column "Character pair" "Replaced with" -offset indent
                   2251: .It Sy "Character pair" Ta Sy "Replaced with"
1.153     nicm     2252: .It Li "#(shell-command)" Ta "First line of the command's output"
1.83      nicm     2253: .It Li "#[attributes]" Ta "Colour or attribute change"
1.1       nicm     2254: .It Li "#H" Ta "Hostname of local host"
1.224     nicm     2255: .It Li "#h" Ta "Hostname of local host without the domain name"
1.125     nicm     2256: .It Li "#F" Ta "Current window flag"
1.35      nicm     2257: .It Li "#I" Ta "Current window index"
                   2258: .It Li "#P" Ta "Current pane index"
1.1       nicm     2259: .It Li "#S" Ta "Session name"
1.261     nicm     2260: .It Li "#T" Ta "Current pane title"
1.35      nicm     2261: .It Li "#W" Ta "Current window name"
1.1       nicm     2262: .It Li "##" Ta "A literal" Ql #
                   2263: .El
1.83      nicm     2264: .Pp
1.153     nicm     2265: The #(shell-command) form executes
                   2266: .Ql shell-command
                   2267: and inserts the first line of its output.
1.103     nicm     2268: Note that shell commands are only executed once at the interval specified by
                   2269: the
                   2270: .Ic status-interval
                   2271: option: if the status line is redrawn in the meantime, the previous result is
                   2272: used.
1.161     nicm     2273: Shell commands are executed with the
                   2274: .Nm
                   2275: global environment set (see the
1.162     jmc      2276: .Sx ENVIRONMENT
                   2277: section).
1.163     nicm     2278: .Pp
1.263     nicm     2279: For details on how the names and titles can be set see the
1.261     nicm     2280: .Sx "NAMES AND TITLES"
                   2281: section.
1.109     nicm     2282: .Pp
1.83      nicm     2283: #[attributes] allows a comma-separated list of attributes to be specified,
                   2284: these may be
                   2285: .Ql fg=colour
                   2286: to set the foreground colour,
                   2287: .Ql bg=colour
1.131     nicm     2288: to set the background colour, the name of one of the attributes (listed under
                   2289: the
1.83      nicm     2290: .Ic message-attr
1.109     nicm     2291: option) to turn an attribute on, or an attribute prefixed with
                   2292: .Ql no
                   2293: to turn one off, for example
                   2294: .Ic nobright .
1.83      nicm     2295: Examples are:
                   2296: .Bd -literal -offset indent
                   2297: #(sysctl vm.loadavg)
                   2298: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
                   2299: .Ed
1.1       nicm     2300: .Pp
1.109     nicm     2301: Where appropriate, special character sequences may be prefixed with a number to
                   2302: specify the maximum length, for example
1.1       nicm     2303: .Ql #24T .
1.10      nicm     2304: .Pp
1.12      jmc      2305: By default, UTF-8 in
1.10      nicm     2306: .Ar string
                   2307: is not interpreted, to enable UTF-8, use the
                   2308: .Ic status-utf8
                   2309: option.
1.62      nicm     2310: .It Ic status-left-attr Ar attributes
1.66      jmc      2311: Set the attribute of the left part of the status line.
1.196     nicm     2312: .It Ic status-left-bg Ar colour
                   2313: Set the background colour of the left part of the status line.
1.62      nicm     2314: .It Ic status-left-fg Ar colour
                   2315: Set the foreground colour of the left part of the status line.
1.1       nicm     2316: .It Ic status-left-length Ar length
                   2317: Set the maximum
                   2318: .Ar length
                   2319: of the left component of the status bar.
                   2320: The default is 10.
1.269     nicm     2321: .It Xo Ic status-position
                   2322: .Op Ic top | bottom
                   2323: .Xc
                   2324: Set the position of the status line.
1.1       nicm     2325: .It Ic status-right Ar string
                   2326: Display
                   2327: .Ar string
                   2328: to the right of the status bar.
1.151     nicm     2329: By default, the current window title in double quotes, the date and the time
                   2330: are shown.
1.1       nicm     2331: As with
                   2332: .Ic status-left ,
                   2333: .Ar string
                   2334: will be passed to
1.10      nicm     2335: .Xr strftime 3 ,
                   2336: character pairs are replaced, and UTF-8 is dependent on the
                   2337: .Ic status-utf8
                   2338: option.
1.62      nicm     2339: .It Ic status-right-attr Ar attributes
1.66      jmc      2340: Set the attribute of the right part of the status line.
1.196     nicm     2341: .It Ic status-right-bg Ar colour
                   2342: Set the background colour of the right part of the status line.
1.62      nicm     2343: .It Ic status-right-fg Ar colour
                   2344: Set the foreground colour of the right part of the status line.
1.1       nicm     2345: .It Ic status-right-length Ar length
                   2346: Set the maximum
                   2347: .Ar length
                   2348: of the right component of the status bar.
                   2349: The default is 40.
1.10      nicm     2350: .It Xo Ic status-utf8
1.56      jmc      2351: .Op Ic on | off
1.10      nicm     2352: .Xc
                   2353: Instruct
                   2354: .Nm
                   2355: to treat top-bit-set characters in the
                   2356: .Ic status-left
                   2357: and
                   2358: .Ic status-right
                   2359: strings as UTF-8; notably, this is important for wide characters.
                   2360: This option defaults to off.
1.55      jmc      2361: .It Ic terminal-overrides Ar string
1.54      nicm     2362: Contains a list of entries which override terminal descriptions read using
                   2363: .Xr terminfo 5 .
                   2364: .Ar string
                   2365: is a comma-separated list of items each a colon-separated string made up of a
                   2366: terminal type pattern (matched using
                   2367: .Xr fnmatch 3 )
                   2368: and a set of
                   2369: .Em name=value
                   2370: entries.
                   2371: .Pp
                   2372: For example, to set the
                   2373: .Ql clear
                   2374: .Xr terminfo 5
                   2375: entry to
                   2376: .Ql \ee[H\ee[2J
                   2377: for all terminal types and the
                   2378: .Ql dch1
                   2379: entry to
                   2380: .Ql \ee[P
1.55      jmc      2381: for the
1.54      nicm     2382: .Ql rxvt
                   2383: terminal type, the option could be set to the string:
                   2384: .Bd -literal -offset indent
                   2385: "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
                   2386: .Ed
                   2387: .Pp
                   2388: The terminal entry value is passed through
                   2389: .Xr strunvis 3
                   2390: before interpretation.
                   2391: The default value forcibly corrects the
                   2392: .Ql colors
                   2393: entry for terminals which support 88 or 256 colours:
                   2394: .Bd -literal -offset indent
1.225     nicm     2395: "*88col*:colors=88,*256col*:colors=256,xterm*:XT"
1.54      nicm     2396: .Ed
1.63      nicm     2397: .It Ic update-environment Ar variables
                   2398: Set a space-separated string containing a list of environment variables to be
                   2399: copied into the session environment when a new session is created or an
                   2400: existing session is attached.
                   2401: Any variables that do not exist in the source environment are set to be
                   2402: removed from the session environment (as if
                   2403: .Fl r
                   2404: was given to the
                   2405: .Ic set-environment
                   2406: command).
                   2407: The default is
1.190     nicm     2408: "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
                   2409: XAUTHORITY".
1.37      nicm     2410: .It Xo Ic visual-activity
1.56      jmc      2411: .Op Ic on | off
1.37      nicm     2412: .Xc
                   2413: If on, display a status line message when activity occurs in a window
1.39      jmc      2414: for which the
1.37      nicm     2415: .Ic monitor-activity
                   2416: window option is enabled.
                   2417: .It Xo Ic visual-bell
1.56      jmc      2418: .Op Ic on | off
1.37      nicm     2419: .Xc
                   2420: If this option is on, a message is shown on a bell instead of it being passed
                   2421: through to the terminal (which normally makes a sound).
                   2422: Also see the
                   2423: .Ic bell-action
                   2424: option.
                   2425: .It Xo Ic visual-content
1.56      jmc      2426: .Op Ic on | off
1.37      nicm     2427: .Xc
                   2428: Like
                   2429: .Ic visual-activity ,
                   2430: display a message when content is present in a window
1.39      jmc      2431: for which the
1.37      nicm     2432: .Ic monitor-content
                   2433: window option is enabled.
1.192     nicm     2434: .It Xo Ic visual-silence
                   2435: .Op Ic on | off
                   2436: .Xc
                   2437: If
                   2438: .Ic monitor-silence
                   2439: is enabled, prints a message after the interval has expired on a given window.
1.255     nicm     2440: .It Ic word-separators Ar string
                   2441: Sets the session's conception of what characters are considered word
                   2442: separators, for the purposes of the next and previous word commands in
                   2443: copy mode.
                   2444: The default is
                   2445: .Ql \ -_@ .
1.1       nicm     2446: .El
                   2447: .It Xo Ic set-window-option
1.281     nicm     2448: .Op Fl agqu
1.1       nicm     2449: .Op Fl t Ar target-window
                   2450: .Ar option Ar value
                   2451: .Xc
                   2452: .D1 (alias: Ic setw )
1.18      nicm     2453: Set a window option.
1.1       nicm     2454: The
1.58      nicm     2455: .Fl a ,
1.281     nicm     2456: .Fl g ,
                   2457: .Fl q
1.1       nicm     2458: and
                   2459: .Fl u
                   2460: flags work similarly to the
                   2461: .Ic set-option
                   2462: command.
                   2463: .Pp
1.18      nicm     2464: Supported window options are:
1.56      jmc      2465: .Pp
                   2466: .Bl -tag -width Ds -compact
1.1       nicm     2467: .It Xo Ic aggressive-resize
1.56      jmc      2468: .Op Ic on | off
1.1       nicm     2469: .Xc
                   2470: Aggressively resize the chosen window.
                   2471: This means that
                   2472: .Nm
                   2473: will resize the window to the size of the smallest session for which it is the
                   2474: current window, rather than the smallest session to which it is attached.
                   2475: The window may resize when the current window is changed on another sessions;
1.6       jmc      2476: this option is good for full-screen programs which support
                   2477: .Dv SIGWINCH
                   2478: and poor for interactive programs such as shells.
1.262     nicm     2479: .Pp
                   2480: .It Xo Ic allow-rename
                   2481: .Op Ic on | off
                   2482: .Xc
                   2483: Allow programs to change the window name using a terminal escape
                   2484: sequence (\\033k...\\033\\\\).
                   2485: The default is on.
1.56      jmc      2486: .Pp
1.196     nicm     2487: .It Xo Ic alternate-screen
                   2488: .Op Ic on | off
                   2489: .Xc
                   2490: This option configures whether programs running inside
                   2491: .Nm
                   2492: may use the terminal alternate screen feature, which allows the
                   2493: .Em smcup
                   2494: and
                   2495: .Em rmcup
                   2496: .Xr terminfo 5
1.209     nicm     2497: capabilities.
                   2498: The alternate screen feature preserves the contents of the window when an
                   2499: interactive application starts and restores it on exit, so that any output
                   2500: visible before the application starts reappears unchanged after it exits.
                   2501: The default is on.
1.196     nicm     2502: .Pp
1.1       nicm     2503: .It Xo Ic automatic-rename
1.56      jmc      2504: .Op Ic on | off
1.1       nicm     2505: .Xc
                   2506: Control automatic window renaming.
                   2507: When this setting is enabled,
                   2508: .Nm
                   2509: will attempt - on supported platforms - to rename the window to reflect the
                   2510: command currently running in it.
                   2511: This flag is automatically disabled for an individual window when a name
                   2512: is specified at creation with
1.186     nicm     2513: .Ic new-window
                   2514: or
1.1       nicm     2515: .Ic new-session ,
                   2516: or later with
1.261     nicm     2517: .Ic rename-window ,
                   2518: or with a terminal escape sequence.
1.1       nicm     2519: It may be switched off globally with:
                   2520: .Bd -literal -offset indent
                   2521: set-window-option -g automatic-rename off
                   2522: .Ed
1.283     nicm     2523: .Pp
                   2524: .It Ic c0-change-interval Ar interval
                   2525: .It Ic c0-change-trigger Ar trigger
                   2526: These two options configure a simple form of rate limiting for a pane.
                   2527: If
                   2528: .Nm
                   2529: sees more than
                   2530: .Ar trigger
                   2531: C0 sequences that modify the screen (for example, carriage returns, linefeeds
                   2532: or backspaces) in one millisecond, it will stop updating the pane immediately and
                   2533: instead redraw it entirely every
                   2534: .Ar interval
                   2535: milliseconds.
                   2536: This helps to prevent fast output (such as
                   2537: .Xr yes 1
                   2538: overwhelming the terminal).
1.284     nicm     2539: The default is a trigger of 250 and an interval of 100.
1.283     nicm     2540: A trigger of zero disables the rate limiting.
1.56      jmc      2541: .Pp
1.1       nicm     2542: .It Ic clock-mode-colour Ar colour
                   2543: Set clock colour.
1.56      jmc      2544: .Pp
1.1       nicm     2545: .It Xo Ic clock-mode-style
1.56      jmc      2546: .Op Ic 12 | 24
1.1       nicm     2547: .Xc
                   2548: Set clock hour format.
1.56      jmc      2549: .Pp
1.1       nicm     2550: .It Ic force-height Ar height
                   2551: .It Ic force-width Ar width
                   2552: Prevent
                   2553: .Nm
                   2554: from resizing a window to greater than
                   2555: .Ar width
                   2556: or
                   2557: .Ar height .
                   2558: A value of zero restores the default unlimited setting.
1.288     nicm     2559: .Pp
                   2560: .It Ic layout-history-limit Ar limit
                   2561: Set the number of previous layouts stored for recovery with
                   2562: .Ic select-layout
                   2563: .Fl U
                   2564: and
                   2565: .Fl u .
1.56      jmc      2566: .Pp
1.196     nicm     2567: .It Ic main-pane-height Ar height
1.2       nicm     2568: .It Ic main-pane-width Ar width
                   2569: Set the width or height of the main (left or top) pane in the
                   2570: .Ic main-horizontal
                   2571: or
                   2572: .Ic main-vertical
                   2573: layouts.
1.56      jmc      2574: .Pp
1.1       nicm     2575: .It Ic mode-attr Ar attributes
                   2576: Set window modes attributes.
1.56      jmc      2577: .Pp
1.1       nicm     2578: .It Ic mode-bg Ar colour
                   2579: Set window modes background colour.
1.56      jmc      2580: .Pp
1.1       nicm     2581: .It Ic mode-fg Ar colour
                   2582: Set window modes foreground colour.
1.56      jmc      2583: .Pp
1.1       nicm     2584: .It Xo Ic mode-keys
1.56      jmc      2585: .Op Ic vi | emacs
1.1       nicm     2586: .Xc
1.105     nicm     2587: Use vi or emacs-style key bindings in copy and choice modes.
1.191     nicm     2588: As with the
                   2589: .Ic status-keys
                   2590: option, the default is emacs, unless
                   2591: .Ev VISUAL
                   2592: or
                   2593: .Ev EDITOR
                   2594: contains
                   2595: .Ql vi .
1.56      jmc      2596: .Pp
1.50      nicm     2597: .It Xo Ic mode-mouse
1.240     nicm     2598: .Op Ic on | off | copy-mode
1.50      nicm     2599: .Xc
1.51      jmc      2600: Mouse state in modes.
1.223     nicm     2601: If on, the mouse may be used to enter copy mode and copy a selection by
                   2602: dragging, to enter copy mode and scroll with the mouse wheel, or to select an
                   2603: option in choice mode.
1.240     nicm     2604: If set to
1.241     jmc      2605: .Em copy-mode ,
1.240     nicm     2606: the mouse behaves as set to on, but cannot be used to enter copy
                   2607: mode.
1.56      jmc      2608: .Pp
1.1       nicm     2609: .It Xo Ic monitor-activity
1.56      jmc      2610: .Op Ic on | off
1.1       nicm     2611: .Xc
                   2612: Monitor for activity in the window.
                   2613: Windows with activity are highlighted in the status line.
1.56      jmc      2614: .Pp
                   2615: .It Ic monitor-content Ar match-string
1.6       jmc      2616: Monitor content in the window.
                   2617: When
1.16      nicm     2618: .Xr fnmatch 3
                   2619: pattern
1.1       nicm     2620: .Ar match-string
                   2621: appears in the window, it is highlighted in the status line.
1.56      jmc      2622: .Pp
1.192     nicm     2623: .It Xo Ic monitor-silence
                   2624: .Op Ic interval
                   2625: .Xc
                   2626: Monitor for silence (no activity) in the window within
                   2627: .Ic interval
                   2628: seconds.
                   2629: Windows that have been silent for the interval are highlighted in the
                   2630: status line.
                   2631: An interval of zero disables the monitoring.
1.195     nicm     2632: .Pp
                   2633: .It Ic other-pane-height Ar height
                   2634: Set the height of the other panes (not the main pane) in the
                   2635: .Ic main-horizontal
                   2636: layout.
                   2637: If this option is set to 0 (the default), it will have no effect.
                   2638: If both the
                   2639: .Ic main-pane-height
                   2640: and
                   2641: .Ic other-pane-height
                   2642: options are set, the main pane will grow taller to make the other panes the
                   2643: specified height, but will never shrink to do so.
                   2644: .Pp
                   2645: .It Ic other-pane-width Ar width
                   2646: Like
                   2647: .Ic other-pane-height ,
                   2648: but set the width of other panes in the
                   2649: .Ic main-vertical
                   2650: layout.
1.243     nicm     2651: .Pp
                   2652: .It Ic pane-base-index Ar index
                   2653: Like
                   2654: .Ic base-index ,
                   2655: but set the starting index for pane numbers.
1.192     nicm     2656: .Pp
1.1       nicm     2657: .It Xo Ic remain-on-exit
1.56      jmc      2658: .Op Ic on | off
1.1       nicm     2659: .Xc
                   2660: A window with this flag set is not destroyed when the program running in it
                   2661: exits.
                   2662: The window may be reactivated with the
                   2663: .Ic respawn-window
                   2664: command.
1.56      jmc      2665: .Pp
1.99      nicm     2666: .It Xo Ic synchronize-panes
                   2667: .Op Ic on | off
                   2668: .Xc
1.164     nicm     2669: Duplicate input to any pane to all other panes in the same window (only
                   2670: for panes that are not in any special mode).
1.139     nicm     2671: .Pp
1.1       nicm     2672: .It Xo Ic utf8
1.56      jmc      2673: .Op Ic on | off
1.1       nicm     2674: .Xc
                   2675: Instructs
                   2676: .Nm
                   2677: to expect UTF-8 sequences to appear in this window.
1.56      jmc      2678: .Pp
1.264     nicm     2679: .It Ic window-status-bell-attr Ar attributes
                   2680: Set status line attributes for windows which have a bell alert.
1.169     nicm     2681: .Pp
1.264     nicm     2682: .It Ic window-status-bell-bg Ar colour
                   2683: Set status line background colour for windows with a bell alert.
1.169     nicm     2684: .Pp
1.264     nicm     2685: .It Ic window-status-bell-fg Ar colour
                   2686: Set status line foreground colour for windows with a bell alert.
                   2687: .Pp
                   2688: .It Ic window-status-content-attr Ar attributes
                   2689: Set status line attributes for windows which have a content alert.
                   2690: .Pp
                   2691: .It Ic window-status-content-bg Ar colour
                   2692: Set status line background colour for windows with a content alert.
                   2693: .Pp
                   2694: .It Ic window-status-content-fg Ar colour
                   2695: Set status line foreground colour for windows with a content alert.
                   2696: .Pp
                   2697: .It Ic window-status-activity-attr Ar attributes
                   2698: Set status line attributes for windows which have an activity (or silence) alert.
                   2699: .Pp
                   2700: .It Ic window-status-activity-bg Ar colour
                   2701: Set status line background colour for windows with an activity alert.
                   2702: .Pp
                   2703: .It Ic window-status-activity-fg Ar colour
                   2704: Set status line foreground colour for windows with an activity alert.
1.125     nicm     2705: .Pp
1.239     nicm     2706: .It Ic window-status-attr Ar attributes
                   2707: Set status line attributes for a single window.
                   2708: .Pp
                   2709: .It Ic window-status-bg Ar colour
                   2710: Set status line background colour for a single window.
                   2711: .Pp
1.40      nicm     2712: .It Ic window-status-current-attr Ar attributes
                   2713: Set status line attributes for the currently active window.
1.56      jmc      2714: .Pp
1.40      nicm     2715: .It Ic window-status-current-bg Ar colour
                   2716: Set status line background colour for the currently active window.
1.56      jmc      2717: .Pp
1.40      nicm     2718: .It Ic window-status-current-fg Ar colour
                   2719: Set status line foreground colour for the currently active window.
1.56      jmc      2720: .Pp
1.125     nicm     2721: .It Ic window-status-current-format Ar string
                   2722: Like
                   2723: .Ar window-status-format ,
                   2724: but is the format used when the window is the current window.
1.239     nicm     2725: .Pp
                   2726: .It Ic window-status-fg Ar colour
                   2727: Set status line foreground colour for a single window.
                   2728: .Pp
                   2729: .It Ic window-status-format Ar string
                   2730: Set the format in which the window is displayed in the status line window list.
                   2731: See the
                   2732: .Ar status-left
                   2733: option for details of special character sequences available.
                   2734: The default is
                   2735: .Ql #I:#W#F .
1.290     nicm     2736: .Pp
                   2737: .It Ic window-status-separator Ar string
                   2738: Sets the separator drawn between windows in the status line.
                   2739: The default is a single space character.
1.125     nicm     2740: .Pp
1.1       nicm     2741: .It Xo Ic xterm-keys
1.56      jmc      2742: .Op Ic on | off
1.1       nicm     2743: .Xc
                   2744: If this option is set,
                   2745: .Nm
                   2746: will generate
1.57      jmc      2747: .Xr xterm 1 -style
                   2748: function key sequences; these have a number included to indicate modifiers such
                   2749: as Shift, Alt or Ctrl.
1.123     nicm     2750: The default is off.
1.282     nicm     2751: .Pp
                   2752: .It Xo Ic wrap-search
                   2753: .Op Ic on | off
                   2754: .Xc
                   2755: If this option is set, searches will wrap around the end of the pane contents.
                   2756: The default is on.
1.57      jmc      2757: .El
                   2758: .It Xo Ic show-options
1.133     nicm     2759: .Op Fl gsw
1.129     nicm     2760: .Op Fl t Ar target-session | Ar target-window
1.276     nicm     2761: .Op Ar option
1.57      jmc      2762: .Xc
                   2763: .D1 (alias: Ic show )
1.276     nicm     2764: Show the window options (or a single window option if given) with
1.129     nicm     2765: .Fl w
1.133     nicm     2766: (equivalent to
1.134     nicm     2767: .Ic show-window-options ) ,
1.133     nicm     2768: the server options with
                   2769: .Fl s ,
                   2770: otherwise the session options for
                   2771: .Ar target session .
                   2772: Global session or window options are listed if
                   2773: .Fl g
                   2774: is used.
1.57      jmc      2775: .It Xo Ic show-window-options
                   2776: .Op Fl g
                   2777: .Op Fl t Ar target-window
1.276     nicm     2778: .Op Ar option
1.57      jmc      2779: .Xc
                   2780: .D1 (alias: Ic showw )
1.276     nicm     2781: List the window options or a single option for
1.57      jmc      2782: .Ar target-window ,
                   2783: or the global window options if
                   2784: .Fl g
                   2785: is used.
1.63      nicm     2786: .El
1.245     nicm     2787: .Sh FORMATS
1.294   ! nicm     2788: Certain commands accept the
1.245     nicm     2789: .Fl F
                   2790: flag with a
                   2791: .Ar format
                   2792: argument.
                   2793: This is a string which controls the output format of the command.
                   2794: Special character sequences are replaced as documented under the
                   2795: .Ic status-left
                   2796: option and an additional long form is accepted.
                   2797: Replacement variables are enclosed in
                   2798: .Ql #{
                   2799: and
                   2800: .Ql } ,
                   2801: for example
                   2802: .Ql #{session_name}
                   2803: is equivalent to
                   2804: .Ql #S .
                   2805: Conditionals are also accepted by prefixing with
1.246     jmc      2806: .Ql \&?
1.245     nicm     2807: and separating two alternatives with a comma;
                   2808: if the specified variable exists and is not zero, the first alternative
1.246     jmc      2809: is chosen, otherwise the second is used.
                   2810: For example
1.245     nicm     2811: .Ql #{?session_attached,attached,not attached}
                   2812: will include the string
                   2813: .Ql attached
                   2814: if the session is attached and the string
                   2815: .Ql not attached
                   2816: if it is unattached.
                   2817: .Pp
                   2818: The following variables are available, where appropriate:
                   2819: .Bl -column "session_created_string" "Replaced with" -offset indent
                   2820: .It Sy "Variable name" Ta Sy "Replaced with"
1.294   ! nicm     2821: .It Li "buffer_sample" Ta "First 50 characters from the specified buffer"
        !          2822: .It Li "buffer_size" Ta "Size of the specified buffer in bytes"
1.250     nicm     2823: .It Li "client_activity" Ta "Integer time client last had activity"
                   2824: .It Li "client_activity_string" Ta "String time client last had activity"
                   2825: .It Li "client_created" Ta "Integer time client created"
                   2826: .It Li "client_created_string" Ta "String time client created"
                   2827: .It Li "client_cwd" Ta "Working directory of client"
                   2828: .It Li "client_height" Ta "Height of client"
                   2829: .It Li "client_readonly" Ta "1 if client is readonly"
                   2830: .It Li "client_termname" Ta "Terminal name of client"
                   2831: .It Li "client_tty" Ta "Pseudo terminal of client"
                   2832: .It Li "client_utf8" Ta "1 if client supports utf8"
                   2833: .It Li "client_width" Ta "Width of client"
1.245     nicm     2834: .It Li "host" Ta "Hostname of local host"
                   2835: .It Li "line" Ta "Line number in the list"
                   2836: .It Li "pane_active" Ta "1 if active pane"
1.287     nicm     2837: .It Li "pane_current_path" Ta "Current path if available"
1.245     nicm     2838: .It Li "pane_dead" Ta "1 if pane is dead"
                   2839: .It Li "pane_height" Ta "Height of pane"
1.271     jmc      2840: .It Li "pane_id" Ta "Unique pane ID"
1.249     nicm     2841: .It Li "pane_pid" Ta "PID of first process in pane"
                   2842: .It Li "pane_start_command" Ta "Command pane started with"
                   2843: .It Li "pane_start_path" Ta "Path pane started with"
1.245     nicm     2844: .It Li "pane_title" Ta "Title of pane"
1.249     nicm     2845: .It Li "pane_tty" Ta "Pseudo terminal of pane"
1.245     nicm     2846: .It Li "pane_width" Ta "Width of pane"
                   2847: .It Li "session_attached" Ta "1 if session attached"
                   2848: .It Li "session_created" Ta "Integer time session created"
                   2849: .It Li "session_created_string" Ta "String time session created"
                   2850: .It Li "session_group" Ta "Number of session group"
                   2851: .It Li "session_grouped" Ta "1 if session in a group"
                   2852: .It Li "session_height" Ta "Height of session"
                   2853: .It Li "session_name" Ta "Name of session"
                   2854: .It Li "session_width" Ta "Width of session"
                   2855: .It Li "session_windows" Ta "Number of windows in session"
                   2856: .It Li "window_active" Ta "1 if window active"
1.294   ! nicm     2857: .It Li "window_find_matches" Ta "Matched data from the find-window command if available"
1.245     nicm     2858: .It Li "window_flags" Ta "Window flags"
                   2859: .It Li "window_height" Ta "Height of window"
                   2860: .It Li "window_index" Ta "Index of window"
                   2861: .It Li "window_layout" Ta "Window layout description"
                   2862: .It Li "window_name" Ta "Name of window"
1.294   ! nicm     2863: .It Li "window_panes" Ta "Number of panes in window"
1.245     nicm     2864: .It Li "window_width" Ta "Width of window"
                   2865: .El
1.261     nicm     2866: .Sh NAMES AND TITLES
                   2867: .Nm
                   2868: distinguishes between names and titles.
                   2869: Windows and sessions have names, which may be used to specify them in targets
                   2870: and are displayed in the status line and various lists: the name is the
                   2871: .Nm
                   2872: identifier for a window or session.
                   2873: Only panes have titles.
                   2874: A pane's title is typically set by the program running inside the pane and
                   2875: is not modified by
                   2876: .Nm .
                   2877: It is the same mechanism used to set for example the
                   2878: .Xr xterm 1
                   2879: window title in an
                   2880: .Xr X 7
                   2881: window manager.
1.268     nicm     2882: Windows themselves do not have titles - a window's title is the title of its
1.261     nicm     2883: active pane.
                   2884: .Nm
                   2885: itself may set the title of the terminal in which the client is running, see
                   2886: the
                   2887: .Ic set-titles
                   2888: option.
                   2889: .Pp
                   2890: A session's name is set with the
                   2891: .Ic new-session
                   2892: and
                   2893: .Ic rename-session
                   2894: commands.
                   2895: A window's name is set with one of:
                   2896: .Bl -enum -width Ds
                   2897: .It
                   2898: A command argument (such as
                   2899: .Fl n
                   2900: for
                   2901: .Ic new-window
                   2902: or
                   2903: .Ic new-session ) .
                   2904: .It
                   2905: An escape sequence:
                   2906: .Bd -literal -offset indent
                   2907: $ printf '\e033kWINDOW_NAME\e033\e\e'
                   2908: .Ed
                   2909: .It
                   2910: Automatic renaming, which sets the name to the active command in the window's
                   2911: active pane.
                   2912: See the
                   2913: .Ic automatic-rename
                   2914: option.
                   2915: .El
                   2916: .Pp
                   2917: When a pane is first created, its title is the hostname.
                   2918: A pane's title can be set via the OSC title setting sequence, for example:
                   2919: .Bd -literal -offset indent
                   2920: $ printf '\e033]2;My Title\e033\e\e'
                   2921: .Ed
1.63      nicm     2922: .Sh ENVIRONMENT
                   2923: When the server is started,
                   2924: .Nm
                   2925: copies the environment into the
                   2926: .Em global environment ;
                   2927: in addition, each session has a
                   2928: .Em session environment .
1.193     nicm     2929: When a window is created, the session and global environments are merged.
                   2930: If a variable exists in both, the value from the session environment is used.
                   2931: The result is the initial environment passed to the new process.
1.63      nicm     2932: .Pp
                   2933: The
                   2934: .Ic update-environment
                   2935: session option may be used to update the session environment from the client
                   2936: when a new session is created or an old reattached.
                   2937: .Nm
                   2938: also initialises the
                   2939: .Ev TMUX
                   2940: variable with some internal information to allow commands to be executed
                   2941: from inside, and the
                   2942: .Ev TERM
                   2943: variable with the correct terminal setting of
                   2944: .Ql screen .
                   2945: .Pp
                   2946: Commands to alter and view the environment are:
                   2947: .Bl -tag -width Ds
                   2948: .It Xo Ic set-environment
                   2949: .Op Fl gru
                   2950: .Op Fl t Ar target-session
                   2951: .Ar name Op Ar value
                   2952: .Xc
1.115     nicm     2953: .D1 (alias: Ic setenv )
1.63      nicm     2954: Set or unset an environment variable.
                   2955: If
                   2956: .Fl g
                   2957: is used, the change is made in the global environment; otherwise, it is applied
                   2958: to the session environment for
                   2959: .Ar target-session .
                   2960: The
                   2961: .Fl u
                   2962: flag unsets a variable.
                   2963: .Fl r
                   2964: indicates the variable is to be removed from the environment before starting a
                   2965: new process.
                   2966: .It Xo Ic show-environment
                   2967: .Op Fl g
                   2968: .Op Fl t Ar target-session
1.286     nicm     2969: .Op Ar variable
1.63      nicm     2970: .Xc
1.115     nicm     2971: .D1 (alias: Ic showenv )
1.63      nicm     2972: Display the environment for
                   2973: .Ar target-session
                   2974: or the global environment with
                   2975: .Fl g .
1.286     nicm     2976: If
                   2977: .Ar variable
                   2978: is omitted, all variables are shown.
1.63      nicm     2979: Variables removed from the environment are prefixed with
                   2980: .Ql - .
1.57      jmc      2981: .El
                   2982: .Sh STATUS LINE
                   2983: .Nm
                   2984: includes an optional status line which is displayed in the bottom line of each
                   2985: terminal.
                   2986: By default, the status line is enabled (it may be disabled with the
                   2987: .Ic status
                   2988: session option) and contains, from left-to-right: the name of the current
1.261     nicm     2989: session in square brackets; the window list; the title of the active pane
                   2990: in double quotes; and the time and date.
1.57      jmc      2991: .Pp
                   2992: The status line is made of three parts: configurable left and right sections
                   2993: (which may contain dynamic content such as the time or output from a shell
                   2994: command, see the
                   2995: .Ic status-left ,
                   2996: .Ic status-left-length ,
                   2997: .Ic status-right ,
                   2998: and
                   2999: .Ic status-right-length
                   3000: options below), and a central window list.
1.125     nicm     3001: By default, the window list shows the index, name and (if any) flag of the
                   3002: windows present in the current session in ascending numerical order.
                   3003: It may be customised with the
                   3004: .Ar window-status-format
                   3005: and
                   3006: .Ar window-status-current-format
                   3007: options.
1.57      jmc      3008: The flag is one of the following symbols appended to the window name:
                   3009: .Bl -column "Symbol" "Meaning" -offset indent
                   3010: .It Sy "Symbol" Ta Sy "Meaning"
                   3011: .It Li "*" Ta "Denotes the current window."
                   3012: .It Li "-" Ta "Marks the last window (previously selected)."
                   3013: .It Li "#" Ta "Window is monitored and activity has been detected."
                   3014: .It Li "!" Ta "A bell has occurred in the window."
                   3015: .It Li "+" Ta "Window is monitored for content and it has appeared."
1.192     nicm     3016: .It Li "~" Ta "The window has been silent for the monitor-silence interval."
1.57      jmc      3017: .El
                   3018: .Pp
                   3019: The # symbol relates to the
                   3020: .Ic monitor-activity
                   3021: and + to the
                   3022: .Ic monitor-content
                   3023: window options.
                   3024: The window name is printed in inverted colours if an alert (bell, activity or
                   3025: content) is present.
                   3026: .Pp
1.131     nicm     3027: The colour and attributes of the status line may be configured, the entire
                   3028: status line using the
1.57      jmc      3029: .Ic status-attr ,
                   3030: .Ic status-fg
                   3031: and
                   3032: .Ic status-bg
                   3033: session options and individual windows using the
                   3034: .Ic window-status-attr ,
                   3035: .Ic window-status-fg
                   3036: and
                   3037: .Ic window-status-bg
                   3038: window options.
                   3039: .Pp
1.131     nicm     3040: The status line is automatically refreshed at interval if it has changed, the
                   3041: interval may be controlled with the
1.57      jmc      3042: .Ic status-interval
                   3043: session option.
                   3044: .Pp
                   3045: Commands related to the status line are as follows:
                   3046: .Bl -tag -width Ds
                   3047: .It Xo Ic command-prompt
1.235     nicm     3048: .Op Fl I Ar inputs
1.73      nicm     3049: .Op Fl p Ar prompts
1.57      jmc      3050: .Op Fl t Ar target-client
                   3051: .Op Ar template
                   3052: .Xc
                   3053: Open the command prompt in a client.
                   3054: This may be used from inside
                   3055: .Nm
                   3056: to execute commands interactively.
1.231     nicm     3057: .Pp
1.57      jmc      3058: If
                   3059: .Ar template
1.73      nicm     3060: is specified, it is used as the command.
1.235     nicm     3061: If present,
                   3062: .Fl I
                   3063: is a comma-separated list of the initial text for each prompt.
1.73      nicm     3064: If
                   3065: .Fl p
                   3066: is given,
                   3067: .Ar prompts
                   3068: is a comma-separated list of prompts which are displayed in order; otherwise
                   3069: a single prompt is displayed, constructed from
                   3070: .Ar template
                   3071: if it is present, or
                   3072: .Ql \&:
                   3073: if not.
1.235     nicm     3074: .Pp
                   3075: Both
                   3076: .Ar inputs
                   3077: and
1.231     nicm     3078: .Ar prompts
                   3079: may contain the special character sequences supported by the
                   3080: .Ic status-left
                   3081: option.
                   3082: .Pp
1.73      nicm     3083: Before the command is executed, the first occurrence of the string
                   3084: .Ql %%
1.74      jmc      3085: and all occurrences of
1.73      nicm     3086: .Ql %1
                   3087: are replaced by the response to the first prompt, the second
                   3088: .Ql %%
                   3089: and all
                   3090: .Ql %2
                   3091: are replaced with the response to the second prompt, and so on for further
1.74      jmc      3092: prompts.
                   3093: Up to nine prompt responses may be replaced
                   3094: .Po
                   3095: .Ql %1
1.73      nicm     3096: to
1.74      jmc      3097: .Ql %9
                   3098: .Pc .
1.57      jmc      3099: .It Xo Ic confirm-before
1.238     nicm     3100: .Op Fl p Ar prompt
1.57      jmc      3101: .Op Fl t Ar target-client
                   3102: .Ar command
                   3103: .Xc
                   3104: .D1 (alias: Ic confirm )
                   3105: Ask for confirmation before executing
                   3106: .Ar command .
1.238     nicm     3107: If
                   3108: .Fl p
                   3109: is given,
                   3110: .Ar prompt
                   3111: is the prompt to display; otherwise a prompt is constructed from
                   3112: .Ar command .
                   3113: It may contain the special character sequences supported by the
                   3114: .Ic status-left
                   3115: option.
                   3116: .Pp
1.57      jmc      3117: This command works only from inside
                   3118: .Nm .
                   3119: .It Xo Ic display-message
1.127     nicm     3120: .Op Fl p
1.215     nicm     3121: .Op Fl c Ar target-client
                   3122: .Op Fl t Ar target-pane
1.57      jmc      3123: .Op Ar message
                   3124: .Xc
                   3125: .D1 (alias: Ic display )
1.127     nicm     3126: Display a message.
                   3127: If
                   3128: .Fl p
                   3129: is given, the output is printed to stdout, otherwise it is displayed in the
                   3130: .Ar target-client
                   3131: status line.
1.122     nicm     3132: The format of
1.124     jmc      3133: .Ar message
1.275     nicm     3134: is described in the
                   3135: .Sx FORMATS
                   3136: section; information is taken from
1.215     nicm     3137: .Ar target-pane
                   3138: if
                   3139: .Fl t
                   3140: is given, otherwise the active pane for the session attached to
                   3141: .Ar target-client .
1.57      jmc      3142: .El
                   3143: .Sh BUFFERS
                   3144: .Nm
                   3145: maintains a stack of
1.199     nicm     3146: .Em paste buffers .
1.57      jmc      3147: Up to the value of the
                   3148: .Ic buffer-limit
                   3149: option are kept; when a new buffer is added, the buffer at the bottom of the
                   3150: stack is removed.
                   3151: Buffers may be added using
                   3152: .Ic copy-mode
                   3153: or the
                   3154: .Ic set-buffer
                   3155: command, and pasted into a window using the
                   3156: .Ic paste-buffer
                   3157: command.
                   3158: .Pp
                   3159: A configurable history buffer is also maintained for each window.
                   3160: By default, up to 2000 lines are kept; this can be altered with the
                   3161: .Ic history-limit
                   3162: option (see the
                   3163: .Ic set-option
                   3164: command above).
                   3165: .Pp
                   3166: The buffer commands are as follows:
                   3167: .Bl -tag -width Ds
1.178     nicm     3168: .It Xo
                   3169: .Ic choose-buffer
1.294   ! nicm     3170: .Op Fl F Ar format
1.178     nicm     3171: .Op Fl t Ar target-window
                   3172: .Op Ar template
                   3173: .Xc
                   3174: Put a window into buffer choice mode, where a buffer may be chosen
                   3175: interactively from a list.
                   3176: After a buffer is selected,
                   3177: .Ql %%
                   3178: is replaced by the buffer index in
                   3179: .Ar template
                   3180: and the result executed as a command.
                   3181: If
                   3182: .Ar template
                   3183: is not given, "paste-buffer -b '%%'" is used.
1.294   ! nicm     3184: For the meaning of the
        !          3185: .Fl F
        !          3186: flag, see the
        !          3187: .Sx FORMATS
        !          3188: section.
1.178     nicm     3189: This command works only from inside
                   3190: .Nm .
1.57      jmc      3191: .It Ic clear-history Op Fl t Ar target-pane
                   3192: .D1 (alias: Ic clearhist )
                   3193: Remove and free the history for the specified pane.
1.198     nicm     3194: .It Ic delete-buffer Op Fl b Ar buffer-index
1.57      jmc      3195: .D1 (alias: Ic deleteb )
                   3196: Delete the buffer at
                   3197: .Ar buffer-index ,
                   3198: or the top buffer if not specified.
1.294   ! nicm     3199: .It Xo Ic list-buffers
        !          3200: .Op Fl F Ar format
        !          3201: .Xc
1.57      jmc      3202: .D1 (alias: Ic lsb )
1.198     nicm     3203: List the global buffers.
1.294   ! nicm     3204: For the meaning of the
        !          3205: .Fl F
        !          3206: flag, see the
        !          3207: .Sx FORMATS
        !          3208: section.
1.200     jmc      3209: .It Xo Ic load-buffer
1.57      jmc      3210: .Op Fl b Ar buffer-index
                   3211: .Ar path
                   3212: .Xc
                   3213: .D1 (alias: Ic loadb )
                   3214: Load the contents of the specified paste buffer from
                   3215: .Ar path .
                   3216: .It Xo Ic paste-buffer
1.278     nicm     3217: .Op Fl dpr
1.57      jmc      3218: .Op Fl b Ar buffer-index
1.170     nicm     3219: .Op Fl s Ar separator
1.158     nicm     3220: .Op Fl t Ar target-pane
1.57      jmc      3221: .Xc
                   3222: .D1 (alias: Ic pasteb )
1.158     nicm     3223: Insert the contents of a paste buffer into the specified pane.
                   3224: If not specified, paste into the current one.
1.57      jmc      3225: With
                   3226: .Fl d ,
                   3227: also delete the paste buffer from the stack.
                   3228: When output, any linefeed (LF) characters in the paste buffer are replaced with
1.170     nicm     3229: a separator, by default carriage return (CR).
                   3230: A custom separator may be specified using the
                   3231: .Fl s
                   3232: flag.
                   3233: The
1.57      jmc      3234: .Fl r
1.170     nicm     3235: flag means to do no replacement (equivalent to a separator of LF).
1.278     nicm     3236: If
                   3237: .Fl p
                   3238: is specified, paste bracket control codes are inserted around the
                   3239: buffer if the application has requested bracketed paste mode.
1.57      jmc      3240: .It Xo Ic save-buffer
                   3241: .Op Fl a
                   3242: .Op Fl b Ar buffer-index
                   3243: .Ar path
                   3244: .Xc
                   3245: .D1 (alias: Ic saveb )
                   3246: Save the contents of the specified paste buffer to
                   3247: .Ar path .
                   3248: The
                   3249: .Fl a
                   3250: option appends to rather than overwriting the file.
                   3251: .It Xo Ic set-buffer
                   3252: .Op Fl b Ar buffer-index
                   3253: .Ar data
                   3254: .Xc
                   3255: .D1 (alias: Ic setb )
                   3256: Set the contents of the specified buffer to
                   3257: .Ar data .
1.1       nicm     3258: .It Xo Ic show-buffer
                   3259: .Op Fl b Ar buffer-index
                   3260: .Xc
                   3261: .D1 (alias: Ic showb )
                   3262: Display the contents of the specified buffer.
1.57      jmc      3263: .El
                   3264: .Sh MISCELLANEOUS
                   3265: Miscellaneous commands are as follows:
                   3266: .Bl -tag -width Ds
1.72      nicm     3267: .It Ic clock-mode Op Fl t Ar target-pane
1.57      jmc      3268: Display a large clock.
1.251     nicm     3269: .It Ic if-shell Ar shell-command command Op Ar command
1.57      jmc      3270: .D1 (alias: Ic if )
1.251     nicm     3271: Execute the first
1.57      jmc      3272: .Ar command
                   3273: if
                   3274: .Ar shell-command
1.251     nicm     3275: returns success or the second
                   3276: .Ar command
                   3277: otherwise.
1.57      jmc      3278: .It Ic lock-server
                   3279: .D1 (alias: Ic lock )
1.90      nicm     3280: Lock each client individually by running the command specified by the
                   3281: .Ic lock-command
                   3282: option.
1.153     nicm     3283: .It Ic run-shell Ar shell-command
1.87      nicm     3284: .D1 (alias: Ic run )
                   3285: Execute
1.153     nicm     3286: .Ar shell-command
1.106     nicm     3287: in the background without creating a window.
1.164     nicm     3288: After it finishes, any output to stdout is displayed in copy mode.
1.153     nicm     3289: If the command doesn't return success, the exit status is also displayed.
1.57      jmc      3290: .It Ic server-info
                   3291: .D1 (alias: Ic info )
                   3292: Show server information and terminal details.
1.228     nicm     3293: .El
                   3294: .Sh TERMINFO EXTENSIONS
                   3295: .Nm
                   3296: understands some extensions to
                   3297: .Xr terminfo 5 :
                   3298: .Bl -tag -width Ds
1.232     jmc      3299: .It Em Cc , Cr
1.233     nicm     3300: Set the cursor colour.
1.232     jmc      3301: The first takes a single string argument and is used to set the colour;
                   3302: the second takes no arguments and restores the default cursor colour.
                   3303: If set, a sequence such as this may be used
                   3304: to change the cursor colour from inside
                   3305: .Nm :
                   3306: .Bd -literal -offset indent
                   3307: $ printf '\e033]12;red\e033\e\e'
                   3308: .Ed
                   3309: .It Em Cs , Csr
1.230     nicm     3310: Change the cursor style.
1.232     jmc      3311: If set, a sequence such as this may be used
                   3312: to change the cursor to an underline:
1.230     nicm     3313: .Bd -literal -offset indent
                   3314: $ printf '\e033[4 q'
                   3315: .Ed
                   3316: .Pp
                   3317: If
                   3318: .Em Csr
                   3319: is set, it will be used to reset the cursor style instead
                   3320: of
                   3321: .Em Cs .
1.232     jmc      3322: .It Em \&Ms
                   3323: This sequence can be used by
                   3324: .Nm
                   3325: to store the current buffer in the host terminal's selection (clipboard).
                   3326: See the
                   3327: .Em set-clipboard
                   3328: option above and the
                   3329: .Xr xterm 1
                   3330: man page.
1.1       nicm     3331: .El
                   3332: .Sh FILES
1.26      nicm     3333: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1       nicm     3334: .It Pa ~/.tmux.conf
1.6       jmc      3335: Default
1.1       nicm     3336: .Nm
1.6       jmc      3337: configuration file.
1.26      nicm     3338: .It Pa /etc/tmux.conf
                   3339: System-wide configuration file.
1.1       nicm     3340: .El
1.57      jmc      3341: .Sh EXAMPLES
                   3342: To create a new
                   3343: .Nm
                   3344: session running
                   3345: .Xr vi 1 :
                   3346: .Pp
                   3347: .Dl $ tmux new-session vi
                   3348: .Pp
                   3349: Most commands have a shorter form, known as an alias.
                   3350: For new-session, this is
                   3351: .Ic new :
                   3352: .Pp
                   3353: .Dl $ tmux new vi
                   3354: .Pp
                   3355: Alternatively, the shortest unambiguous form of a command is accepted.
                   3356: If there are several options, they are listed:
                   3357: .Bd -literal -offset indent
                   3358: $ tmux n
                   3359: ambiguous command: n, could be: new-session, new-window, next-window
                   3360: .Ed
                   3361: .Pp
                   3362: Within an active session, a new window may be created by typing
                   3363: .Ql C-b c
                   3364: (Ctrl
                   3365: followed by the
                   3366: .Ql b
                   3367: key
                   3368: followed by the
                   3369: .Ql c
                   3370: key).
                   3371: .Pp
                   3372: Windows may be navigated with:
                   3373: .Ql C-b 0
                   3374: (to select window 0),
                   3375: .Ql C-b 1
                   3376: (to select window 1), and so on;
                   3377: .Ql C-b n
                   3378: to select the next window; and
                   3379: .Ql C-b p
                   3380: to select the previous window.
                   3381: .Pp
                   3382: A session may be detached using
                   3383: .Ql C-b d
1.64      nicm     3384: (or by an external event such as
                   3385: .Xr ssh 1
                   3386: disconnection) and reattached with:
1.57      jmc      3387: .Pp
                   3388: .Dl $ tmux attach-session
                   3389: .Pp
                   3390: Typing
                   3391: .Ql C-b \&?
                   3392: lists the current key bindings in the current window; up and down may be used
                   3393: to navigate the list or
                   3394: .Ql q
                   3395: to exit from it.
                   3396: .Pp
                   3397: Commands to be run when the
                   3398: .Nm
                   3399: server is started may be placed in the
                   3400: .Pa ~/.tmux.conf
                   3401: configuration file.
                   3402: Common examples include:
                   3403: .Pp
                   3404: Changing the default prefix key:
                   3405: .Bd -literal -offset indent
                   3406: set-option -g prefix C-a
                   3407: unbind-key C-b
                   3408: bind-key C-a send-prefix
                   3409: .Ed
                   3410: .Pp
                   3411: Turning the status line off, or changing its colour:
                   3412: .Bd -literal -offset indent
                   3413: set-option -g status off
                   3414: set-option -g status-bg blue
                   3415: .Ed
                   3416: .Pp
                   3417: Setting other options, such as the default command,
                   3418: or locking after 30 minutes of inactivity:
                   3419: .Bd -literal -offset indent
                   3420: set-option -g default-command "exec /bin/ksh"
                   3421: set-option -g lock-after-time 1800
                   3422: .Ed
                   3423: .Pp
                   3424: Creating new key bindings:
                   3425: .Bd -literal -offset indent
                   3426: bind-key b set-option status
                   3427: bind-key / command-prompt "split-window 'exec man %%'"
1.73      nicm     3428: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57      jmc      3429: .Ed
1.1       nicm     3430: .Sh SEE ALSO
                   3431: .Xr pty 4
                   3432: .Sh AUTHORS
                   3433: .An Nicholas Marriott Aq nicm@users.sourceforge.net