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