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

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