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

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