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