Annotation of src/usr.bin/tmux/tmux.1, Revision 1.84
1.84 ! nicm 1: .\" $OpenBSD: tmux.1,v 1.83 2009/09/07 10:49:32 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.84 ! nicm 17: .Dd $Mdocdate: September 7 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.84 ! nicm 692: While the indicator is on screen, a pane may be selected with the
! 693: .Ql 0
! 694: to
! 695: .Ql 9
! 696: keys.
1.57 jmc 697: .It Ic down-pane Op Fl t Ar target-pane
698: .D1 (alias: Ic downp )
699: Move down a pane.
700: .It Xo Ic find-window
701: .Op Fl t Ar target-window
702: .Ar match-string
703: .Xc
704: .D1 (alias: Ic findw )
705: Search for the
706: .Xr fnmatch 3
707: pattern
708: .Ar match-string
709: in window names, titles, and visible content (but not history).
710: If only one window is matched, it'll be automatically selected, otherwise a
711: choice list is shown.
712: This command only works from inside
1.1 nicm 713: .Nm .
1.57 jmc 714: .It Ic kill-pane Op Fl t Ar target-pane
715: .D1 (alias: Ic killp )
716: Destroy the given pane.
717: If no panes remain in the containing window, it is also destroyed.
718: .It Ic kill-window Op Fl t Ar target-window
719: .D1 (alias: Ic killw )
720: Kill the current window or the window at
721: .Ar target-window ,
1.1 nicm 722: removing it from any sessions to which it is linked.
1.56 jmc 723: .It Ic last-window Op Fl t Ar target-session
1.1 nicm 724: .D1 (alias: Ic last )
725: Select the last (previously selected) window.
726: If no
727: .Ar target-session
728: is specified, select the last window of the current session.
729: .It Xo Ic link-window
730: .Op Fl dk
731: .Op Fl s Ar src-window
732: .Op Fl t Ar dst-window
733: .Xc
734: .D1 (alias: Ic linkw )
735: Link the window at
736: .Ar src-window
737: to the specified
738: .Ar dst-window .
739: If
740: .Ar dst-window
741: is specified and no such window exists, the
742: .Ar src-window
743: is linked there.
744: If
745: .Fl k
746: is given and
747: .Ar dst-window
748: exists, it is killed, otherwise an error is generated.
749: If
750: .Fl d
751: is given, the newly linked window is not selected.
1.56 jmc 752: .It Ic list-windows Op Fl t Ar target-session
1.1 nicm 753: .D1 (alias: Ic lsw )
754: List windows in the current session or in
755: .Ar target-session .
756: .It Xo Ic move-window
757: .Op Fl d
758: .Op Fl s Ar src-window
759: .Op Fl t Ar dst-window
760: .Xc
761: .D1 (alias: Ic movew )
762: This is similar to
763: .Ic link-window ,
764: except the window at
765: .Ar src-window
766: is moved to
767: .Ar dst-window .
768: .It Xo Ic new-window
1.28 nicm 769: .Op Fl dk
1.1 nicm 770: .Op Fl n Ar window-name
771: .Op Fl t Ar target-window
772: .Op Ar command
773: .Xc
774: .D1 (alias: Ic neww )
775: Create a new window.
776: If
777: .Fl d
778: is given, the session does not make the new window the current window.
779: .Ar target-window
1.28 nicm 780: represents the window to be created; if the target already exists an error is
781: shown, unless the
782: .Fl k
783: flag is used, in which case it is destroyed.
1.1 nicm 784: .Ar command
785: is the command to execute.
786: If
787: .Ar command
788: is not specified, the default command is used.
789: .Pp
790: The
791: .Ev TERM
792: environment variable must be set to
793: .Dq screen
794: for all programs running
795: .Em inside
796: .Nm .
797: New windows will automatically have
798: .Dq TERM=screen
799: added to their environment, but care must be taken not to reset this in shell
800: start-up files.
1.56 jmc 801: .It Ic next-layout Op Fl t Ar target-window
1.1 nicm 802: .D1 (alias: Ic nextl )
803: Move a window to the next layout and rearrange the panes to fit.
804: .It Xo Ic next-window
1.9 nicm 805: .Op Fl a
1.1 nicm 806: .Op Fl t Ar target-session
807: .Xc
808: .D1 (alias: Ic next )
809: Move to the next window in the session.
1.9 nicm 810: If
1.12 jmc 811: .Fl a
1.9 nicm 812: is used, move to the next window with a bell, activity or content alert.
1.1 nicm 813: .It Xo Ic previous-window
1.9 nicm 814: .Op Fl a
1.1 nicm 815: .Op Fl t Ar target-session
816: .Xc
817: .D1 (alias: Ic prev )
818: Move to the previous window in the session.
1.9 nicm 819: With
820: .Fl a ,
821: move to the previous window with a bell, activity or content alert.
1.1 nicm 822: .It Xo Ic rename-window
823: .Op Fl t Ar target-window
824: .Ar new-name
825: .Xc
826: .D1 (alias: Ic renamew )
827: Rename the current window, or the window at
828: .Ar target-window
829: if specified, to
830: .Ar new-name .
831: .It Xo Ic resize-pane
1.39 jmc 832: .Op Fl DLRU
1.52 nicm 833: .Op Fl t Ar target-pane
1.1 nicm 834: .Op Ar adjustment
835: .Xc
836: .D1 (alias: Ic resizep )
1.57 jmc 837: Resize a pane, upward with
838: .Fl U
839: (the default), downward with
840: .Fl D ,
841: to the left with
842: .Fl L
843: and to the right with
844: .Fl R .
845: The
846: .Ar adjustment
847: is given in lines or cells (the default is 1).
848: .It Xo Ic respawn-window
849: .Op Fl k
850: .Op Fl t Ar target-window
851: .Op Ar command
852: .Xc
853: .D1 (alias: Ic respawnw )
854: Reactive a window in which the command has exited (see the
855: .Ic remain-on-exit
856: window option).
857: If
858: .Ar command
859: is not given, the command used when the window was created is executed.
860: The window must be already inactive, unless
861: .Fl k
862: is given, in which case any existing command is killed.
863: .It Xo Ic rotate-window
864: .Op Fl DU
865: .Op Fl t Ar target-window
866: .Xc
867: .D1 (alias: Ic rotatew )
868: Rotate the positions of the panes within a window, either upward (numerically
869: lower) with
870: .Fl U
871: or downward (numerically higher).
872: .It Xo Ic select-layout
873: .Op Fl t Ar target-window
874: .Op Ar layout-name
875: .Xc
876: .D1 (alias: selectl )
877: Choose a specific layout for a window.
878: If
879: .Ar layout-name
880: is not given, the last layout used (if any) is reapplied.
881: .It Ic select-pane Op Fl t Ar target-pane
882: .D1 (alias: Ic selectp )
883: Make pane
884: .Ar target-pane
885: the active pane in window
886: .Ar target-window .
887: .It Ic select-window Op Fl t Ar target-window
888: .D1 (alias: Ic selectw )
889: Select the window at
890: .Ar target-window .
891: .It Xo Ic split-window
892: .Op Fl dhv
893: .Oo Fl l
894: .Ar size |
895: .Fl p Ar percentage Oc
896: .Op Fl t Ar target-window
897: .Op Ar command
898: .Xc
899: .D1 (alias: splitw )
900: Creates a new pane by splitting the active pane:
901: .Fl h
902: does a horizontal split and
903: .Fl v
904: a vertical split; if neither is specified,
905: .Fl v
906: is assumed.
907: The
908: .Fl l
909: and
910: .Fl p
911: options specify the size of the new window in lines (for vertical split) or in
912: cells (for horizontal split), or as a percentage, respectively.
913: All other options have the same meaning as in the
914: .Ic new-window
915: command.
916: .It Xo Ic swap-pane
917: .Op Fl dDU
918: .Op Fl s Ar src-pane
919: .Op Fl t Ar dst-pane
920: .Xc
921: .D1 (alias: Ic swapp )
922: Swap two panes.
923: If
924: .Fl U
925: is used and no source pane is specified with
926: .Fl s ,
927: .Ar dst-pane
928: is swapped with the previous pane (before it numerically);
929: .Fl D
930: swaps with the next pane (after it numerically).
931: .It Xo Ic swap-window
932: .Op Fl d
933: .Op Fl s Ar src-window
934: .Op Fl t Ar dst-window
935: .Xc
936: .D1 (alias: Ic swapw )
937: This is similar to
938: .Ic link-window ,
939: except the source and destination windows are swapped.
940: It is an error if no window exists at
941: .Ar src-window .
942: .It Xo Ic unlink-window
1.1 nicm 943: .Op Fl k
944: .Op Fl t Ar target-window
945: .Xc
1.57 jmc 946: .D1 (alias: Ic unlinkw )
947: Unlink
948: .Ar target-window .
949: Unless
950: .Fl k
951: is given, a window may be unlinked only if it is linked to multiple sessions -
952: windows may not be linked to no sessions;
953: if
1.1 nicm 954: .Fl k
1.57 jmc 955: is specified and the window is linked to only one session, it is unlinked and
956: destroyed.
957: .It Ic up-pane Op Fl t Ar target-pane
958: .D1 (alias: Ic upp )
959: Move up a pane.
960: .El
961: .Sh KEY BINDINGS
962: Commands related to key bindings are as follows:
963: .Bl -tag -width Ds
964: .It Xo Ic bind-key
965: .Op Fl cnr
966: .Op Fl t Ar key-table
967: .Ar key Ar command Op Ar arguments
1.1 nicm 968: .Xc
1.57 jmc 969: .D1 (alias: Ic bind )
970: Bind key
971: .Ar key
972: to
973: .Ar command .
974: Keys may be specified prefixed with
975: .Ql C-
976: or
977: .Ql ^
978: for Ctrl keys, or
979: .Ql M-
980: for Alt (meta) keys.
981: .Pp
982: By default (without
983: .Fl t )
984: the primary key bindings are modified (those normally activated with the prefix
985: key); in this case, if
986: .Fl n
987: is specified, it is not necessary to use the prefix key,
988: .Ar command
989: is bound to
990: .Ar key
991: alone.
1.1 nicm 992: The
1.57 jmc 993: .Fl r
994: flag indicates this key may repeat, see the
995: .Ic repeat-time
996: option.
997: .Pp
998: If
999: .Fl t
1000: is present,
1001: .Ar key
1002: is bound in
1003: .Ar key-table :
1004: the binding for command mode with
1005: .Fl c
1006: or for normal mode without.
1007: To view the default bindings and possible commands, see the
1008: .Ic list-keys
1009: command.
1010: .It Ic list-keys Op Fl t Ar key-table
1011: .D1 (alias: Ic lsk )
1012: List all key bindings.
1013: Without
1014: .Fl t
1015: the primary key bindings - those executed when preceded by the prefix key -
1016: are printed.
1017: Keys bound without the prefix key (see
1018: .Ic bind-key
1019: .Fl n )
1020: are enclosed in square brackets.
1021: .Pp
1022: With
1023: .Fl t ,
1024: the key bindings in
1025: .Ar key-table
1026: are listed; this may be one of:
1027: .Em vi-edit ,
1028: .Em emacs-edit ,
1029: .Em vi-choice ,
1030: .Em emacs-choice ,
1031: .Em vi-copy
1032: or
1033: .Em emacs-copy .
1034: .It Xo Ic send-keys
1.72 nicm 1035: .Op Fl t Ar target-pane
1.57 jmc 1036: .Ar key Ar ...
1.1 nicm 1037: .Xc
1.57 jmc 1038: .D1 (alias: Ic send )
1039: Send a key or keys to a window.
1040: Each argument
1041: .Ar key
1042: is the name of the key (such as
1043: .Ql C-a
1044: or
1045: .Ql npage
1046: ) to send; if the string is not recognised as a key, it is sent as a series of
1047: characters.
1048: All arguments are sent sequentially from first to last.
1.72 nicm 1049: .It Ic send-prefix Op Fl t Ar target-pane
1.57 jmc 1050: Send the prefix key to a window as if it was pressed.
1051: .It Xo Ic unbind-key
1052: .Op Fl cn
1053: .Op Fl t Ar key-table
1054: .Ar key
1.2 nicm 1055: .Xc
1.57 jmc 1056: .D1 (alias: Ic unbind )
1057: Unbind the command bound to
1058: .Ar key .
1059: Without
1060: .Fl t
1061: the primary key bindings are modified; in this case, if
1062: .Fl n
1063: is specified, the command bound to
1064: .Ar key
1065: without a prefix (if any) is removed.
1066: .Pp
1.47 nicm 1067: If
1.57 jmc 1068: .Fl t
1069: is present,
1070: .Ar key
1071: in
1072: .Ar key-table
1073: is unbound: the binding for command mode with
1074: .Fl c
1075: or for normal mode without.
1076: .El
1077: .Sh OPTIONS
1078: The appearance and behaviour of
1079: .Nm
1080: may be modified by changing the value of various options.
1081: There are two types of option:
1082: .Em session options
1083: and
1084: .Em window options .
1085: .Pp
1086: Each individual session may have a set of session options, and there is a
1087: separate set of global session options.
1088: Sessions which do not have a particular option configured inherit the value
1089: from the global session options.
1090: Session options are set or unset with the
1091: .Ic set-option
1092: command and may be listed with the
1093: .Ic show-options
1094: command.
1095: The available session options are listed under the
1096: .Ic set-option
1097: command.
1098: .Pp
1099: Similarly, a set of window options is attached to each window, and there is
1100: a set of global window options from which any unset options are inherited.
1101: Window options are altered with the
1102: .Ic set-window-option
1103: command and can be listed with the
1104: .Ic show-window-options
1105: command.
1106: All window options are documented with the
1107: .Ic set-window-option
1108: command.
1109: .Pp
1110: Commands which set options are as follows:
1111: .Bl -tag -width Ds
1.1 nicm 1112: .It Xo Ic set-option
1.58 nicm 1113: .Op Fl agu
1.1 nicm 1114: .Op Fl t Ar target-session
1115: .Ar option Ar value
1116: .Xc
1117: .D1 (alias: Ic set )
1.18 nicm 1118: Set a session option.
1.58 nicm 1119: With
1120: .Fl a ,
1121: and if the option expects a string,
1122: .Ar value
1123: is appended to the existing setting.
1.1 nicm 1124: If
1125: .Fl g
1.18 nicm 1126: is specified, the global session option is set.
1.1 nicm 1127: The
1128: .Fl u
1129: flag unsets an option, so a session inherits the option from the global
1130: options - it is not possible to unset a global option.
1131: .Pp
1.18 nicm 1132: Available session options are:
1.1 nicm 1133: .Bl -tag -width Ds
1.69 nicm 1134: .It Ic base-index Ar index
1135: Set the base index from which an unused index should be searched when a new
1136: window is created.
1137: The default is zero.
1.1 nicm 1138: .It Xo Ic bell-action
1.56 jmc 1139: .Op Ic any | none | current
1.1 nicm 1140: .Xc
1141: Set action on window bell.
1142: .Ic any
1143: means a bell in any window linked to a session causes a bell in the current
1144: window of that session,
1145: .Ic none
1146: means all bells are ignored and
1147: .Ic current
1148: means only bell in windows other than the current window are ignored.
1149: .It Ic buffer-limit Ar number
1150: Set the number of buffers kept for each session; as new buffers are added to
1151: the top of the stack, old ones are removed from the bottom if necessary to
1152: maintain this maximum length.
1153: .It Ic default-command Ar command
1154: Set the command used for new windows (if not specified when the window is
1155: created) to
1.79 nicm 1156: .Ar command ,
1157: which may be any
1158: .Xr sh 1
1159: command.
1.19 nicm 1160: The default is an empty string, which instructs
1161: .Nm
1.79 nicm 1162: to create a login shell using the value of the
1163: .Ic default-shell
1164: option.
1165: .It Ic default-shell Ar path
1166: Specify the default shell.
1167: This is used as the login shell for new windows when the
1168: .Ic default-command
1169: option is set to empty, and must be the full path of the executable.
1170: When started
1171: .Nm
1172: tries to set a default value from the first suitable of the
1.19 nicm 1173: .Ev SHELL
1.79 nicm 1174: environment variable, the shell returned by
1175: .Xr getpwuid 3 ,
1176: or
1177: .Pa /bin/sh .
1178: This option should be configured when
1179: .Nm
1180: is used as a login shell.
1.1 nicm 1181: .It Ic default-path Ar path
1182: Set the default working directory for processes created from keys, or
1183: interactively from the prompt.
1184: The default is the current working directory when the server is started.
1.22 nicm 1185: .It Ic default-terminal Ar terminal
1186: Set the default terminal for new windows created in this session - the
1187: default value of the
1188: .Ev TERM
1189: environment variable.
1190: For
1191: .Nm
1192: to work correctly, this
1193: .Em must
1194: be set to
1195: .Ql screen
1196: or a derivative of it.
1.78 nicm 1197: .It Ic display-panes-colour Ar colour
1198: Set the colour used for the
1199: .Ic display-panes
1200: command.
1201: .It Ic display-panes-time Ar time
1202: Set the time in milliseconds for which the indicators shown by the
1203: .Ic display-panes
1204: command appear.
1.21 nicm 1205: .It Ic display-time Ar time
1.78 nicm 1206: Set the amount of time for which status line messages and other on-screen
1207: indicators are displayed.
1.21 nicm 1208: .Ar time
1209: is in milliseconds.
1.1 nicm 1210: .It Ic history-limit Ar lines
1211: Set the maximum number of lines held in window history.
1212: This setting applies only to new windows - existing window histories are not
1213: resized and retain the limit at the point they were created.
1214: .It Ic lock-after-time Ar number
1215: Lock the server after
1216: .Ar number
1217: seconds of inactivity.
1218: The default is off (set to 0).
1219: This has no effect as a session option; it must be set as a global option using
1220: .Fl g .
1.81 nicm 1221: When passwords are entered incorrectly,
1222: .Nm
1223: follows the behaviour of
1224: .Xr login 1
1225: and ignores further password attempts for an increasing timeout.
1.1 nicm 1226: .It Ic message-attr Ar attributes
1227: Set status line message attributes, where
1228: .Ar attributes
1229: is either
1230: .Ic default
1231: or a comma-delimited list of one or more of:
1232: .Ic bright
1233: (or
1234: .Ic bold ) ,
1235: .Ic dim ,
1236: .Ic underscore ,
1237: .Ic blink ,
1238: .Ic reverse ,
1239: .Ic hidden ,
1240: or
1241: .Ic italics .
1242: .It Ic message-bg Ar colour
1243: Set status line message background colour, where
1244: .Ar colour
1245: is one of:
1246: .Ic black ,
1247: .Ic red ,
1248: .Ic green ,
1249: .Ic yellow ,
1250: .Ic blue ,
1251: .Ic magenta ,
1252: .Ic cyan ,
1253: .Ic white
1254: or
1255: .Ic default .
1256: .It Ic message-fg Ar colour
1257: Set status line message foreground colour.
1258: .It Ic prefix Ar key
1259: Set the current prefix key.
1.21 nicm 1260: .It Ic repeat-time Ar time
1.1 nicm 1261: Allow multiple commands to be entered without pressing the prefix-key again
1262: in the specified
1.21 nicm 1263: .Ar time
1.1 nicm 1264: milliseconds (the default is 500).
1265: Whether a key repeats may be set when it is bound using the
1266: .Fl r
1267: flag to
1268: .Ic bind-key .
1.52 nicm 1269: Repeat is enabled for the default keys bound to the
1270: .Ic resize-pane
1271: command.
1.1 nicm 1272: .It Xo Ic set-remain-on-exit
1.56 jmc 1273: .Op Ic on | off
1.1 nicm 1274: .Xc
1275: Set the
1276: .Ic remain-on-exit
1277: window option for any windows first created in this session.
1278: .It Xo Ic set-titles
1.56 jmc 1279: .Op Ic on | off
1.1 nicm 1280: .Xc
1.77 stsp 1281: Attempt to set the window title using the \ee]2;...\e007 xterm code if
1.1 nicm 1282: the terminal appears to be an xterm.
1.11 nicm 1283: This option is off by default.
1.6 jmc 1284: Note that elinks
1.1 nicm 1285: will only attempt to set the window title if the STY environment
1286: variable is set.
1287: .It Xo Ic status
1.56 jmc 1288: .Op Ic on | off
1.1 nicm 1289: .Xc
1290: Show or hide the status line.
1291: .It Ic status-attr Ar attributes
1292: Set status line attributes.
1293: .It Ic status-bg Ar colour
1294: Set status line background colour.
1295: .It Ic status-fg Ar colour
1296: Set status line foreground colour.
1297: .It Ic status-interval Ar interval
1298: Update the status bar every
1299: .Ar interval
1300: seconds.
1301: By default, updates will occur every 15 seconds.
1302: A setting of zero disables redrawing at interval.
1.41 nicm 1303: .It Xo Ic status-justify
1.56 jmc 1304: .Op Ic left | centre | right
1.41 nicm 1305: .Xc
1306: Set the position of the window list component of the status line: left, centre
1307: or right justified.
1.1 nicm 1308: .It Xo Ic status-keys
1.56 jmc 1309: .Op Ic vi | emacs
1.1 nicm 1310: .Xc
1.6 jmc 1311: Use vi or emacs-style
1.1 nicm 1312: key bindings in the status line, for example at the command prompt.
1313: Defaults to emacs.
1314: .It Ic status-left Ar string
1315: Display
1316: .Ar string
1317: to the left of the status bar.
1318: .Ar string
1319: will be passed through
1320: .Xr strftime 3
1321: before being used.
1322: By default, the session name is shown.
1323: .Ar string
1.83 nicm 1324: may contain any of the following special character sequences:
1.1 nicm 1325: .Bl -column "Character pair" "Replaced with" -offset indent
1326: .It Sy "Character pair" Ta Sy "Replaced with"
1327: .It Li "#(command)" Ta "First line of command's output"
1.83 nicm 1328: .It Li "#[attributes]" Ta "Colour or attribute change"
1.1 nicm 1329: .It Li "#H" Ta "Hostname of local host"
1.35 nicm 1330: .It Li "#I" Ta "Current window index"
1331: .It Li "#P" Ta "Current pane index"
1.1 nicm 1332: .It Li "#S" Ta "Session name"
1333: .It Li "#T" Ta "Current window title"
1.35 nicm 1334: .It Li "#W" Ta "Current window name"
1.1 nicm 1335: .It Li "##" Ta "A literal" Ql #
1336: .El
1.83 nicm 1337: .Pp
1338: The #(command) form executes
1339: .Ql command
1340: as a shell command and inserts the first line of its output.
1341: #[attributes] allows a comma-separated list of attributes to be specified,
1342: these may be
1343: .Ql fg=colour
1344: to set the foreground colour,
1345: .Ql bg=colour
1346: to set the background colour, or one of the attributes described under the
1347: .Ic message-attr
1348: option.
1349: Examples are:
1350: .Bd -literal -offset indent
1351: #(sysctl vm.loadavg)
1352: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
1353: .Ed
1.1 nicm 1354: .Pp
1355: Where appropriate, these may be prefixed with a number to specify the maximum
1356: length, for example
1357: .Ql #24T .
1.10 nicm 1358: .Pp
1.12 jmc 1359: By default, UTF-8 in
1.10 nicm 1360: .Ar string
1361: is not interpreted, to enable UTF-8, use the
1362: .Ic status-utf8
1363: option.
1.62 nicm 1364: .It Ic status-left-attr Ar attributes
1.66 jmc 1365: Set the attribute of the left part of the status line.
1.62 nicm 1366: .It Ic status-left-fg Ar colour
1367: Set the foreground colour of the left part of the status line.
1368: .It Ic status-left-bg Ar colour
1369: Set the background colour of the left part of the status line.
1.1 nicm 1370: .It Ic status-left-length Ar length
1371: Set the maximum
1372: .Ar length
1373: of the left component of the status bar.
1374: The default is 10.
1375: .It Ic status-right Ar string
1376: Display
1377: .Ar string
1378: to the right of the status bar.
1379: By default, the date and time will be shown.
1380: As with
1381: .Ic status-left ,
1382: .Ar string
1383: will be passed to
1.10 nicm 1384: .Xr strftime 3 ,
1385: character pairs are replaced, and UTF-8 is dependent on the
1386: .Ic status-utf8
1387: option.
1.62 nicm 1388: .It Ic status-right-attr Ar attributes
1.66 jmc 1389: Set the attribute of the right part of the status line.
1.62 nicm 1390: .It Ic status-right-fg Ar colour
1391: Set the foreground colour of the right part of the status line.
1392: .It Ic status-right-bg Ar colour
1393: Set the background colour of the right part of the status line.
1.1 nicm 1394: .It Ic status-right-length Ar length
1395: Set the maximum
1396: .Ar length
1397: of the right component of the status bar.
1398: The default is 40.
1.10 nicm 1399: .Pp
1400: .It Xo Ic status-utf8
1.56 jmc 1401: .Op Ic on | off
1.10 nicm 1402: .Xc
1403: Instruct
1404: .Nm
1405: to treat top-bit-set characters in the
1406: .Ic status-left
1407: and
1408: .Ic status-right
1409: strings as UTF-8; notably, this is important for wide characters.
1410: This option defaults to off.
1.55 jmc 1411: .It Ic terminal-overrides Ar string
1.54 nicm 1412: Contains a list of entries which override terminal descriptions read using
1413: .Xr terminfo 5 .
1414: .Ar string
1415: is a comma-separated list of items each a colon-separated string made up of a
1416: terminal type pattern (matched using
1417: .Xr fnmatch 3 )
1418: and a set of
1419: .Em name=value
1420: entries.
1421: .Pp
1422: For example, to set the
1423: .Ql clear
1424: .Xr terminfo 5
1425: entry to
1426: .Ql \ee[H\ee[2J
1427: for all terminal types and the
1428: .Ql dch1
1429: entry to
1430: .Ql \ee[P
1.55 jmc 1431: for the
1.54 nicm 1432: .Ql rxvt
1433: terminal type, the option could be set to the string:
1434: .Bd -literal -offset indent
1435: "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
1436: .Ed
1437: .Pp
1438: The terminal entry value is passed through
1439: .Xr strunvis 3
1440: before interpretation.
1441: The default value forcibly corrects the
1442: .Ql colors
1443: entry for terminals which support 88 or 256 colours:
1444: .Bd -literal -offset indent
1445: "*88col*:colors=88,*256col*:colors=256"
1446: .Ed
1.63 nicm 1447: .It Ic update-environment Ar variables
1448: Set a space-separated string containing a list of environment variables to be
1449: copied into the session environment when a new session is created or an
1450: existing session is attached.
1451: Any variables that do not exist in the source environment are set to be
1452: removed from the session environment (as if
1453: .Fl r
1454: was given to the
1455: .Ic set-environment
1456: command).
1457: The default is
1.75 nicm 1458: "DISPLAY WINDOWID SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION".
1.37 nicm 1459: .It Xo Ic visual-activity
1.56 jmc 1460: .Op Ic on | off
1.37 nicm 1461: .Xc
1462: If on, display a status line message when activity occurs in a window
1.39 jmc 1463: for which the
1.37 nicm 1464: .Ic monitor-activity
1465: window option is enabled.
1466: .It Xo Ic visual-bell
1.56 jmc 1467: .Op Ic on | off
1.37 nicm 1468: .Xc
1469: If this option is on, a message is shown on a bell instead of it being passed
1470: through to the terminal (which normally makes a sound).
1471: Also see the
1472: .Ic bell-action
1473: option.
1474: .It Xo Ic visual-content
1.56 jmc 1475: .Op Ic on | off
1.37 nicm 1476: .Xc
1477: Like
1478: .Ic visual-activity ,
1479: display a message when content is present in a window
1.39 jmc 1480: for which the
1.37 nicm 1481: .Ic monitor-content
1482: window option is enabled.
1.1 nicm 1483: .El
1484: .It Xo Ic set-window-option
1.58 nicm 1485: .Op Fl agu
1.1 nicm 1486: .Op Fl t Ar target-window
1487: .Ar option Ar value
1488: .Xc
1489: .D1 (alias: Ic setw )
1.18 nicm 1490: Set a window option.
1.1 nicm 1491: The
1.58 nicm 1492: .Fl a ,
1.1 nicm 1493: .Fl g
1494: and
1495: .Fl u
1496: flags work similarly to the
1497: .Ic set-option
1498: command.
1499: .Pp
1.18 nicm 1500: Supported window options are:
1.56 jmc 1501: .Pp
1502: .Bl -tag -width Ds -compact
1.1 nicm 1503: .It Xo Ic aggressive-resize
1.56 jmc 1504: .Op Ic on | off
1.1 nicm 1505: .Xc
1506: Aggressively resize the chosen window.
1507: This means that
1508: .Nm
1509: will resize the window to the size of the smallest session for which it is the
1510: current window, rather than the smallest session to which it is attached.
1511: The window may resize when the current window is changed on another sessions;
1.6 jmc 1512: this option is good for full-screen programs which support
1513: .Dv SIGWINCH
1514: and poor for interactive programs such as shells.
1.56 jmc 1515: .Pp
1.1 nicm 1516: .It Xo Ic automatic-rename
1.56 jmc 1517: .Op Ic on | off
1.1 nicm 1518: .Xc
1519: Control automatic window renaming.
1520: When this setting is enabled,
1521: .Nm
1522: will attempt - on supported platforms - to rename the window to reflect the
1523: command currently running in it.
1524: This flag is automatically disabled for an individual window when a name
1525: is specified at creation with
1526: .Ic new-window or
1527: .Ic new-session ,
1528: or later with
1529: .Ic rename-window .
1530: It may be switched off globally with:
1531: .Bd -literal -offset indent
1532: set-window-option -g automatic-rename off
1533: .Ed
1.56 jmc 1534: .Pp
1.1 nicm 1535: .It Ic clock-mode-colour Ar colour
1536: Set clock colour.
1.56 jmc 1537: .Pp
1.1 nicm 1538: .It Xo Ic clock-mode-style
1.56 jmc 1539: .Op Ic 12 | 24
1.1 nicm 1540: .Xc
1541: Set clock hour format.
1.56 jmc 1542: .Pp
1.1 nicm 1543: .It Ic force-height Ar height
1544: .It Ic force-width Ar width
1545: Prevent
1546: .Nm
1547: from resizing a window to greater than
1548: .Ar width
1549: or
1550: .Ar height .
1551: A value of zero restores the default unlimited setting.
1.56 jmc 1552: .Pp
1.2 nicm 1553: .It Ic main-pane-width Ar width
1554: .It Ic main-pane-height Ar height
1555: Set the width or height of the main (left or top) pane in the
1556: .Ic main-horizontal
1557: or
1558: .Ic main-vertical
1559: layouts.
1.56 jmc 1560: .Pp
1.1 nicm 1561: .It Ic mode-attr Ar attributes
1562: Set window modes attributes.
1.56 jmc 1563: .Pp
1.1 nicm 1564: .It Ic mode-bg Ar colour
1565: Set window modes background colour.
1.56 jmc 1566: .Pp
1.1 nicm 1567: .It Ic mode-fg Ar colour
1568: Set window modes foreground colour.
1.56 jmc 1569: .Pp
1.1 nicm 1570: .It Xo Ic mode-keys
1.56 jmc 1571: .Op Ic vi | emacs
1.1 nicm 1572: .Xc
1.50 nicm 1573: Use vi or emacs-style key bindings in scroll, copy and choice modes.
1.1 nicm 1574: Key bindings default to emacs.
1.56 jmc 1575: .Pp
1.50 nicm 1576: .It Xo Ic mode-mouse
1.56 jmc 1577: .Op Ic on | off
1.50 nicm 1578: .Xc
1.51 jmc 1579: Mouse state in modes.
1580: If on,
1.50 nicm 1581: .Nm
1582: will respond to mouse clicks by moving the cursor in copy mode or selecting an
1583: option in choice mode.
1.56 jmc 1584: .Pp
1.1 nicm 1585: .It Xo Ic monitor-activity
1.56 jmc 1586: .Op Ic on | off
1.1 nicm 1587: .Xc
1588: Monitor for activity in the window.
1589: Windows with activity are highlighted in the status line.
1.56 jmc 1590: .Pp
1591: .It Ic monitor-content Ar match-string
1.6 jmc 1592: Monitor content in the window.
1593: When
1.16 nicm 1594: .Xr fnmatch 3
1595: pattern
1.1 nicm 1596: .Ar match-string
1597: appears in the window, it is highlighted in the status line.
1.56 jmc 1598: .Pp
1.1 nicm 1599: .It Xo Ic remain-on-exit
1.56 jmc 1600: .Op Ic on | off
1.1 nicm 1601: .Xc
1602: A window with this flag set is not destroyed when the program running in it
1603: exits.
1604: The window may be reactivated with the
1605: .Ic respawn-window
1606: command.
1.56 jmc 1607: .Pp
1.1 nicm 1608: .It Xo Ic utf8
1.56 jmc 1609: .Op Ic on | off
1.1 nicm 1610: .Xc
1611: Instructs
1612: .Nm
1613: to expect UTF-8 sequences to appear in this window.
1.56 jmc 1614: .Pp
1.1 nicm 1615: .It Ic window-status-attr Ar attributes
1616: Set status line attributes for a single window.
1.56 jmc 1617: .Pp
1.1 nicm 1618: .It Ic window-status-bg Ar colour
1619: Set status line background colour for a single window.
1.56 jmc 1620: .Pp
1.1 nicm 1621: .It Ic window-status-fg Ar colour
1622: Set status line foreground colour for a single window.
1.56 jmc 1623: .Pp
1.40 nicm 1624: .It Ic window-status-current-attr Ar attributes
1625: Set status line attributes for the currently active window.
1.56 jmc 1626: .Pp
1.40 nicm 1627: .It Ic window-status-current-bg Ar colour
1628: Set status line background colour for the currently active window.
1.56 jmc 1629: .Pp
1.40 nicm 1630: .It Ic window-status-current-fg Ar colour
1631: Set status line foreground colour for the currently active window.
1.56 jmc 1632: .Pp
1.1 nicm 1633: .It Xo Ic xterm-keys
1.56 jmc 1634: .Op Ic on | off
1.1 nicm 1635: .Xc
1636: If this option is set,
1637: .Nm
1638: will generate
1.57 jmc 1639: .Xr xterm 1 -style
1640: function key sequences; these have a number included to indicate modifiers such
1641: as Shift, Alt or Ctrl.
1642: .El
1643: .It Xo Ic show-options
1644: .Op Fl g
1645: .Op Fl t Ar target-session
1646: .Xc
1647: .D1 (alias: Ic show )
1648: Show the session options for
1649: .Ar target session ,
1650: or the global session options with
1651: .Fl g .
1652: .It Xo Ic show-window-options
1653: .Op Fl g
1654: .Op Fl t Ar target-window
1655: .Xc
1656: .D1 (alias: Ic showw )
1657: List the window options for
1658: .Ar target-window ,
1659: or the global window options if
1660: .Fl g
1661: is used.
1.63 nicm 1662: .El
1663: .Sh ENVIRONMENT
1664: When the server is started,
1665: .Nm
1666: copies the environment into the
1667: .Em global environment ;
1668: in addition, each session has a
1669: .Em session environment .
1670: When a window is created, the session and global environments are merged with
1671: the session environment overriding any variable present in both.
1672: This is the initial environment passed to the new process.
1673: .Pp
1674: The
1675: .Ic update-environment
1676: session option may be used to update the session environment from the client
1677: when a new session is created or an old reattached.
1678: .Nm
1679: also initialises the
1680: .Ev TMUX
1681: variable with some internal information to allow commands to be executed
1682: from inside, and the
1683: .Ev TERM
1684: variable with the correct terminal setting of
1685: .Ql screen .
1686: .Pp
1687: Commands to alter and view the environment are:
1688: .Bl -tag -width Ds
1689: .It Xo Ic set-environment
1690: .Op Fl gru
1691: .Op Fl t Ar target-session
1692: .Ar name Op Ar value
1693: .Xc
1694: Set or unset an environment variable.
1695: If
1696: .Fl g
1697: is used, the change is made in the global environment; otherwise, it is applied
1698: to the session environment for
1699: .Ar target-session .
1700: The
1701: .Fl u
1702: flag unsets a variable.
1703: .Fl r
1704: indicates the variable is to be removed from the environment before starting a
1705: new process.
1706: .It Xo Ic show-environment
1707: .Op Fl g
1708: .Op Fl t Ar target-session
1709: .Xc
1710: Display the environment for
1711: .Ar target-session
1712: or the global environment with
1713: .Fl g .
1714: Variables removed from the environment are prefixed with
1715: .Ql - .
1.57 jmc 1716: .El
1717: .Sh STATUS LINE
1718: .Nm
1719: includes an optional status line which is displayed in the bottom line of each
1720: terminal.
1721: By default, the status line is enabled (it may be disabled with the
1722: .Ic status
1723: session option) and contains, from left-to-right: the name of the current
1724: session in square brackets; the window list; the current window title in double
1725: quotes; and the time and date.
1726: .Pp
1727: The status line is made of three parts: configurable left and right sections
1728: (which may contain dynamic content such as the time or output from a shell
1729: command, see the
1730: .Ic status-left ,
1731: .Ic status-left-length ,
1732: .Ic status-right ,
1733: and
1734: .Ic status-right-length
1735: options below), and a central window list.
1736: The window list shows the index, name and (if any) flag of the windows
1737: present in the current session in ascending numerical order.
1738: The flag is one of the following symbols appended to the window name:
1739: .Bl -column "Symbol" "Meaning" -offset indent
1740: .It Sy "Symbol" Ta Sy "Meaning"
1741: .It Li "*" Ta "Denotes the current window."
1742: .It Li "-" Ta "Marks the last window (previously selected)."
1743: .It Li "#" Ta "Window is monitored and activity has been detected."
1744: .It Li "!" Ta "A bell has occurred in the window."
1745: .It Li "+" Ta "Window is monitored for content and it has appeared."
1746: .El
1747: .Pp
1748: The # symbol relates to the
1749: .Ic monitor-activity
1750: and + to the
1751: .Ic monitor-content
1752: window options.
1753: The window name is printed in inverted colours if an alert (bell, activity or
1754: content) is present.
1755: .Pp
1756: The colour and attributes of the status line may be configured, the entire status line using
1757: the
1758: .Ic status-attr ,
1759: .Ic status-fg
1760: and
1761: .Ic status-bg
1762: session options and individual windows using the
1763: .Ic window-status-attr ,
1764: .Ic window-status-fg
1765: and
1766: .Ic window-status-bg
1767: window options.
1768: .Pp
1769: The status line is automatically refreshed at interval if it has changed, the interval may be
1770: controlled with the
1771: .Ic status-interval
1772: session option.
1773: .Pp
1774: Commands related to the status line are as follows:
1775: .Bl -tag -width Ds
1776: .It Xo Ic command-prompt
1.73 nicm 1777: .Op Fl p Ar prompts
1.57 jmc 1778: .Op Fl t Ar target-client
1779: .Op Ar template
1780: .Xc
1781: Open the command prompt in a client.
1782: This may be used from inside
1783: .Nm
1784: to execute commands interactively.
1785: If
1786: .Ar template
1.73 nicm 1787: is specified, it is used as the command.
1788: If
1789: .Fl p
1790: is given,
1791: .Ar prompts
1792: is a comma-separated list of prompts which are displayed in order; otherwise
1793: a single prompt is displayed, constructed from
1794: .Ar template
1795: if it is present, or
1796: .Ql \&:
1797: if not.
1798: Before the command is executed, the first occurrence of the string
1799: .Ql %%
1.74 jmc 1800: and all occurrences of
1.73 nicm 1801: .Ql %1
1802: are replaced by the response to the first prompt, the second
1803: .Ql %%
1804: and all
1805: .Ql %2
1806: are replaced with the response to the second prompt, and so on for further
1.74 jmc 1807: prompts.
1808: Up to nine prompt responses may be replaced
1809: .Po
1810: .Ql %1
1.73 nicm 1811: to
1.74 jmc 1812: .Ql %9
1813: .Pc .
1.57 jmc 1814: .It Xo Ic confirm-before
1815: .Op Fl t Ar target-client
1816: .Ar command
1817: .Xc
1818: .D1 (alias: Ic confirm )
1819: Ask for confirmation before executing
1820: .Ar command .
1821: This command works only from inside
1822: .Nm .
1823: .It Xo Ic display-message
1824: .Op Fl t Ar target-client
1825: .Op Ar message
1826: .Xc
1827: .D1 (alias: Ic display )
1828: Display a message (see the
1829: .Ic status-left
1830: option below)
1831: in the status line.
1832: .It Ic select-prompt Op Fl t Ar target-client
1833: Open a prompt inside
1834: .Ar target-client
1835: allowing a window index to be entered interactively.
1836: .El
1837: .Sh BUFFERS
1838: .Nm
1839: maintains a stack of
1840: .Em paste buffers
1841: for each session.
1842: Up to the value of the
1843: .Ic buffer-limit
1844: option are kept; when a new buffer is added, the buffer at the bottom of the
1845: stack is removed.
1846: Buffers may be added using
1847: .Ic copy-mode
1848: or the
1849: .Ic set-buffer
1850: command, and pasted into a window using the
1851: .Ic paste-buffer
1852: command.
1853: .Pp
1854: A configurable history buffer is also maintained for each window.
1855: By default, up to 2000 lines are kept; this can be altered with the
1856: .Ic history-limit
1857: option (see the
1858: .Ic set-option
1859: command above).
1860: .Pp
1861: The buffer commands are as follows:
1862: .Bl -tag -width Ds
1863: .It Ic clear-history Op Fl t Ar target-pane
1864: .D1 (alias: Ic clearhist )
1865: Remove and free the history for the specified pane.
1866: .It Xo Ic copy-buffer
1867: .Op Fl a Ar src-index
1868: .Op Fl b Ar dst-index
1869: .Op Fl s Ar src-session
1870: .Op Fl t Ar dst-session
1871: .Xc
1872: .D1 (alias: Ic copyb )
1873: Copy a session paste buffer to another session.
1874: If no sessions are specified, the current one is used instead.
1875: .It Xo Ic delete-buffer
1876: .Op Fl b Ar buffer-index
1877: .Op Fl t Ar target-session
1878: .Xc
1879: .D1 (alias: Ic deleteb )
1880: Delete the buffer at
1881: .Ar buffer-index ,
1882: or the top buffer if not specified.
1883: .It Ic list-buffers Op Fl t Ar target-session
1884: .D1 (alias: Ic lsb )
1885: List the buffers in the given session.
1886: .It Xo Ic load-buffer
1887: .Op Fl b Ar buffer-index
1888: .Op Fl t Ar target-session
1889: .Ar path
1890: .Xc
1891: .D1 (alias: Ic loadb )
1892: Load the contents of the specified paste buffer from
1893: .Ar path .
1894: .It Xo Ic paste-buffer
1895: .Op Fl dr
1896: .Op Fl b Ar buffer-index
1897: .Op Fl t Ar target-window
1898: .Xc
1899: .D1 (alias: Ic pasteb )
1900: Insert the contents of a paste buffer into the current window.
1901: With
1902: .Fl d ,
1903: also delete the paste buffer from the stack.
1904: When output, any linefeed (LF) characters in the paste buffer are replaced with
1905: carriage returns (CR).
1906: This translation may be disabled with the
1907: .Fl r
1908: flag.
1909: .It Xo Ic save-buffer
1910: .Op Fl a
1911: .Op Fl b Ar buffer-index
1912: .Op Fl t Ar target-session
1913: .Ar path
1914: .Xc
1915: .D1 (alias: Ic saveb )
1916: Save the contents of the specified paste buffer to
1917: .Ar path .
1918: The
1919: .Fl a
1920: option appends to rather than overwriting the file.
1921: .It Xo Ic set-buffer
1922: .Op Fl b Ar buffer-index
1923: .Op Fl t Ar target-session
1924: .Ar data
1925: .Xc
1926: .D1 (alias: Ic setb )
1927: Set the contents of the specified buffer to
1928: .Ar data .
1.1 nicm 1929: .It Xo Ic show-buffer
1930: .Op Fl b Ar buffer-index
1931: .Op Fl t Ar target-session
1932: .Xc
1933: .D1 (alias: Ic showb )
1934: Display the contents of the specified buffer.
1.57 jmc 1935: .El
1936: .Sh MISCELLANEOUS
1937: .Pp
1938: Miscellaneous commands are as follows:
1939: .Bl -tag -width Ds
1.72 nicm 1940: .It Ic clock-mode Op Fl t Ar target-pane
1.57 jmc 1941: Display a large clock.
1942: .It Ic if-shell Ar shell-command command
1943: .D1 (alias: Ic if )
1944: Execute
1945: .Ar command
1946: if
1947: .Ar shell-command
1948: returns success.
1949: .It Ic lock-server
1950: .D1 (alias: Ic lock )
1951: Lock the server until a password is entered.
1952: .It Ic server-info
1953: .D1 (alias: Ic info )
1954: Show server information and terminal details.
1955: .It Xo Ic set-password
1956: .Op Fl c
1957: .Ar password
1.1 nicm 1958: .Xc
1.57 jmc 1959: .D1 (alias: Ic pass )
1960: Set the server password.
1961: If the
1.49 nicm 1962: .Fl c
1.57 jmc 1963: option is given, a pre-encrypted password may be specified.
1964: By default, the password is blank, thus any entered password will be accepted
1965: when unlocking the server (see the
1966: .Ic lock-server
1967: command).
1968: To prevent variable expansion when an encrypted password is read from a
1969: configuration file, enclose it in single quotes (').
1.1 nicm 1970: .El
1971: .Sh FILES
1.26 nicm 1972: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1 nicm 1973: .It Pa ~/.tmux.conf
1.6 jmc 1974: Default
1.1 nicm 1975: .Nm
1.6 jmc 1976: configuration file.
1.26 nicm 1977: .It Pa /etc/tmux.conf
1978: System-wide configuration file.
1.1 nicm 1979: .El
1.57 jmc 1980: .Sh EXAMPLES
1981: To create a new
1982: .Nm
1983: session running
1984: .Xr vi 1 :
1985: .Pp
1986: .Dl $ tmux new-session vi
1987: .Pp
1988: Most commands have a shorter form, known as an alias.
1989: For new-session, this is
1990: .Ic new :
1991: .Pp
1992: .Dl $ tmux new vi
1993: .Pp
1994: Alternatively, the shortest unambiguous form of a command is accepted.
1995: If there are several options, they are listed:
1996: .Bd -literal -offset indent
1997: $ tmux n
1998: ambiguous command: n, could be: new-session, new-window, next-window
1999: .Ed
2000: .Pp
2001: Within an active session, a new window may be created by typing
2002: .Ql C-b c
2003: (Ctrl
2004: followed by the
2005: .Ql b
2006: key
2007: followed by the
2008: .Ql c
2009: key).
2010: .Pp
2011: Windows may be navigated with:
2012: .Ql C-b 0
2013: (to select window 0),
2014: .Ql C-b 1
2015: (to select window 1), and so on;
2016: .Ql C-b n
2017: to select the next window; and
2018: .Ql C-b p
2019: to select the previous window.
2020: .Pp
2021: A session may be detached using
2022: .Ql C-b d
1.64 nicm 2023: (or by an external event such as
2024: .Xr ssh 1
2025: disconnection) and reattached with:
1.57 jmc 2026: .Pp
2027: .Dl $ tmux attach-session
2028: .Pp
2029: Typing
2030: .Ql C-b \&?
2031: lists the current key bindings in the current window; up and down may be used
2032: to navigate the list or
2033: .Ql q
2034: to exit from it.
2035: .Pp
2036: Commands to be run when the
2037: .Nm
2038: server is started may be placed in the
2039: .Pa ~/.tmux.conf
2040: configuration file.
2041: Common examples include:
2042: .Pp
2043: Changing the default prefix key:
2044: .Bd -literal -offset indent
2045: set-option -g prefix C-a
2046: unbind-key C-b
2047: bind-key C-a send-prefix
2048: .Ed
2049: .Pp
2050: Turning the status line off, or changing its colour:
2051: .Bd -literal -offset indent
2052: set-option -g status off
2053: set-option -g status-bg blue
2054: .Ed
2055: .Pp
2056: Setting other options, such as the default command,
2057: or locking after 30 minutes of inactivity:
2058: .Bd -literal -offset indent
2059: set-option -g default-command "exec /bin/ksh"
2060: set-option -g lock-after-time 1800
2061: .Ed
2062: .Pp
2063: Creating new key bindings:
2064: .Bd -literal -offset indent
2065: bind-key b set-option status
2066: bind-key / command-prompt "split-window 'exec man %%'"
1.73 nicm 2067: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57 jmc 2068: .Ed
1.1 nicm 2069: .Sh SEE ALSO
2070: .Xr pty 4
2071: .Sh AUTHORS
2072: .An Nicholas Marriott Aq nicm@users.sourceforge.net