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