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