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

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