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