Annotation of src/usr.bin/tmux/tmux.1, Revision 1.82
1.82 ! nicm 1: .\" $OpenBSD: tmux.1,v 1.81 2009/09/02 16:38:35 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
1319: may contain any of the following special character pairs:
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"
1323: .It Li "#H" Ta "Hostname of local host"
1.35 nicm 1324: .It Li "#I" Ta "Current window index"
1325: .It Li "#P" Ta "Current pane index"
1.1 nicm 1326: .It Li "#S" Ta "Session name"
1327: .It Li "#T" Ta "Current window title"
1.35 nicm 1328: .It Li "#W" Ta "Current window name"
1.1 nicm 1329: .It Li "##" Ta "A literal" Ql #
1330: .El
1331: .Pp
1332: Where appropriate, these may be prefixed with a number to specify the maximum
1333: length, for example
1334: .Ql #24T .
1.10 nicm 1335: .Pp
1.12 jmc 1336: By default, UTF-8 in
1.10 nicm 1337: .Ar string
1338: is not interpreted, to enable UTF-8, use the
1339: .Ic status-utf8
1340: option.
1.62 nicm 1341: .It Ic status-left-attr Ar attributes
1.66 jmc 1342: Set the attribute of the left part of the status line.
1.62 nicm 1343: .It Ic status-left-fg Ar colour
1344: Set the foreground colour of the left part of the status line.
1345: .It Ic status-left-bg Ar colour
1346: Set the background colour of the left part of the status line.
1.1 nicm 1347: .It Ic status-left-length Ar length
1348: Set the maximum
1349: .Ar length
1350: of the left component of the status bar.
1351: The default is 10.
1352: .It Ic status-right Ar string
1353: Display
1354: .Ar string
1355: to the right of the status bar.
1356: By default, the date and time will be shown.
1357: As with
1358: .Ic status-left ,
1359: .Ar string
1360: will be passed to
1.10 nicm 1361: .Xr strftime 3 ,
1362: character pairs are replaced, and UTF-8 is dependent on the
1363: .Ic status-utf8
1364: option.
1.62 nicm 1365: .It Ic status-right-attr Ar attributes
1.66 jmc 1366: Set the attribute of the right part of the status line.
1.62 nicm 1367: .It Ic status-right-fg Ar colour
1368: Set the foreground colour of the right part of the status line.
1369: .It Ic status-right-bg Ar colour
1370: Set the background colour of the right part of the status line.
1.1 nicm 1371: .It Ic status-right-length Ar length
1372: Set the maximum
1373: .Ar length
1374: of the right component of the status bar.
1375: The default is 40.
1.10 nicm 1376: .Pp
1377: .It Xo Ic status-utf8
1.56 jmc 1378: .Op Ic on | off
1.10 nicm 1379: .Xc
1380: Instruct
1381: .Nm
1382: to treat top-bit-set characters in the
1383: .Ic status-left
1384: and
1385: .Ic status-right
1386: strings as UTF-8; notably, this is important for wide characters.
1387: This option defaults to off.
1.55 jmc 1388: .It Ic terminal-overrides Ar string
1.54 nicm 1389: Contains a list of entries which override terminal descriptions read using
1390: .Xr terminfo 5 .
1391: .Ar string
1392: is a comma-separated list of items each a colon-separated string made up of a
1393: terminal type pattern (matched using
1394: .Xr fnmatch 3 )
1395: and a set of
1396: .Em name=value
1397: entries.
1398: .Pp
1399: For example, to set the
1400: .Ql clear
1401: .Xr terminfo 5
1402: entry to
1403: .Ql \ee[H\ee[2J
1404: for all terminal types and the
1405: .Ql dch1
1406: entry to
1407: .Ql \ee[P
1.55 jmc 1408: for the
1.54 nicm 1409: .Ql rxvt
1410: terminal type, the option could be set to the string:
1411: .Bd -literal -offset indent
1412: "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
1413: .Ed
1414: .Pp
1415: The terminal entry value is passed through
1416: .Xr strunvis 3
1417: before interpretation.
1418: The default value forcibly corrects the
1419: .Ql colors
1420: entry for terminals which support 88 or 256 colours:
1421: .Bd -literal -offset indent
1422: "*88col*:colors=88,*256col*:colors=256"
1423: .Ed
1.63 nicm 1424: .It Ic update-environment Ar variables
1425: Set a space-separated string containing a list of environment variables to be
1426: copied into the session environment when a new session is created or an
1427: existing session is attached.
1428: Any variables that do not exist in the source environment are set to be
1429: removed from the session environment (as if
1430: .Fl r
1431: was given to the
1432: .Ic set-environment
1433: command).
1434: The default is
1.75 nicm 1435: "DISPLAY WINDOWID SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION".
1.37 nicm 1436: .It Xo Ic visual-activity
1.56 jmc 1437: .Op Ic on | off
1.37 nicm 1438: .Xc
1439: If on, display a status line message when activity occurs in a window
1.39 jmc 1440: for which the
1.37 nicm 1441: .Ic monitor-activity
1442: window option is enabled.
1443: .It Xo Ic visual-bell
1.56 jmc 1444: .Op Ic on | off
1.37 nicm 1445: .Xc
1446: If this option is on, a message is shown on a bell instead of it being passed
1447: through to the terminal (which normally makes a sound).
1448: Also see the
1449: .Ic bell-action
1450: option.
1451: .It Xo Ic visual-content
1.56 jmc 1452: .Op Ic on | off
1.37 nicm 1453: .Xc
1454: Like
1455: .Ic visual-activity ,
1456: display a message when content is present in a window
1.39 jmc 1457: for which the
1.37 nicm 1458: .Ic monitor-content
1459: window option is enabled.
1.1 nicm 1460: .El
1461: .It Xo Ic set-window-option
1.58 nicm 1462: .Op Fl agu
1.1 nicm 1463: .Op Fl t Ar target-window
1464: .Ar option Ar value
1465: .Xc
1466: .D1 (alias: Ic setw )
1.18 nicm 1467: Set a window option.
1.1 nicm 1468: The
1.58 nicm 1469: .Fl a ,
1.1 nicm 1470: .Fl g
1471: and
1472: .Fl u
1473: flags work similarly to the
1474: .Ic set-option
1475: command.
1476: .Pp
1.18 nicm 1477: Supported window options are:
1.56 jmc 1478: .Pp
1479: .Bl -tag -width Ds -compact
1.1 nicm 1480: .It Xo Ic aggressive-resize
1.56 jmc 1481: .Op Ic on | off
1.1 nicm 1482: .Xc
1483: Aggressively resize the chosen window.
1484: This means that
1485: .Nm
1486: will resize the window to the size of the smallest session for which it is the
1487: current window, rather than the smallest session to which it is attached.
1488: The window may resize when the current window is changed on another sessions;
1.6 jmc 1489: this option is good for full-screen programs which support
1490: .Dv SIGWINCH
1491: and poor for interactive programs such as shells.
1.56 jmc 1492: .Pp
1.1 nicm 1493: .It Xo Ic automatic-rename
1.56 jmc 1494: .Op Ic on | off
1.1 nicm 1495: .Xc
1496: Control automatic window renaming.
1497: When this setting is enabled,
1498: .Nm
1499: will attempt - on supported platforms - to rename the window to reflect the
1500: command currently running in it.
1501: This flag is automatically disabled for an individual window when a name
1502: is specified at creation with
1503: .Ic new-window or
1504: .Ic new-session ,
1505: or later with
1506: .Ic rename-window .
1507: It may be switched off globally with:
1508: .Bd -literal -offset indent
1509: set-window-option -g automatic-rename off
1510: .Ed
1.56 jmc 1511: .Pp
1.1 nicm 1512: .It Ic clock-mode-colour Ar colour
1513: Set clock colour.
1.56 jmc 1514: .Pp
1.1 nicm 1515: .It Xo Ic clock-mode-style
1.56 jmc 1516: .Op Ic 12 | 24
1.1 nicm 1517: .Xc
1518: Set clock hour format.
1.56 jmc 1519: .Pp
1.1 nicm 1520: .It Ic force-height Ar height
1521: .It Ic force-width Ar width
1522: Prevent
1523: .Nm
1524: from resizing a window to greater than
1525: .Ar width
1526: or
1527: .Ar height .
1528: A value of zero restores the default unlimited setting.
1.56 jmc 1529: .Pp
1.2 nicm 1530: .It Ic main-pane-width Ar width
1531: .It Ic main-pane-height Ar height
1532: Set the width or height of the main (left or top) pane in the
1533: .Ic main-horizontal
1534: or
1535: .Ic main-vertical
1536: layouts.
1.56 jmc 1537: .Pp
1.1 nicm 1538: .It Ic mode-attr Ar attributes
1539: Set window modes attributes.
1.56 jmc 1540: .Pp
1.1 nicm 1541: .It Ic mode-bg Ar colour
1542: Set window modes background colour.
1.56 jmc 1543: .Pp
1.1 nicm 1544: .It Ic mode-fg Ar colour
1545: Set window modes foreground colour.
1.56 jmc 1546: .Pp
1.1 nicm 1547: .It Xo Ic mode-keys
1.56 jmc 1548: .Op Ic vi | emacs
1.1 nicm 1549: .Xc
1.50 nicm 1550: Use vi or emacs-style key bindings in scroll, copy and choice modes.
1.1 nicm 1551: Key bindings default to emacs.
1.56 jmc 1552: .Pp
1.50 nicm 1553: .It Xo Ic mode-mouse
1.56 jmc 1554: .Op Ic on | off
1.50 nicm 1555: .Xc
1.51 jmc 1556: Mouse state in modes.
1557: If on,
1.50 nicm 1558: .Nm
1559: will respond to mouse clicks by moving the cursor in copy mode or selecting an
1560: option in choice mode.
1.56 jmc 1561: .Pp
1.1 nicm 1562: .It Xo Ic monitor-activity
1.56 jmc 1563: .Op Ic on | off
1.1 nicm 1564: .Xc
1565: Monitor for activity in the window.
1566: Windows with activity are highlighted in the status line.
1.56 jmc 1567: .Pp
1568: .It Ic monitor-content Ar match-string
1.6 jmc 1569: Monitor content in the window.
1570: When
1.16 nicm 1571: .Xr fnmatch 3
1572: pattern
1.1 nicm 1573: .Ar match-string
1574: appears in the window, it is highlighted in the status line.
1.56 jmc 1575: .Pp
1.1 nicm 1576: .It Xo Ic remain-on-exit
1.56 jmc 1577: .Op Ic on | off
1.1 nicm 1578: .Xc
1579: A window with this flag set is not destroyed when the program running in it
1580: exits.
1581: The window may be reactivated with the
1582: .Ic respawn-window
1583: command.
1.56 jmc 1584: .Pp
1.1 nicm 1585: .It Xo Ic utf8
1.56 jmc 1586: .Op Ic on | off
1.1 nicm 1587: .Xc
1588: Instructs
1589: .Nm
1590: to expect UTF-8 sequences to appear in this window.
1.56 jmc 1591: .Pp
1.1 nicm 1592: .It Ic window-status-attr Ar attributes
1593: Set status line attributes for a single window.
1.56 jmc 1594: .Pp
1.1 nicm 1595: .It Ic window-status-bg Ar colour
1596: Set status line background colour for a single window.
1.56 jmc 1597: .Pp
1.1 nicm 1598: .It Ic window-status-fg Ar colour
1599: Set status line foreground colour for a single window.
1.56 jmc 1600: .Pp
1.40 nicm 1601: .It Ic window-status-current-attr Ar attributes
1602: Set status line attributes for the currently active window.
1.56 jmc 1603: .Pp
1.40 nicm 1604: .It Ic window-status-current-bg Ar colour
1605: Set status line background colour for the currently active window.
1.56 jmc 1606: .Pp
1.40 nicm 1607: .It Ic window-status-current-fg Ar colour
1608: Set status line foreground colour for the currently active window.
1.56 jmc 1609: .Pp
1.1 nicm 1610: .It Xo Ic xterm-keys
1.56 jmc 1611: .Op Ic on | off
1.1 nicm 1612: .Xc
1613: If this option is set,
1614: .Nm
1615: will generate
1.57 jmc 1616: .Xr xterm 1 -style
1617: function key sequences; these have a number included to indicate modifiers such
1618: as Shift, Alt or Ctrl.
1619: .El
1620: .It Xo Ic show-options
1621: .Op Fl g
1622: .Op Fl t Ar target-session
1623: .Xc
1624: .D1 (alias: Ic show )
1625: Show the session options for
1626: .Ar target session ,
1627: or the global session options with
1628: .Fl g .
1629: .It Xo Ic show-window-options
1630: .Op Fl g
1631: .Op Fl t Ar target-window
1632: .Xc
1633: .D1 (alias: Ic showw )
1634: List the window options for
1635: .Ar target-window ,
1636: or the global window options if
1637: .Fl g
1638: is used.
1.63 nicm 1639: .El
1640: .Sh ENVIRONMENT
1641: When the server is started,
1642: .Nm
1643: copies the environment into the
1644: .Em global environment ;
1645: in addition, each session has a
1646: .Em session environment .
1647: When a window is created, the session and global environments are merged with
1648: the session environment overriding any variable present in both.
1649: This is the initial environment passed to the new process.
1650: .Pp
1651: The
1652: .Ic update-environment
1653: session option may be used to update the session environment from the client
1654: when a new session is created or an old reattached.
1655: .Nm
1656: also initialises the
1657: .Ev TMUX
1658: variable with some internal information to allow commands to be executed
1659: from inside, and the
1660: .Ev TERM
1661: variable with the correct terminal setting of
1662: .Ql screen .
1663: .Pp
1664: Commands to alter and view the environment are:
1665: .Bl -tag -width Ds
1666: .It Xo Ic set-environment
1667: .Op Fl gru
1668: .Op Fl t Ar target-session
1669: .Ar name Op Ar value
1670: .Xc
1671: Set or unset an environment variable.
1672: If
1673: .Fl g
1674: is used, the change is made in the global environment; otherwise, it is applied
1675: to the session environment for
1676: .Ar target-session .
1677: The
1678: .Fl u
1679: flag unsets a variable.
1680: .Fl r
1681: indicates the variable is to be removed from the environment before starting a
1682: new process.
1683: .It Xo Ic show-environment
1684: .Op Fl g
1685: .Op Fl t Ar target-session
1686: .Xc
1687: Display the environment for
1688: .Ar target-session
1689: or the global environment with
1690: .Fl g .
1691: Variables removed from the environment are prefixed with
1692: .Ql - .
1.57 jmc 1693: .El
1694: .Sh STATUS LINE
1695: .Nm
1696: includes an optional status line which is displayed in the bottom line of each
1697: terminal.
1698: By default, the status line is enabled (it may be disabled with the
1699: .Ic status
1700: session option) and contains, from left-to-right: the name of the current
1701: session in square brackets; the window list; the current window title in double
1702: quotes; and the time and date.
1703: .Pp
1704: The status line is made of three parts: configurable left and right sections
1705: (which may contain dynamic content such as the time or output from a shell
1706: command, see the
1707: .Ic status-left ,
1708: .Ic status-left-length ,
1709: .Ic status-right ,
1710: and
1711: .Ic status-right-length
1712: options below), and a central window list.
1713: The window list shows the index, name and (if any) flag of the windows
1714: present in the current session in ascending numerical order.
1715: The flag is one of the following symbols appended to the window name:
1716: .Bl -column "Symbol" "Meaning" -offset indent
1717: .It Sy "Symbol" Ta Sy "Meaning"
1718: .It Li "*" Ta "Denotes the current window."
1719: .It Li "-" Ta "Marks the last window (previously selected)."
1720: .It Li "#" Ta "Window is monitored and activity has been detected."
1721: .It Li "!" Ta "A bell has occurred in the window."
1722: .It Li "+" Ta "Window is monitored for content and it has appeared."
1723: .El
1724: .Pp
1725: The # symbol relates to the
1726: .Ic monitor-activity
1727: and + to the
1728: .Ic monitor-content
1729: window options.
1730: The window name is printed in inverted colours if an alert (bell, activity or
1731: content) is present.
1732: .Pp
1733: The colour and attributes of the status line may be configured, the entire status line using
1734: the
1735: .Ic status-attr ,
1736: .Ic status-fg
1737: and
1738: .Ic status-bg
1739: session options and individual windows using the
1740: .Ic window-status-attr ,
1741: .Ic window-status-fg
1742: and
1743: .Ic window-status-bg
1744: window options.
1745: .Pp
1746: The status line is automatically refreshed at interval if it has changed, the interval may be
1747: controlled with the
1748: .Ic status-interval
1749: session option.
1750: .Pp
1751: Commands related to the status line are as follows:
1752: .Bl -tag -width Ds
1753: .It Xo Ic command-prompt
1.73 nicm 1754: .Op Fl p Ar prompts
1.57 jmc 1755: .Op Fl t Ar target-client
1756: .Op Ar template
1757: .Xc
1758: Open the command prompt in a client.
1759: This may be used from inside
1760: .Nm
1761: to execute commands interactively.
1762: If
1763: .Ar template
1.73 nicm 1764: is specified, it is used as the command.
1765: If
1766: .Fl p
1767: is given,
1768: .Ar prompts
1769: is a comma-separated list of prompts which are displayed in order; otherwise
1770: a single prompt is displayed, constructed from
1771: .Ar template
1772: if it is present, or
1773: .Ql \&:
1774: if not.
1775: Before the command is executed, the first occurrence of the string
1776: .Ql %%
1.74 jmc 1777: and all occurrences of
1.73 nicm 1778: .Ql %1
1779: are replaced by the response to the first prompt, the second
1780: .Ql %%
1781: and all
1782: .Ql %2
1783: are replaced with the response to the second prompt, and so on for further
1.74 jmc 1784: prompts.
1785: Up to nine prompt responses may be replaced
1786: .Po
1787: .Ql %1
1.73 nicm 1788: to
1.74 jmc 1789: .Ql %9
1790: .Pc .
1.57 jmc 1791: .It Xo Ic confirm-before
1792: .Op Fl t Ar target-client
1793: .Ar command
1794: .Xc
1795: .D1 (alias: Ic confirm )
1796: Ask for confirmation before executing
1797: .Ar command .
1798: This command works only from inside
1799: .Nm .
1800: .It Xo Ic display-message
1801: .Op Fl t Ar target-client
1802: .Op Ar message
1803: .Xc
1804: .D1 (alias: Ic display )
1805: Display a message (see the
1806: .Ic status-left
1807: option below)
1808: in the status line.
1809: .It Ic select-prompt Op Fl t Ar target-client
1810: Open a prompt inside
1811: .Ar target-client
1812: allowing a window index to be entered interactively.
1813: .El
1814: .Sh BUFFERS
1815: .Nm
1816: maintains a stack of
1817: .Em paste buffers
1818: for each session.
1819: Up to the value of the
1820: .Ic buffer-limit
1821: option are kept; when a new buffer is added, the buffer at the bottom of the
1822: stack is removed.
1823: Buffers may be added using
1824: .Ic copy-mode
1825: or the
1826: .Ic set-buffer
1827: command, and pasted into a window using the
1828: .Ic paste-buffer
1829: command.
1830: .Pp
1831: A configurable history buffer is also maintained for each window.
1832: By default, up to 2000 lines are kept; this can be altered with the
1833: .Ic history-limit
1834: option (see the
1835: .Ic set-option
1836: command above).
1837: .Pp
1838: The buffer commands are as follows:
1839: .Bl -tag -width Ds
1840: .It Ic clear-history Op Fl t Ar target-pane
1841: .D1 (alias: Ic clearhist )
1842: Remove and free the history for the specified pane.
1843: .It Xo Ic copy-buffer
1844: .Op Fl a Ar src-index
1845: .Op Fl b Ar dst-index
1846: .Op Fl s Ar src-session
1847: .Op Fl t Ar dst-session
1848: .Xc
1849: .D1 (alias: Ic copyb )
1850: Copy a session paste buffer to another session.
1851: If no sessions are specified, the current one is used instead.
1852: .It Xo Ic delete-buffer
1853: .Op Fl b Ar buffer-index
1854: .Op Fl t Ar target-session
1855: .Xc
1856: .D1 (alias: Ic deleteb )
1857: Delete the buffer at
1858: .Ar buffer-index ,
1859: or the top buffer if not specified.
1860: .It Ic list-buffers Op Fl t Ar target-session
1861: .D1 (alias: Ic lsb )
1862: List the buffers in the given session.
1863: .It Xo Ic load-buffer
1864: .Op Fl b Ar buffer-index
1865: .Op Fl t Ar target-session
1866: .Ar path
1867: .Xc
1868: .D1 (alias: Ic loadb )
1869: Load the contents of the specified paste buffer from
1870: .Ar path .
1871: .It Xo Ic paste-buffer
1872: .Op Fl dr
1873: .Op Fl b Ar buffer-index
1874: .Op Fl t Ar target-window
1875: .Xc
1876: .D1 (alias: Ic pasteb )
1877: Insert the contents of a paste buffer into the current window.
1878: With
1879: .Fl d ,
1880: also delete the paste buffer from the stack.
1881: When output, any linefeed (LF) characters in the paste buffer are replaced with
1882: carriage returns (CR).
1883: This translation may be disabled with the
1884: .Fl r
1885: flag.
1886: .It Xo Ic save-buffer
1887: .Op Fl a
1888: .Op Fl b Ar buffer-index
1889: .Op Fl t Ar target-session
1890: .Ar path
1891: .Xc
1892: .D1 (alias: Ic saveb )
1893: Save the contents of the specified paste buffer to
1894: .Ar path .
1895: The
1896: .Fl a
1897: option appends to rather than overwriting the file.
1898: .It Xo Ic set-buffer
1899: .Op Fl b Ar buffer-index
1900: .Op Fl t Ar target-session
1901: .Ar data
1902: .Xc
1903: .D1 (alias: Ic setb )
1904: Set the contents of the specified buffer to
1905: .Ar data .
1.1 nicm 1906: .It Xo Ic show-buffer
1907: .Op Fl b Ar buffer-index
1908: .Op Fl t Ar target-session
1909: .Xc
1910: .D1 (alias: Ic showb )
1911: Display the contents of the specified buffer.
1.57 jmc 1912: .El
1913: .Sh MISCELLANEOUS
1914: .Pp
1915: Miscellaneous commands are as follows:
1916: .Bl -tag -width Ds
1.72 nicm 1917: .It Ic clock-mode Op Fl t Ar target-pane
1.57 jmc 1918: Display a large clock.
1919: .It Ic if-shell Ar shell-command command
1920: .D1 (alias: Ic if )
1921: Execute
1922: .Ar command
1923: if
1924: .Ar shell-command
1925: returns success.
1926: .It Ic lock-server
1927: .D1 (alias: Ic lock )
1928: Lock the server until a password is entered.
1929: .It Ic server-info
1930: .D1 (alias: Ic info )
1931: Show server information and terminal details.
1932: .It Xo Ic set-password
1933: .Op Fl c
1934: .Ar password
1.1 nicm 1935: .Xc
1.57 jmc 1936: .D1 (alias: Ic pass )
1937: Set the server password.
1938: If the
1.49 nicm 1939: .Fl c
1.57 jmc 1940: option is given, a pre-encrypted password may be specified.
1941: By default, the password is blank, thus any entered password will be accepted
1942: when unlocking the server (see the
1943: .Ic lock-server
1944: command).
1945: To prevent variable expansion when an encrypted password is read from a
1946: configuration file, enclose it in single quotes (').
1.1 nicm 1947: .El
1948: .Sh FILES
1.26 nicm 1949: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1 nicm 1950: .It Pa ~/.tmux.conf
1.6 jmc 1951: Default
1.1 nicm 1952: .Nm
1.6 jmc 1953: configuration file.
1.26 nicm 1954: .It Pa /etc/tmux.conf
1955: System-wide configuration file.
1.1 nicm 1956: .El
1.57 jmc 1957: .Sh EXAMPLES
1958: To create a new
1959: .Nm
1960: session running
1961: .Xr vi 1 :
1962: .Pp
1963: .Dl $ tmux new-session vi
1964: .Pp
1965: Most commands have a shorter form, known as an alias.
1966: For new-session, this is
1967: .Ic new :
1968: .Pp
1969: .Dl $ tmux new vi
1970: .Pp
1971: Alternatively, the shortest unambiguous form of a command is accepted.
1972: If there are several options, they are listed:
1973: .Bd -literal -offset indent
1974: $ tmux n
1975: ambiguous command: n, could be: new-session, new-window, next-window
1976: .Ed
1977: .Pp
1978: Within an active session, a new window may be created by typing
1979: .Ql C-b c
1980: (Ctrl
1981: followed by the
1982: .Ql b
1983: key
1984: followed by the
1985: .Ql c
1986: key).
1987: .Pp
1988: Windows may be navigated with:
1989: .Ql C-b 0
1990: (to select window 0),
1991: .Ql C-b 1
1992: (to select window 1), and so on;
1993: .Ql C-b n
1994: to select the next window; and
1995: .Ql C-b p
1996: to select the previous window.
1997: .Pp
1998: A session may be detached using
1999: .Ql C-b d
1.64 nicm 2000: (or by an external event such as
2001: .Xr ssh 1
2002: disconnection) and reattached with:
1.57 jmc 2003: .Pp
2004: .Dl $ tmux attach-session
2005: .Pp
2006: Typing
2007: .Ql C-b \&?
2008: lists the current key bindings in the current window; up and down may be used
2009: to navigate the list or
2010: .Ql q
2011: to exit from it.
2012: .Pp
2013: Commands to be run when the
2014: .Nm
2015: server is started may be placed in the
2016: .Pa ~/.tmux.conf
2017: configuration file.
2018: Common examples include:
2019: .Pp
2020: Changing the default prefix key:
2021: .Bd -literal -offset indent
2022: set-option -g prefix C-a
2023: unbind-key C-b
2024: bind-key C-a send-prefix
2025: .Ed
2026: .Pp
2027: Turning the status line off, or changing its colour:
2028: .Bd -literal -offset indent
2029: set-option -g status off
2030: set-option -g status-bg blue
2031: .Ed
2032: .Pp
2033: Setting other options, such as the default command,
2034: or locking after 30 minutes of inactivity:
2035: .Bd -literal -offset indent
2036: set-option -g default-command "exec /bin/ksh"
2037: set-option -g lock-after-time 1800
2038: .Ed
2039: .Pp
2040: Creating new key bindings:
2041: .Bd -literal -offset indent
2042: bind-key b set-option status
2043: bind-key / command-prompt "split-window 'exec man %%'"
1.73 nicm 2044: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57 jmc 2045: .Ed
1.1 nicm 2046: .Sh SEE ALSO
2047: .Xr pty 4
2048: .Sh AUTHORS
2049: .An Nicholas Marriott Aq nicm@users.sourceforge.net