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