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

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