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