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