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