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