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

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