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