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