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