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