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