Annotation of src/usr.bin/tmux/tmux.1, Revision 1.369
1.369 ! nicm 1: .\" $OpenBSD: tmux.1,v 1.368 2013/10/10 11:56:50 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.367 nicm 17: .Dd $Mdocdate: October 10 2013 $
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.345 nicm 26: .Op Fl 28lCquv
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.
1.345 nicm 101: .It Fl C
1.369 ! nicm 102: Start in control mode (see the
! 103: .Sx CONTROL MODE
! 104: section).
1.345 nicm 105: Given twice
106: .Xo ( Fl CC ) Xc
107: disables echo.
1.91 nicm 108: .It Fl c Ar shell-command
109: Execute
110: .Ar shell-command
111: using the default shell.
112: If necessary, the
113: .Nm
114: server will be started to retrieve the
115: .Ic default-shell
116: option.
1.153 nicm 117: This option is for compatibility with
118: .Xr sh 1
119: when
120: .Nm
121: is used as a login shell.
1.1 nicm 122: .It Fl f Ar file
123: Specify an alternative configuration file.
124: By default,
125: .Nm
1.26 nicm 126: loads the system configuration file from
127: .Pa /etc/tmux.conf ,
128: if present, then looks for a user configuration file at
1.1 nicm 129: .Pa ~/.tmux.conf .
1.306 nicm 130: .Pp
1.1 nicm 131: The configuration file is a set of
132: .Nm
133: commands which are executed in sequence when the server is first started.
1.306 nicm 134: .Nm
135: loads configuration files once when the server process has started.
136: The
137: .Ic source-file
138: command may be used to load a file later.
1.61 nicm 139: .Pp
140: .Nm
1.306 nicm 141: shows any error messages from commands in configuration files in the first
142: session created, and continues to process the rest of the configuration file.
1.1 nicm 143: .It Fl L Ar socket-name
144: .Nm
145: stores the server socket in a directory under
1.355 nicm 146: .Ev TMUX_TMPDIR ,
147: .Ev TMPDIR
148: if it is unset, or
1.208 nicm 149: .Pa /tmp
1.355 nicm 150: if both are unset.
151: The default socket is named
1.1 nicm 152: .Em default .
153: This option allows a different socket name to be specified, allowing several
154: independent
155: .Nm
156: servers to be run.
157: Unlike
158: .Fl S
159: a full path is not necessary: the sockets are all created in the same
160: directory.
1.2 nicm 161: .Pp
162: If the socket is accidentally removed, the
1.6 jmc 163: .Dv SIGUSR1
1.2 nicm 164: signal may be sent to the
165: .Nm
166: server process to recreate it.
1.166 sobrado 167: .It Fl l
168: Behave as a login shell.
169: This flag currently has no effect and is for compatibility with other shells
170: when using tmux as a login shell.
1.4 sobrado 171: .It Fl q
1.133 nicm 172: Set the
173: .Ic quiet
174: server option to prevent the server sending various informational messages.
1.1 nicm 175: .It Fl S Ar socket-path
176: Specify a full alternative path to the server socket.
177: If
178: .Fl S
179: is specified, the default socket directory is not used and any
180: .Fl L
181: flag is ignored.
182: .It Fl u
183: .Nm
1.14 nicm 184: attempts to guess if the terminal is likely to support UTF-8 by checking the
185: first of the
186: .Ev LC_ALL ,
187: .Ev LC_CTYPE
188: and
1.2 nicm 189: .Ev LANG
1.14 nicm 190: environment variables to be set for the string "UTF-8".
1.5 nicm 191: This is not always correct: the
1.2 nicm 192: .Fl u
193: flag explicitly informs
194: .Nm
1.6 jmc 195: that UTF-8 is supported.
1.33 nicm 196: .Pp
197: If the server is started from a client passed
198: .Fl u
199: or where UTF-8 is detected, the
200: .Ic utf8
201: and
202: .Ic status-utf8
203: options are enabled in the global window and session options respectively.
1.1 nicm 204: .It Fl v
205: Request verbose logging.
206: This option may be specified multiple times for increasing verbosity.
207: Log messages will be saved into
208: .Pa tmux-client-PID.log
209: and
210: .Pa tmux-server-PID.log
211: files in the current directory, where
212: .Em PID
1.6 jmc 213: is the PID of the server or client process.
1.1 nicm 214: .It Ar command Op Ar flags
215: This specifies one of a set of commands used to control
216: .Nm ,
1.6 jmc 217: as described in the following sections.
1.59 jmc 218: If no commands are specified, the
1.1 nicm 219: .Ic new-session
220: command is assumed.
1.57 jmc 221: .El
1.64 nicm 222: .Sh KEY BINDINGS
223: .Nm
224: may be controlled from an attached client by using a key combination of a
225: prefix key,
226: .Ql C-b
227: (Ctrl-b) by default, followed by a command key.
228: .Pp
1.172 nicm 229: The default command key bindings are:
1.64 nicm 230: .Pp
1.171 nicm 231: .Bl -tag -width "XXXXXXXXXX" -offset indent -compact
232: .It C-b
233: Send the prefix key (C-b) through to the application.
234: .It C-o
235: Rotate the panes in the current window forwards.
236: .It C-z
237: Suspend the
238: .Nm
239: client.
240: .It !
241: Break the current pane out of the window.
242: .It \&"
243: Split the current pane into two, top and bottom.
244: .It #
245: List all paste buffers.
1.236 nicm 246: .It $
247: Rename the current session.
1.171 nicm 248: .It %
249: Split the current pane into two, left and right.
250: .It &
251: Kill the current window.
252: .It '
253: Prompt for a window index to select.
254: .It ,
255: Rename the current window.
256: .It -
257: Delete the most recently copied buffer of text.
258: .It .
259: Prompt for an index to move the current window.
260: .It 0 to 9
261: Select windows 0 to 9.
262: .It :
263: Enter the
264: .Nm
265: command prompt.
1.187 nicm 266: .It ;
267: Move to the previously active pane.
1.178 nicm 268: .It =
269: Choose which buffer to paste interactively from a list.
1.171 nicm 270: .It \&?
271: List all key bindings.
272: .It D
273: Choose a client to detach.
1.182 jmc 274: .It \&[
1.171 nicm 275: Enter copy mode to copy text or view the history.
1.182 jmc 276: .It \&]
1.171 nicm 277: Paste the most recently copied buffer of text.
1.64 nicm 278: .It c
1.65 nicm 279: Create a new window.
1.64 nicm 280: .It d
1.65 nicm 281: Detach the current client.
1.171 nicm 282: .It f
283: Prompt to search for text in open windows.
284: .It i
285: Display some information about the current window.
1.64 nicm 286: .It l
1.65 nicm 287: Move to the previously selected window.
1.64 nicm 288: .It n
1.65 nicm 289: Change to the next window.
1.171 nicm 290: .It o
291: Select the next pane in the current window.
1.64 nicm 292: .It p
1.65 nicm 293: Change to the previous window.
1.171 nicm 294: .It q
295: Briefly display pane indexes.
296: .It r
297: Force redraw of the attached client.
298: .It s
299: Select a new session for the attached client interactively.
1.194 nicm 300: .It L
301: Switch the attached client back to the last session.
1.171 nicm 302: .It t
303: Show the time.
304: .It w
305: Choose the current window interactively.
306: .It x
307: Kill the current pane.
308: .It {
309: Swap the current pane with the previous pane.
310: .It }
311: Swap the current pane with the next pane.
312: .It ~
313: Show previous messages from
314: .Nm ,
315: if any.
316: .It Page Up
317: Enter copy mode and scroll one page up.
318: .It Up, Down
319: .It Left, Right
320: Change to the pane above, below, to the left, or to the right of the current
321: pane.
322: .It M-1 to M-5
323: Arrange panes in one of the five preset layouts: even-horizontal,
324: even-vertical, main-horizontal, main-vertical, or tiled.
325: .It M-n
326: Move to the next window with a bell or activity marker.
327: .It M-o
328: Rotate the panes in the current window backwards.
329: .It M-p
330: Move to the previous window with a bell or activity marker.
331: .It C-Up, C-Down
332: .It C-Left, C-Right
333: Resize the current pane in steps of one cell.
334: .It M-Up, M-Down
335: .It M-Left, M-Right
336: Resize the current pane in steps of five cells.
1.64 nicm 337: .El
338: .Pp
339: Key bindings may be changed with the
340: .Ic bind-key
341: and
342: .Ic unbind-key
343: commands.
1.57 jmc 344: .Sh COMMANDS
345: This section contains a list of the commands supported by
346: .Nm .
347: Most commands accept the optional
348: .Fl t
349: argument with one of
350: .Ar target-client ,
351: .Ar target-session
352: .Ar target-window ,
353: or
354: .Ar target-pane .
355: These specify the client, session, window or pane which a command should affect.
356: .Ar target-client
357: is the name of the
358: .Xr pty 4
359: file to which the client is connected, for example either of
360: .Pa /dev/ttyp1
361: or
362: .Pa ttyp1
363: for the client attached to
364: .Pa /dev/ttyp1 .
365: If no client is specified, the current client is chosen, if possible, or an
366: error is reported.
367: Clients may be listed with the
368: .Ic list-clients
369: command.
1.1 nicm 370: .Pp
1.57 jmc 371: .Ar target-session
1.344 nicm 372: is the session id prefixed with a $, the name of a session (as listed by the
1.57 jmc 373: .Ic list-sessions
1.344 nicm 374: command), or the name of a client with the same syntax as
1.57 jmc 375: .Ar target-client ,
376: in which case the session attached to the client is used.
377: When looking for the session name,
378: .Nm
379: initially searches for an exact match; if none is found, the session names
380: are checked for any for which
381: .Ar target-session
382: is a prefix or for which it matches as an
383: .Xr fnmatch 3
384: pattern.
385: If a single match is found, it is used as the target session; multiple matches
386: produce an error.
387: If a session is omitted, the current session is used if available; if no
1.117 nicm 388: current session is available, the most recently used is chosen.
1.1 nicm 389: .Pp
1.57 jmc 390: .Ar target-window
391: specifies a window in the form
392: .Em session Ns \&: Ns Em window .
393: .Em session
394: follows the same rules as for
395: .Ar target-session ,
396: and
397: .Em window
1.270 nicm 398: is looked for in order: as a window index, for example mysession:1;
1.271 jmc 399: as a window ID, such as @1;
1.270 nicm 400: as an exact window name, such as mysession:mywindow; then as an
1.57 jmc 401: .Xr fnmatch 3
402: pattern or the start of a window name, such as mysession:mywin* or
403: mysession:mywin.
404: An empty window name specifies the next unused index if appropriate (for
405: example the
406: .Ic new-window
407: and
408: .Ic link-window
409: commands)
410: otherwise the current window in
411: .Em session
412: is chosen.
1.140 nicm 413: The special character
414: .Ql \&!
1.311 nicm 415: uses the last (previously current) window,
416: .Ql ^
417: selects the highest numbered window,
418: .Ql $
419: selects the lowest numbered window, and
1.140 nicm 420: .Ql +
421: and
422: .Ql -
1.311 nicm 423: select the next window or the previous window by number.
1.57 jmc 424: When the argument does not contain a colon,
425: .Nm
426: first attempts to parse it as window; if that fails, an attempt is made to
427: match a session.
1.1 nicm 428: .Pp
1.57 jmc 429: .Ar target-pane
430: takes a similar form to
431: .Ar target-window
432: but with the optional addition of a period followed by a pane index, for
433: example: mysession:mywindow.1.
434: If the pane index is omitted, the currently active pane in the specified
435: window is used.
436: If neither a colon nor period appears,
1.13 nicm 437: .Nm
1.57 jmc 438: first attempts to use the argument as a pane index; if that fails, it is looked
439: up as for
440: .Ar target-window .
1.156 nicm 441: A
442: .Ql +
443: or
444: .Ql -
445: indicate the next or previous pane index, respectively.
1.132 nicm 446: One of the strings
447: .Em top ,
448: .Em bottom ,
449: .Em left ,
450: .Em right ,
451: .Em top-left ,
452: .Em top-right ,
1.216 nicm 453: .Em bottom-left
454: or
1.132 nicm 455: .Em bottom-right
456: may be used instead of a pane index.
1.177 nicm 457: .Pp
458: The special characters
459: .Ql +
460: and
461: .Ql -
462: may be followed by an offset, for example:
463: .Bd -literal -offset indent
464: select-window -t:+2
465: .Ed
466: .Pp
467: When dealing with a session that doesn't contain sequential window indexes,
468: they will be correctly skipped.
1.212 nicm 469: .Pp
470: .Nm
471: also gives each pane created in a server an identifier consisting of a
472: .Ql %
473: and a number, starting from zero.
474: A pane's identifier is unique for the life of the
475: .Nm
476: server and is passed to the child process of the pane in the
477: .Ev TMUX_PANE
478: environment variable.
479: It may be used alone to target a pane or the window containing it.
1.15 jmc 480: .Pp
1.153 nicm 481: .Ar shell-command
482: arguments are
483: .Xr sh 1
484: commands.
485: These must be passed as a single item, which typically means quoting them, for
486: example:
487: .Bd -literal -offset indent
488: new-window 'vi /etc/passwd'
489: .Ed
490: .Pp
491: .Ar command
492: .Op Ar arguments
493: refers to a
494: .Nm
495: command, passed with the command and arguments separately, for example:
496: .Bd -literal -offset indent
497: bind-key F1 set-window-option force-width 81
498: .Ed
499: .Pp
500: Or if using
501: .Xr sh 1 :
502: .Bd -literal -offset indent
503: $ tmux bind-key F1 set-window-option force-width 81
504: .Ed
505: .Pp
1.57 jmc 506: Multiple commands may be specified together as part of a
507: .Em command sequence .
508: Each command should be separated by spaces and a semicolon;
1.244 nicm 509: commands are executed sequentially from left to right and
1.293 nicm 510: lines ending with a backslash continue on to the next line,
511: except when escaped by another backslash.
1.57 jmc 512: A literal semicolon may be included by escaping it with a backslash (for
513: example, when specifying a command sequence to
514: .Ic bind-key ) .
1.13 nicm 515: .Pp
1.153 nicm 516: Example
517: .Nm
518: commands include:
1.13 nicm 519: .Bd -literal -offset indent
1.57 jmc 520: refresh-client -t/dev/ttyp2
521:
522: rename-session -tfirst newname
523:
524: set-window-option -t:0 monitor-activity on
525:
526: new-window ; split-window -d
1.244 nicm 527:
528: bind-key R source-file ~/.tmux.conf \e; \e
529: display-message "source-file done"
1.13 nicm 530: .Ed
1.153 nicm 531: .Pp
532: Or from
533: .Xr sh 1 :
534: .Bd -literal -offset indent
535: $ tmux kill-window -t :1
536:
1.159 jmc 537: $ tmux new-window \e; split-window -d
1.153 nicm 538:
1.159 jmc 539: $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
1.153 nicm 540: .Ed
1.57 jmc 541: .Sh CLIENTS AND SESSIONS
1.153 nicm 542: The
543: .Nm
544: server manages clients, sessions, windows and panes.
545: Clients are attached to sessions to interact with them, either
546: when they are created with the
547: .Ic new-session
548: command, or later with the
549: .Ic attach-session
550: command.
1.188 nicm 551: Each session has one or more windows
1.153 nicm 552: .Em linked
553: into it.
554: Windows may be linked to multiple sessions and are made up of one or
555: more panes,
556: each of which contains a pseudo terminal.
557: Commands for creating, linking and otherwise manipulating windows
558: are covered
559: in the
560: .Sx WINDOWS AND PANES
561: section.
562: .Pp
563: The following commands are available to manage clients and sessions:
1.57 jmc 564: .Bl -tag -width Ds
565: .It Xo Ic attach-session
1.148 nicm 566: .Op Fl dr
1.57 jmc 567: .Op Fl t Ar target-session
568: .Xc
569: .D1 (alias: Ic attach )
570: If run from outside
571: .Nm ,
572: create a new client in the current terminal and attach it to
573: .Ar target-session .
574: If used from inside, switch the current client.
575: If
576: .Fl d
577: is specified, any other clients attached to the session are detached.
1.148 nicm 578: .Fl r
579: signifies the client is read-only (only keys bound to the
580: .Ic detach-client
1.242 nicm 581: or
582: .Ic switch-client
583: commands have any effect)
1.13 nicm 584: .Pp
1.57 jmc 585: If no server is started,
586: .Ic attach-session
587: will attempt to start it; this will fail unless sessions are created in the
588: configuration file.
1.217 nicm 589: .Pp
590: The
591: .Ar target-session
592: rules for
593: .Ic attach-session
594: are slightly adjusted: if
595: .Nm
596: needs to select the most recently used session, it will prefer the most
597: recently used
598: .Em unattached
599: session.
1.211 nicm 600: .It Xo Ic detach-client
601: .Op Fl P
1.296 nicm 602: .Op Fl a
1.219 nicm 603: .Op Fl s Ar target-session
1.211 nicm 604: .Op Fl t Ar target-client
605: .Xc
1.57 jmc 606: .D1 (alias: Ic detach )
1.218 nicm 607: Detach the current client if bound to a key, the client specified with
608: .Fl t ,
1.258 jmc 609: or all clients currently attached to the session specified by
1.218 nicm 610: .Fl s .
1.296 nicm 611: The
612: .Fl a
613: option kills all but the client given with
614: .Fl t .
1.211 nicm 615: If
616: .Fl P
617: is given, send SIGHUP to the parent process of the client, typically causing it
618: to exit.
1.57 jmc 619: .It Ic has-session Op Fl t Ar target-session
620: .D1 (alias: Ic has )
621: Report an error and exit with 1 if the specified session does not exist.
622: If it does exist, exit with 0.
623: .It Ic kill-server
624: Kill the
1.1 nicm 625: .Nm
1.57 jmc 626: server and clients and destroy all sessions.
1.369 ! nicm 627: .It Xo Ic kill-session
1.297 nicm 628: .Op Fl a
629: .Op Fl t Ar target-session
1.369 ! nicm 630: .Xc
1.57 jmc 631: Destroy the given session, closing any windows linked to it and no other
632: sessions, and detaching all clients attached to it.
1.297 nicm 633: If
634: .Fl a
635: is given, all sessions but the specified one is killed.
1.250 nicm 636: .It Xo Ic list-clients
637: .Op Fl F Ar format
638: .Op Fl t Ar target-session
639: .Xc
1.57 jmc 640: .D1 (alias: Ic lsc )
1.221 jmc 641: List all clients attached to the server.
1.250 nicm 642: For the meaning of the
643: .Fl F
644: flag, see the
1.252 jmc 645: .Sx FORMATS
646: section.
1.221 jmc 647: If
1.220 nicm 648: .Ar target-session
649: is specified, list only clients connected to that session.
1.57 jmc 650: .It Ic list-commands
651: .D1 (alias: Ic lscm )
652: List the syntax of all commands supported by
653: .Nm .
1.247 nicm 654: .It Ic list-sessions Op Fl F Ar format
1.57 jmc 655: .D1 (alias: Ic ls )
656: List all sessions managed by the server.
1.247 nicm 657: For the meaning of the
658: .Fl F
659: flag, see the
660: .Sx FORMATS
661: section.
1.175 nicm 662: .It Ic lock-client Op Fl t Ar target-client
663: .D1 (alias: Ic lockc )
1.92 nicm 664: Lock
665: .Ar target-client ,
666: see the
667: .Ic lock-server
668: command.
1.175 nicm 669: .It Ic lock-session Op Fl t Ar target-session
670: .D1 (alias: Ic locks )
1.92 nicm 671: Lock all clients attached to
672: .Ar target-session .
1.57 jmc 673: .It Xo Ic new-session
1.351 nicm 674: .Op Fl AdDP
675: .Op Fl F Ar format
1.57 jmc 676: .Op Fl n Ar window-name
677: .Op Fl s Ar session-name
1.101 nicm 678: .Op Fl t Ar target-session
1.210 nicm 679: .Op Fl x Ar width
680: .Op Fl y Ar height
1.153 nicm 681: .Op Ar shell-command
1.57 jmc 682: .Xc
683: .D1 (alias: Ic new )
684: Create a new session with name
685: .Ar session-name .
1.153 nicm 686: .Pp
1.57 jmc 687: The new session is attached to the current terminal unless
688: .Fl d
689: is given.
690: .Ar window-name
1.1 nicm 691: and
1.153 nicm 692: .Ar shell-command
693: are the name of and shell command to execute in the initial window.
1.210 nicm 694: If
695: .Fl d
696: is used,
697: .Fl x
698: and
699: .Fl y
700: specify the size of the initial window (80 by 24 if not given).
1.68 nicm 701: .Pp
702: If run from a terminal, any
703: .Xr termios 4
704: special characters are saved and used for new windows in the new session.
1.338 nicm 705: .Pp
706: The
707: .Fl A
708: flag makes
709: .Ic new-session
710: behave like
711: .Ic attach-session
712: if
713: .Ar session-name
714: already exists; in the case,
715: .Fl D
716: behaves like
717: .Fl d
718: to
719: .Ic attach-session .
1.101 nicm 720: .Pp
721: If
722: .Fl t
723: is given, the new session is
724: .Em grouped
725: with
726: .Ar target-session .
727: This means they share the same set of windows - all windows from
728: .Ar target-session
729: are linked to the new session and any subsequent new windows or windows being
730: closed are applied to both sessions.
731: The current and previous window and any session options remain independent and
732: either session may be killed without affecting the other.
733: Giving
734: .Fl n
735: or
1.153 nicm 736: .Ar shell-command
1.101 nicm 737: are invalid if
738: .Fl t
739: is used.
1.351 nicm 740: .Pp
741: The
742: .Fl P
743: option prints information about the new session after it has been created.
744: By default, it uses the format
745: .Ql #{session_name}:
746: but a different format may be specified with
747: .Fl F .
1.248 nicm 748: .It Xo Ic refresh-client
749: .Op Fl S
750: .Op Fl t Ar target-client
751: .Xc
1.57 jmc 752: .D1 (alias: Ic refresh )
753: Refresh the current client if bound to a key, or a single client if one is given
754: with
755: .Fl t .
1.248 nicm 756: If
757: .Fl S
758: is specified, only update the client's status bar.
1.57 jmc 759: .It Xo Ic rename-session
760: .Op Fl t Ar target-session
761: .Ar new-name
762: .Xc
763: .D1 (alias: Ic rename )
764: Rename the session to
765: .Ar new-name .
1.121 nicm 766: .It Xo Ic show-messages
1.120 nicm 767: .Op Fl t Ar target-client
768: .Xc
769: .D1 (alias: Ic showmsgs )
770: Any messages displayed on the status line are saved in a per-client message
771: log, up to a maximum of the limit set by the
772: .Ar message-limit
773: session option for the session attached to that client.
774: This command displays the log for
775: .Ar target-client .
1.57 jmc 776: .It Ic source-file Ar path
777: .D1 (alias: Ic source )
778: Execute commands from
779: .Ar path .
780: .It Ic start-server
781: .D1 (alias: Ic start )
782: Start the
1.1 nicm 783: .Nm
1.57 jmc 784: server, if not already running, without creating any sessions.
785: .It Xo Ic suspend-client
1.202 nicm 786: .Op Fl t Ar target-client
1.57 jmc 787: .Xc
788: .D1 (alias: Ic suspendc )
789: Suspend a client by sending
790: .Dv SIGTSTP
791: (tty stop).
792: .It Xo Ic switch-client
1.242 nicm 793: .Op Fl lnpr
1.57 jmc 794: .Op Fl c Ar target-client
795: .Op Fl t Ar target-session
796: .Xc
797: .D1 (alias: Ic switchc )
798: Switch the current session for client
799: .Ar target-client
800: to
801: .Ar target-session .
1.183 nicm 802: If
1.197 jmc 803: .Fl l ,
1.183 nicm 804: .Fl n
805: or
806: .Fl p
1.194 nicm 807: is used, the client is moved to the last, next or previous session
808: respectively.
1.242 nicm 809: .Fl r
810: toggles whether a client is read-only (see the
811: .Ic attach-session
812: command).
1.57 jmc 813: .El
814: .Sh WINDOWS AND PANES
1.1 nicm 815: A
816: .Nm
817: window may be in one of several modes.
818: The default permits direct access to the terminal attached to the window.
1.164 nicm 819: The other is copy mode, which permits a section of a window or its
820: history to be copied to a
1.1 nicm 821: .Em paste buffer
822: for later insertion into another window.
823: This mode is entered with the
824: .Ic copy-mode
825: command, bound to
1.113 nicm 826: .Ql \&[
1.1 nicm 827: by default.
1.164 nicm 828: It is also entered when a command that produces output, such as
829: .Ic list-keys ,
830: is executed from a key binding.
1.1 nicm 831: .Pp
1.6 jmc 832: The keys available depend on whether emacs or vi mode is selected
833: (see the
1.1 nicm 834: .Ic mode-keys
835: option).
836: The following keys are supported as appropriate for the mode:
1.157 nicm 837: .Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
1.1 nicm 838: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
1.27 nicm 839: .It Li "Back to indentation" Ta "^" Ta "M-m"
1.142 nicm 840: .It Li "Bottom of history" Ta "G" Ta "M-<"
1.1 nicm 841: .It Li "Clear selection" Ta "Escape" Ta "C-g"
842: .It Li "Copy selection" Ta "Enter" Ta "M-w"
843: .It Li "Cursor down" Ta "j" Ta "Down"
1.70 nicm 844: .It Li "Cursor left" Ta "h" Ta "Left"
845: .It Li "Cursor right" Ta "l" Ta "Right"
1.116 nicm 846: .It Li "Cursor to bottom line" Ta "L" Ta ""
847: .It Li "Cursor to middle line" Ta "M" Ta "M-r"
848: .It Li "Cursor to top line" Ta "H" Ta "M-R"
1.70 nicm 849: .It Li "Cursor up" Ta "k" Ta "Up"
1.71 nicm 850: .It Li "Delete entire line" Ta "d" Ta "C-u"
1.227 nicm 851: .It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
1.1 nicm 852: .It Li "End of line" Ta "$" Ta "C-e"
1.142 nicm 853: .It Li "Go to line" Ta ":" Ta "g"
1.116 nicm 854: .It Li "Half page down" Ta "C-d" Ta "M-Down"
855: .It Li "Half page up" Ta "C-u" Ta "M-Up"
1.157 nicm 856: .It Li "Jump forward" Ta "f" Ta "f"
1.256 nicm 857: .It Li "Jump to forward" Ta "t" Ta ""
1.157 nicm 858: .It Li "Jump backward" Ta "F" Ta "F"
1.256 nicm 859: .It Li "Jump to backward" Ta "T" Ta ""
1.157 nicm 860: .It Li "Jump again" Ta ";" Ta ";"
861: .It Li "Jump again in reverse" Ta "," Ta ","
1.1 nicm 862: .It Li "Next page" Ta "C-f" Ta "Page down"
1.146 nicm 863: .It Li "Next space" Ta "W" Ta ""
864: .It Li "Next space, end of word" Ta "E" Ta ""
1.143 nicm 865: .It Li "Next word" Ta "w" Ta ""
866: .It Li "Next word end" Ta "e" Ta "M-f"
1.70 nicm 867: .It Li "Paste buffer" Ta "p" Ta "C-y"
1.116 nicm 868: .It Li "Previous page" Ta "C-b" Ta "Page up"
1.1 nicm 869: .It Li "Previous word" Ta "b" Ta "M-b"
1.146 nicm 870: .It Li "Previous space" Ta "B" Ta ""
1.1 nicm 871: .It Li "Quit mode" Ta "q" Ta "Escape"
1.147 nicm 872: .It Li "Rectangle toggle" Ta "v" Ta "R"
1.141 nicm 873: .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
874: .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
1.70 nicm 875: .It Li "Search again" Ta "n" Ta "n"
1.152 nicm 876: .It Li "Search again in reverse" Ta "N" Ta "N"
1.70 nicm 877: .It Li "Search backward" Ta "?" Ta "C-r"
878: .It Li "Search forward" Ta "/" Ta "C-s"
879: .It Li "Start of line" Ta "0" Ta "C-a"
1.1 nicm 880: .It Li "Start selection" Ta "Space" Ta "C-Space"
1.142 nicm 881: .It Li "Top of history" Ta "g" Ta "M->"
1.327 nicm 882: .It Li "Transpose characters" Ta "" Ta "C-t"
1.1 nicm 883: .El
1.146 nicm 884: .Pp
885: The next and previous word keys use space and the
886: .Ql - ,
1.154 nicm 887: .Ql _
1.146 nicm 888: and
889: .Ql @
1.154 nicm 890: characters as word delimiters by default, but this can be adjusted by
891: setting the
892: .Em word-separators
1.255 nicm 893: session option.
1.146 nicm 894: Next word moves to the start of the next word, next word end to the end of the
895: next word and previous word to the start of the previous word.
896: The three next and previous space keys work similarly but use a space alone as
897: the word separator.
1.157 nicm 898: .Pp
899: The jump commands enable quick movement within a line.
900: For instance, typing
901: .Ql f
902: followed by
903: .Ql /
904: will move the cursor to the next
905: .Ql /
906: character on the current line.
907: A
908: .Ql \&;
909: will then jump to the next occurrence.
1.1 nicm 910: .Pp
1.155 nicm 911: Commands in copy mode may be prefaced by an optional repeat count.
912: With vi key bindings, a prefix is entered using the number keys; with
913: emacs, the Alt (meta) key and a number begins prefix entry.
914: For example, to move the cursor forward by ten words, use
915: .Ql M-1 0 M-f
916: in emacs mode, and
917: .Ql 10w
918: in vi.
919: .Pp
1.254 nicm 920: When copying the selection, the repeat count indicates the buffer index to
921: replace, if used.
922: .Pp
1.155 nicm 923: Mode key bindings are defined in a set of named tables:
1.48 nicm 924: .Em vi-edit
925: and
926: .Em emacs-edit
927: for keys used when line editing at the command prompt;
928: .Em vi-choice
929: and
930: .Em emacs-choice
931: for keys used when choosing from lists (such as produced by the
1.144 nicm 932: .Ic choose-window
1.164 nicm 933: command); and
1.48 nicm 934: .Em vi-copy
935: and
936: .Em emacs-copy
1.97 nicm 937: used in copy mode.
1.48 nicm 938: The tables may be viewed with the
939: .Ic list-keys
1.49 nicm 940: command and keys modified or removed with
941: .Ic bind-key
942: and
943: .Ic unbind-key .
1.330 nicm 944: One command accepts an argument,
1.327 nicm 945: .Ic copy-pipe ,
946: which copies the selection and pipes it to a command.
947: For example the following will bind
948: .Ql C-q
949: to copy the selection into
950: .Pa /tmp
951: as well as the paste buffer:
952: .Bd -literal -offset indent
953: bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out"
954: .Ed
1.48 nicm 955: .Pp
1.2 nicm 956: The paste buffer key pastes the first line from the top paste buffer on the
957: stack.
1.57 jmc 958: .Pp
1.164 nicm 959: The synopsis for the
960: .Ic copy-mode
961: command is:
1.57 jmc 962: .Bl -tag -width Ds
963: .It Xo Ic copy-mode
964: .Op Fl u
1.72 nicm 965: .Op Fl t Ar target-pane
1.57 jmc 966: .Xc
967: Enter copy mode.
968: The
969: .Fl u
970: option scrolls one page up.
971: .El
1.18 nicm 972: .Pp
1.1 nicm 973: Each window displayed by
974: .Nm
975: may be split into one or more
976: .Em panes ;
977: each pane takes up a certain area of the display and is a separate terminal.
978: A window may be split into panes using the
979: .Ic split-window
980: command.
1.38 nicm 981: Windows may be split horizontally (with the
982: .Fl h
983: flag) or vertically.
984: Panes may be resized with the
985: .Ic resize-pane
1.1 nicm 986: command (bound to
1.38 nicm 987: .Ql C-up ,
988: .Ql C-down
989: .Ql C-left
990: and
991: .Ql C-right
1.1 nicm 992: by default), the current pane may be changed with the
1.156 nicm 993: .Ic select-pane
994: command and the
1.1 nicm 995: .Ic rotate-window
996: and
997: .Ic swap-pane
1.38 nicm 998: commands may be used to swap panes without changing their position.
999: Panes are numbered beginning from zero in the order they are created.
1000: .Pp
1001: A number of preset
1002: .Em layouts
1003: are available.
1004: These may be selected with the
1005: .Ic select-layout
1006: command or cycled with
1007: .Ic next-layout
1008: (bound to
1.149 nicm 1009: .Ql Space
1.131 nicm 1010: by default); once a layout is chosen, panes within it may be moved and resized
1011: as normal.
1.1 nicm 1012: .Pp
1013: The following layouts are supported:
1014: .Bl -tag -width Ds
1015: .It Ic even-horizontal
1016: Panes are spread out evenly from left to right across the window.
1017: .It Ic even-vertical
1018: Panes are spread evenly from top to bottom.
1.2 nicm 1019: .It Ic main-horizontal
1.131 nicm 1020: A large (main) pane is shown at the top of the window and the remaining panes
1021: are spread from left to right in the leftover space at the bottom.
1.2 nicm 1022: Use the
1023: .Em main-pane-height
1024: window option to specify the height of the top pane.
1.1 nicm 1025: .It Ic main-vertical
1.2 nicm 1026: Similar to
1027: .Ic main-horizontal
1028: but the large pane is placed on the left and the others spread from top to
1029: bottom along the right.
1030: See the
1031: .Em main-pane-width
1032: window option.
1.165 nicm 1033: .It Ic tiled
1034: Panes are spread out as evenly as possible over the window in both rows and
1035: columns.
1.1 nicm 1036: .El
1.8 nicm 1037: .Pp
1.181 nicm 1038: In addition,
1039: .Ic select-layout
1040: may be used to apply a previously used layout - the
1041: .Ic list-windows
1042: command displays the layout of each window in a form suitable for use with
1043: .Ic select-layout .
1044: For example:
1045: .Bd -literal -offset indent
1046: $ tmux list-windows
1047: 0: ksh [159x48]
1048: layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
1049: $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
1050: .Ed
1.196 nicm 1051: .Pp
1.181 nicm 1052: .Nm
1053: automatically adjusts the size of the layout for the current window size.
1054: Note that a layout cannot be applied to a window with more panes than that
1055: from which the layout was originally defined.
1056: .Pp
1.57 jmc 1057: Commands related to windows and panes are as follows:
1058: .Bl -tag -width Ds
1059: .It Xo Ic break-pane
1.280 nicm 1060: .Op Fl dP
1061: .Op Fl F Ar format
1.57 jmc 1062: .Op Fl t Ar target-pane
1063: .Xc
1064: .D1 (alias: Ic breakp )
1065: Break
1066: .Ar target-pane
1067: off from its containing window to make it the only pane in a new window.
1068: If
1069: .Fl d
1070: is given, the new window does not become the current window.
1.280 nicm 1071: The
1072: .Fl P
1073: option prints information about the new window after it has been created.
1074: By default, it uses the format
1075: .Ql #{session_name}:#{window_index}
1076: but a different format may be specified with
1077: .Fl F .
1.128 nicm 1078: .It Xo Ic capture-pane
1.346 nicm 1079: .Op Fl aepPq
1.128 nicm 1080: .Op Fl b Ar buffer-index
1.213 nicm 1081: .Op Fl E Ar end-line
1082: .Op Fl S Ar start-line
1.128 nicm 1083: .Op Fl t Ar target-pane
1084: .Xc
1085: .D1 (alias: Ic capturep )
1.322 nicm 1086: Capture the contents of a pane.
1087: If
1088: .Fl p
1.325 nicm 1089: is given, the output goes to stdout, otherwise to the buffer specified with
1.322 nicm 1090: .Fl b
1091: or a new buffer if omitted.
1.339 nicm 1092: If
1093: .Fl a
1094: is given, the alternate screen is used, and the history is not accessible.
1.340 nicm 1095: If no alternate screen exists, an error will be returned unless
1096: .Fl q
1097: is given.
1.326 nicm 1098: If
1099: .Fl e
1.328 nicm 1100: is given, the output includes escape sequences for text and background
1101: attributes.
1102: .Fl C
1.330 nicm 1103: also escapes non-printable characters as octal \exxx.
1.328 nicm 1104: .Fl J
1.341 nicm 1105: joins wrapped lines and preserves trailing spaces at each line's end.
1.346 nicm 1106: .Fl P
1107: captures only any output that the pane has received that is the beginning of an
1108: as-yet incomplete escape sequence.
1.213 nicm 1109: .Pp
1110: .Fl S
1111: and
1112: .Fl E
1113: specify the starting and ending line numbers, zero is the first line of the
1114: visible pane and negative numbers are lines in the history.
1115: The default is to capture only the visible contents of the pane.
1.76 nicm 1116: .It Xo
1117: .Ic choose-client
1.294 nicm 1118: .Op Fl F Ar format
1.76 nicm 1119: .Op Fl t Ar target-window
1120: .Op Ar template
1121: .Xc
1122: Put a window into client choice mode, allowing a client to be selected
1123: interactively from a list.
1124: After a client is chosen,
1125: .Ql %%
1126: is replaced by the client
1127: .Xr pty 4
1128: path in
1129: .Ar template
1130: and the result executed as a command.
1131: If
1132: .Ar template
1133: is not given, "detach-client -t '%%'" is used.
1.294 nicm 1134: For the meaning of the
1135: .Fl F
1136: flag, see the
1.303 nicm 1137: .Sx FORMATS
1138: section.
1.314 nicm 1139: This command works only if at least one client is attached.
1.303 nicm 1140: .It Xo
1141: .Ic choose-list
1142: .Op Fl l Ar items
1143: .Op Fl t Ar target-window
1144: .Op Ar template
1145: .Xc
1146: Put a window into list choice mode, allowing
1147: .Ar items
1148: to be selected.
1149: .Ar items
1150: can be a comma-separated list to display more than one item.
1151: If an item has spaces, that entry must be quoted.
1152: After an item is chosen,
1153: .Ql %%
1154: is replaced by the chosen item in the
1155: .Ar template
1156: and the result is executed as a command.
1157: If
1158: .Ar template
1159: is not given, "run-shell '%%'" is used.
1160: .Ar items
1161: also accepts format specifiers.
1162: For the meaning of this see the
1.294 nicm 1163: .Sx FORMATS
1164: section.
1.314 nicm 1165: This command works only if at least one client is attached.
1.76 nicm 1166: .It Xo
1167: .Ic choose-session
1.294 nicm 1168: .Op Fl F Ar format
1.76 nicm 1169: .Op Fl t Ar target-window
1170: .Op Ar template
1171: .Xc
1172: Put a window into session choice mode, where a session may be selected
1173: interactively from a list.
1174: When one is chosen,
1175: .Ql %%
1176: is replaced by the session name in
1177: .Ar template
1178: and the result executed as a command.
1179: If
1180: .Ar template
1181: is not given, "switch-client -t '%%'" is used.
1.294 nicm 1182: For the meaning of the
1183: .Fl F
1184: flag, see the
1185: .Sx FORMATS
1186: section.
1.314 nicm 1187: This command works only if at least one client is attached.
1.298 nicm 1188: .It Xo
1189: .Ic choose-tree
1.319 nicm 1190: .Op Fl suw
1.298 nicm 1191: .Op Fl b Ar session-template
1192: .Op Fl c Ar window-template
1193: .Op Fl S Ar format
1194: .Op Fl W Ar format
1195: .Op Fl t Ar target-window
1196: .Xc
1197: Put a window into tree choice mode, where either sessions or windows may be
1198: selected interactively from a list.
1199: By default, windows belonging to a session are indented to show their
1200: relationship to a session.
1201: .Pp
1202: Note that the
1203: .Ic choose-window
1204: and
1205: .Ic choose-session
1206: commands are wrappers around
1207: .Ic choose-tree .
1208: .Pp
1209: If
1210: .Fl s
1211: is given, will show sessions.
1212: If
1213: .Fl w
1214: is given, will show windows.
1.320 nicm 1215: .Pp
1216: By default, the tree is collapsed and sessions must be expanded to windows
1217: with the right arrow key.
1218: The
1.309 nicm 1219: .Fl u
1.321 jmc 1220: option will start with all sessions expanded instead.
1.320 nicm 1221: .Pp
1.298 nicm 1222: If
1223: .Fl b
1224: is given, will override the default session command.
1225: Note that
1226: .Ql %%
1.320 nicm 1227: can be used and will be replaced with the session name.
1.298 nicm 1228: The default option if not specified is "switch-client -t '%%'".
1229: If
1230: .Fl c
1231: is given, will override the default window command.
1.320 nicm 1232: Like
1233: .Fl b ,
1.298 nicm 1234: .Ql %%
1.320 nicm 1235: can be used and will be replaced with the session name and window index.
1236: When a window is chosen from the list, the session command is run before the
1237: window command.
1238: .Pp
1.298 nicm 1239: If
1240: .Fl S
1241: is given will display the specified format instead of the default session
1242: format.
1243: If
1244: .Fl W
1245: is given will display the specified format instead of the default window
1246: format.
1247: For the meaning of the
1248: .Fl s
1249: and
1250: .Fl w
1251: options, see the
1252: .Sx FORMATS
1253: section.
1.320 nicm 1254: .Pp
1.314 nicm 1255: This command works only if at least one client is attached.
1.76 nicm 1256: .It Xo
1257: .Ic choose-window
1.294 nicm 1258: .Op Fl F Ar format
1.76 nicm 1259: .Op Fl t Ar target-window
1260: .Op Ar template
1261: .Xc
1262: Put a window into window choice mode, where a window may be chosen
1263: interactively from a list.
1264: After a window is selected,
1265: .Ql %%
1266: is replaced by the session name and window index in
1267: .Ar template
1268: and the result executed as a command.
1269: If
1270: .Ar template
1271: is not given, "select-window -t '%%'" is used.
1.294 nicm 1272: For the meaning of the
1273: .Fl F
1274: flag, see the
1275: .Sx FORMATS
1276: section.
1.314 nicm 1277: This command works only if at least one client is attached.
1.78 nicm 1278: .It Ic display-panes Op Fl t Ar target-client
1279: .D1 (alias: Ic displayp)
1280: Display a visible indicator of each pane shown by
1281: .Ar target-client .
1282: See the
1.145 nicm 1283: .Ic display-panes-time ,
1284: .Ic display-panes-colour ,
1.78 nicm 1285: and
1.145 nicm 1286: .Ic display-panes-active-colour
1.78 nicm 1287: session options.
1.84 nicm 1288: While the indicator is on screen, a pane may be selected with the
1289: .Ql 0
1290: to
1291: .Ql 9
1292: keys.
1.57 jmc 1293: .It Xo Ic find-window
1.285 nicm 1294: .Op Fl CNT
1.294 nicm 1295: .Op Fl F Ar format
1.57 jmc 1296: .Op Fl t Ar target-window
1297: .Ar match-string
1298: .Xc
1299: .D1 (alias: Ic findw )
1300: Search for the
1301: .Xr fnmatch 3
1302: pattern
1303: .Ar match-string
1304: in window names, titles, and visible content (but not history).
1.285 nicm 1305: The flags control matching behavior:
1306: .Fl C
1307: matches only visible window contents,
1308: .Fl N
1309: matches only the window name and
1310: .Fl T
1311: matches only the window title.
1312: The default is
1313: .Fl CNT .
1314: If only one window is matched, it'll be automatically selected,
1315: otherwise a choice list is shown.
1.294 nicm 1316: For the meaning of the
1317: .Fl F
1318: flag, see the
1319: .Sx FORMATS
1320: section.
1.314 nicm 1321: This command works only if at least one client is attached.
1.137 nicm 1322: .It Xo Ic join-pane
1.277 nicm 1323: .Op Fl bdhv
1.137 nicm 1324: .Oo Fl l
1325: .Ar size |
1326: .Fl p Ar percentage Oc
1327: .Op Fl s Ar src-pane
1328: .Op Fl t Ar dst-pane
1329: .Xc
1330: .D1 (alias: Ic joinp )
1331: Like
1332: .Ic split-window ,
1333: but instead of splitting
1334: .Ar dst-pane
1335: and creating a new pane, split it and move
1336: .Ar src-pane
1337: into the space.
1338: This can be used to reverse
1339: .Ic break-pane .
1.277 nicm 1340: The
1341: .Fl b
1342: option causes
1343: .Ar src-pane
1344: to be joined to left of or above
1345: .Ar dst-pane .
1.112 nicm 1346: .It Xo Ic kill-pane
1347: .Op Fl a
1348: .Op Fl t Ar target-pane
1349: .Xc
1.57 jmc 1350: .D1 (alias: Ic killp )
1351: Destroy the given pane.
1352: If no panes remain in the containing window, it is also destroyed.
1.112 nicm 1353: The
1354: .Fl a
1355: option kills all but the pane given with
1356: .Fl t .
1.289 nicm 1357: .It Xo Ic kill-window
1358: .Op Fl a
1359: .Op Fl t Ar target-window
1360: .Xc
1.57 jmc 1361: .D1 (alias: Ic killw )
1362: Kill the current window or the window at
1363: .Ar target-window ,
1.1 nicm 1364: removing it from any sessions to which it is linked.
1.289 nicm 1365: The
1366: .Fl a
1367: option kills all but the window given with
1368: .Fl t .
1.187 nicm 1369: .It Ic last-pane Op Fl t Ar target-window
1370: .D1 (alias: Ic lastp )
1371: Select the last (previously selected) pane.
1.56 jmc 1372: .It Ic last-window Op Fl t Ar target-session
1.1 nicm 1373: .D1 (alias: Ic last )
1374: Select the last (previously selected) window.
1375: If no
1376: .Ar target-session
1377: is specified, select the last window of the current session.
1378: .It Xo Ic link-window
1379: .Op Fl dk
1380: .Op Fl s Ar src-window
1381: .Op Fl t Ar dst-window
1382: .Xc
1383: .D1 (alias: Ic linkw )
1384: Link the window at
1385: .Ar src-window
1386: to the specified
1387: .Ar dst-window .
1388: If
1389: .Ar dst-window
1390: is specified and no such window exists, the
1391: .Ar src-window
1392: is linked there.
1393: If
1394: .Fl k
1395: is given and
1396: .Ar dst-window
1397: exists, it is killed, otherwise an error is generated.
1398: If
1399: .Fl d
1400: is given, the newly linked window is not selected.
1.214 nicm 1401: .It Xo Ic list-panes
1402: .Op Fl as
1.245 nicm 1403: .Op Fl F Ar format
1.214 nicm 1404: .Op Fl t Ar target
1405: .Xc
1.104 nicm 1406: .D1 (alias: Ic lsp )
1.214 nicm 1407: If
1408: .Fl a
1409: is given,
1410: .Ar target
1411: is ignored and all panes on the server are listed.
1412: If
1413: .Fl s
1414: is given,
1415: .Ar target
1416: is a session (or the current session).
1417: If neither is given,
1418: .Ar target
1419: is a window (or the current window).
1.247 nicm 1420: For the meaning of the
1421: .Fl F
1422: flag, see the
1423: .Sx FORMATS
1424: section.
1.214 nicm 1425: .It Xo Ic list-windows
1426: .Op Fl a
1.245 nicm 1427: .Op Fl F Ar format
1.214 nicm 1428: .Op Fl t Ar target-session
1429: .Xc
1.1 nicm 1430: .D1 (alias: Ic lsw )
1.214 nicm 1431: If
1432: .Fl a
1433: is given, list all windows on the server.
1434: Otherwise, list windows in the current session or in
1.1 nicm 1435: .Ar target-session .
1.245 nicm 1436: For the meaning of the
1437: .Fl F
1438: flag, see the
1439: .Sx FORMATS
1440: section.
1.277 nicm 1441: .It Xo Ic move-pane
1442: .Op Fl bdhv
1443: .Oo Fl l
1444: .Ar size |
1445: .Fl p Ar percentage Oc
1446: .Op Fl s Ar src-pane
1447: .Op Fl t Ar dst-pane
1448: .Xc
1449: .D1 (alias: Ic movep )
1450: Like
1451: .Ic join-pane ,
1452: but
1453: .Ar src-pane
1454: and
1455: .Ar dst-pane
1456: may belong to the same window.
1.1 nicm 1457: .It Xo Ic move-window
1.291 nicm 1458: .Op Fl rdk
1.1 nicm 1459: .Op Fl s Ar src-window
1460: .Op Fl t Ar dst-window
1461: .Xc
1462: .D1 (alias: Ic movew )
1463: This is similar to
1464: .Ic link-window ,
1465: except the window at
1466: .Ar src-window
1467: is moved to
1468: .Ar dst-window .
1.291 nicm 1469: With
1470: .Fl r ,
1471: all windows in the session are renumbered in sequential order, respecting
1472: the
1473: .Ic base-index
1474: option.
1.1 nicm 1475: .It Xo Ic new-window
1.201 nicm 1476: .Op Fl adkP
1.272 nicm 1477: .Op Fl c Ar start-directory
1.351 nicm 1478: .Op Fl F Ar format
1.1 nicm 1479: .Op Fl n Ar window-name
1480: .Op Fl t Ar target-window
1.153 nicm 1481: .Op Ar shell-command
1.1 nicm 1482: .Xc
1483: .D1 (alias: Ic neww )
1484: Create a new window.
1.160 nicm 1485: With
1486: .Fl a ,
1487: the new window is inserted at the next index up from the specified
1488: .Ar target-window ,
1489: moving windows up if necessary,
1490: otherwise
1491: .Ar target-window
1492: is the new window location.
1493: .Pp
1.1 nicm 1494: If
1495: .Fl d
1496: is given, the session does not make the new window the current window.
1497: .Ar target-window
1.28 nicm 1498: represents the window to be created; if the target already exists an error is
1499: shown, unless the
1500: .Fl k
1501: flag is used, in which case it is destroyed.
1.153 nicm 1502: .Ar shell-command
1.1 nicm 1503: is the command to execute.
1504: If
1.153 nicm 1505: .Ar shell-command
1506: is not specified, the value of the
1507: .Ic default-command
1508: option is used.
1.272 nicm 1509: .Fl c
1510: specifies the working directory in which the new window is created.
1511: It may have an absolute path or one of the following values (or a subdirectory):
1512: .Bl -column "XXXXXXXXXXXX" "XXXXXXXXXXXXXXXXXXXXXXXX" -offset indent
1513: .It Li "Empty string" Ta "Current pane's directory"
1514: .It Li "~" Ta "User's home directory"
1515: .It Li "-" Ta "Where session was started"
1516: .It Li "." Ta "Where server was started"
1517: .El
1.153 nicm 1518: .Pp
1519: When the shell command completes, the window closes.
1520: See the
1521: .Ic remain-on-exit
1522: option to change this behaviour.
1.1 nicm 1523: .Pp
1524: The
1525: .Ev TERM
1526: environment variable must be set to
1527: .Dq screen
1528: for all programs running
1529: .Em inside
1530: .Nm .
1531: New windows will automatically have
1532: .Dq TERM=screen
1533: added to their environment, but care must be taken not to reset this in shell
1534: start-up files.
1.201 nicm 1535: .Pp
1536: The
1537: .Fl P
1.279 nicm 1538: option prints information about the new window after it has been created.
1539: By default, it uses the format
1540: .Ql #{session_name}:#{window_index}
1541: but a different format may be specified with
1542: .Fl F .
1.56 jmc 1543: .It Ic next-layout Op Fl t Ar target-window
1.1 nicm 1544: .D1 (alias: Ic nextl )
1545: Move a window to the next layout and rearrange the panes to fit.
1546: .It Xo Ic next-window
1.9 nicm 1547: .Op Fl a
1.1 nicm 1548: .Op Fl t Ar target-session
1549: .Xc
1550: .D1 (alias: Ic next )
1551: Move to the next window in the session.
1.9 nicm 1552: If
1.12 jmc 1553: .Fl a
1.295 nicm 1554: is used, move to the next window with an alert.
1.107 nicm 1555: .It Xo Ic pipe-pane
1556: .Op Fl o
1557: .Op Fl t Ar target-pane
1.153 nicm 1558: .Op Ar shell-command
1.107 nicm 1559: .Xc
1560: .D1 (alias: Ic pipep )
1561: Pipe any output sent by the program in
1562: .Ar target-pane
1563: to a shell command.
1564: A pane may only be piped to one command at a time, any existing pipe is
1565: closed before
1.153 nicm 1566: .Ar shell-command
1.107 nicm 1567: is executed.
1.174 nicm 1568: The
1569: .Ar shell-command
1570: string may contain the special character sequences supported by the
1571: .Ic status-left
1.231 nicm 1572: option.
1.107 nicm 1573: If no
1.153 nicm 1574: .Ar shell-command
1.107 nicm 1575: is given, the current pipe (if any) is closed.
1576: .Pp
1577: The
1578: .Fl o
1579: option only opens a new pipe if no previous pipe exists, allowing a pipe to
1580: be toggled with a single key, for example:
1581: .Bd -literal -offset indent
1.174 nicm 1582: bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1.107 nicm 1583: .Ed
1.176 nicm 1584: .It Xo Ic previous-layout
1585: .Op Fl t Ar target-window
1586: .Xc
1587: .D1 (alias: Ic prevl )
1588: Move to the previous layout in the session.
1.1 nicm 1589: .It Xo Ic previous-window
1.9 nicm 1590: .Op Fl a
1.1 nicm 1591: .Op Fl t Ar target-session
1592: .Xc
1593: .D1 (alias: Ic prev )
1594: Move to the previous window in the session.
1.9 nicm 1595: With
1596: .Fl a ,
1.295 nicm 1597: move to the previous window with an alert.
1.1 nicm 1598: .It Xo Ic rename-window
1599: .Op Fl t Ar target-window
1600: .Ar new-name
1601: .Xc
1602: .D1 (alias: Ic renamew )
1603: Rename the current window, or the window at
1604: .Ar target-window
1605: if specified, to
1606: .Ar new-name .
1607: .It Xo Ic resize-pane
1.337 nicm 1608: .Op Fl DLRUZ
1.52 nicm 1609: .Op Fl t Ar target-pane
1.324 nicm 1610: .Op Fl x Ar width
1611: .Op Fl y Ar height
1.1 nicm 1612: .Op Ar adjustment
1613: .Xc
1614: .D1 (alias: Ic resizep )
1.324 nicm 1615: Resize a pane, up, down, left or right by
1616: .Ar adjustment
1617: with
1618: .Fl U ,
1.57 jmc 1619: .Fl D ,
1620: .Fl L
1.324 nicm 1621: or
1622: .Fl R ,
1623: or
1624: to an absolute size
1625: with
1626: .Fl x
1627: or
1628: .Fl y .
1.57 jmc 1629: The
1630: .Ar adjustment
1631: is given in lines or cells (the default is 1).
1.337 nicm 1632: .Pp
1633: With
1634: .Fl Z ,
1.349 nicm 1635: the active pane is toggled between zoomed (occupying the whole of the window)
1636: and unzoomed (its normal position in the layout).
1.234 nicm 1637: .It Xo Ic respawn-pane
1638: .Op Fl k
1639: .Op Fl t Ar target-pane
1640: .Op Ar shell-command
1641: .Xc
1642: .D1 (alias: Ic respawnp )
1643: Reactivate a pane in which the command has exited (see the
1644: .Ic remain-on-exit
1645: window option).
1646: If
1647: .Ar shell-command
1648: is not given, the command used when the pane was created is executed.
1649: The pane must be already inactive, unless
1650: .Fl k
1651: is given, in which case any existing command is killed.
1.57 jmc 1652: .It Xo Ic respawn-window
1653: .Op Fl k
1654: .Op Fl t Ar target-window
1.153 nicm 1655: .Op Ar shell-command
1.57 jmc 1656: .Xc
1657: .D1 (alias: Ic respawnw )
1.153 nicm 1658: Reactivate a window in which the command has exited (see the
1.57 jmc 1659: .Ic remain-on-exit
1660: window option).
1661: If
1.153 nicm 1662: .Ar shell-command
1.57 jmc 1663: is not given, the command used when the window was created is executed.
1664: The window must be already inactive, unless
1665: .Fl k
1666: is given, in which case any existing command is killed.
1667: .It Xo Ic rotate-window
1668: .Op Fl DU
1669: .Op Fl t Ar target-window
1670: .Xc
1671: .D1 (alias: Ic rotatew )
1672: Rotate the positions of the panes within a window, either upward (numerically
1673: lower) with
1674: .Fl U
1675: or downward (numerically higher).
1676: .It Xo Ic select-layout
1.313 nicm 1677: .Op Fl np
1.57 jmc 1678: .Op Fl t Ar target-window
1679: .Op Ar layout-name
1680: .Xc
1.176 nicm 1681: .D1 (alias: Ic selectl )
1.57 jmc 1682: Choose a specific layout for a window.
1683: If
1684: .Ar layout-name
1.181 nicm 1685: is not given, the last preset layout used (if any) is reapplied.
1.204 nicm 1686: .Fl n
1687: and
1688: .Fl p
1689: are equivalent to the
1690: .Ic next-layout
1691: and
1692: .Ic previous-layout
1693: commands.
1.156 nicm 1694: .It Xo Ic select-pane
1.204 nicm 1695: .Op Fl lDLRU
1.156 nicm 1696: .Op Fl t Ar target-pane
1697: .Xc
1.57 jmc 1698: .D1 (alias: Ic selectp )
1699: Make pane
1700: .Ar target-pane
1701: the active pane in window
1702: .Ar target-window .
1.156 nicm 1703: If one of
1704: .Fl D ,
1705: .Fl L ,
1706: .Fl R ,
1707: or
1708: .Fl U
1709: is used, respectively the pane below, to the left, to the right, or above the
1710: target pane is used.
1.204 nicm 1711: .Fl l
1712: is the same as using the
1713: .Ic last-pane
1714: command.
1715: .It Xo Ic select-window
1.310 nicm 1716: .Op Fl lnpT
1.204 nicm 1717: .Op Fl t Ar target-window
1718: .Xc
1.57 jmc 1719: .D1 (alias: Ic selectw )
1720: Select the window at
1721: .Ar target-window .
1.204 nicm 1722: .Fl l ,
1723: .Fl n
1724: and
1725: .Fl p
1726: are equivalent to the
1727: .Ic last-window ,
1728: .Ic next-window
1729: and
1730: .Ic previous-window
1731: commands.
1.310 nicm 1732: If
1733: .Fl T
1734: is given and the selected window is already the current window,
1735: the command behaves like
1736: .Ic last-window .
1.57 jmc 1737: .It Xo Ic split-window
1.201 nicm 1738: .Op Fl dhvP
1.272 nicm 1739: .Op Fl c Ar start-directory
1.57 jmc 1740: .Oo Fl l
1741: .Ar size |
1742: .Fl p Ar percentage Oc
1.136 nicm 1743: .Op Fl t Ar target-pane
1.153 nicm 1744: .Op Ar shell-command
1.279 nicm 1745: .Op Fl F Ar format
1.57 jmc 1746: .Xc
1.176 nicm 1747: .D1 (alias: Ic splitw )
1.136 nicm 1748: Create a new pane by splitting
1749: .Ar target-pane :
1.57 jmc 1750: .Fl h
1751: does a horizontal split and
1752: .Fl v
1753: a vertical split; if neither is specified,
1754: .Fl v
1755: is assumed.
1756: The
1757: .Fl l
1758: and
1759: .Fl p
1.136 nicm 1760: options specify the size of the new pane in lines (for vertical split) or in
1.57 jmc 1761: cells (for horizontal split), or as a percentage, respectively.
1.136 nicm 1762: All other options have the same meaning as for the
1.57 jmc 1763: .Ic new-window
1764: command.
1765: .It Xo Ic swap-pane
1766: .Op Fl dDU
1767: .Op Fl s Ar src-pane
1768: .Op Fl t Ar dst-pane
1769: .Xc
1770: .D1 (alias: Ic swapp )
1771: Swap two panes.
1772: If
1773: .Fl U
1774: is used and no source pane is specified with
1775: .Fl s ,
1776: .Ar dst-pane
1777: is swapped with the previous pane (before it numerically);
1778: .Fl D
1779: swaps with the next pane (after it numerically).
1.138 nicm 1780: .Fl d
1781: instructs
1782: .Nm
1783: not to change the active pane.
1.57 jmc 1784: .It Xo Ic swap-window
1785: .Op Fl d
1786: .Op Fl s Ar src-window
1787: .Op Fl t Ar dst-window
1788: .Xc
1789: .D1 (alias: Ic swapw )
1790: This is similar to
1791: .Ic link-window ,
1792: except the source and destination windows are swapped.
1793: It is an error if no window exists at
1794: .Ar src-window .
1795: .It Xo Ic unlink-window
1.1 nicm 1796: .Op Fl k
1797: .Op Fl t Ar target-window
1798: .Xc
1.57 jmc 1799: .D1 (alias: Ic unlinkw )
1800: Unlink
1801: .Ar target-window .
1802: Unless
1803: .Fl k
1804: is given, a window may be unlinked only if it is linked to multiple sessions -
1805: windows may not be linked to no sessions;
1806: if
1.1 nicm 1807: .Fl k
1.57 jmc 1808: is specified and the window is linked to only one session, it is unlinked and
1809: destroyed.
1810: .El
1811: .Sh KEY BINDINGS
1.93 nicm 1812: .Nm
1813: allows a command to be bound to most keys, with or without a prefix key.
1814: When specifying keys, most represent themselves (for example
1815: .Ql A
1816: to
1.95 jmc 1817: .Ql Z ) .
1.93 nicm 1818: Ctrl keys may be prefixed with
1819: .Ql C-
1820: or
1.95 jmc 1821: .Ql ^ ,
1822: and Alt (meta) with
1.93 nicm 1823: .Ql M- .
1824: In addition, the following special key names are accepted:
1.126 nicm 1825: .Em Up ,
1826: .Em Down ,
1827: .Em Left ,
1828: .Em Right ,
1.93 nicm 1829: .Em BSpace ,
1830: .Em BTab ,
1831: .Em DC
1832: (Delete),
1833: .Em End ,
1834: .Em Enter ,
1835: .Em Escape ,
1836: .Em F1
1837: to
1838: .Em F20 ,
1839: .Em Home ,
1840: .Em IC
1841: (Insert),
1.254 nicm 1842: .Em NPage/PageDown/PgDn ,
1843: .Em PPage/PageUp/PgUp ,
1.93 nicm 1844: .Em Space ,
1845: and
1846: .Em Tab .
1847: Note that to bind the
1848: .Ql \&"
1849: or
1850: .Ql '
1851: keys, quotation marks are necessary, for example:
1852: .Bd -literal -offset indent
1853: bind-key '"' split-window
1.167 nicm 1854: bind-key "'" new-window
1.93 nicm 1855: .Ed
1856: .Pp
1.57 jmc 1857: Commands related to key bindings are as follows:
1858: .Bl -tag -width Ds
1859: .It Xo Ic bind-key
1860: .Op Fl cnr
1861: .Op Fl t Ar key-table
1862: .Ar key Ar command Op Ar arguments
1.1 nicm 1863: .Xc
1.57 jmc 1864: .D1 (alias: Ic bind )
1865: Bind key
1866: .Ar key
1867: to
1868: .Ar command .
1869: By default (without
1870: .Fl t )
1871: the primary key bindings are modified (those normally activated with the prefix
1872: key); in this case, if
1873: .Fl n
1874: is specified, it is not necessary to use the prefix key,
1875: .Ar command
1876: is bound to
1877: .Ar key
1878: alone.
1.1 nicm 1879: The
1.57 jmc 1880: .Fl r
1881: flag indicates this key may repeat, see the
1882: .Ic repeat-time
1883: option.
1884: .Pp
1885: If
1886: .Fl t
1887: is present,
1888: .Ar key
1889: is bound in
1890: .Ar key-table :
1891: the binding for command mode with
1892: .Fl c
1893: or for normal mode without.
1894: To view the default bindings and possible commands, see the
1895: .Ic list-keys
1896: command.
1897: .It Ic list-keys Op Fl t Ar key-table
1898: .D1 (alias: Ic lsk )
1899: List all key bindings.
1900: Without
1901: .Fl t
1902: the primary key bindings - those executed when preceded by the prefix key -
1903: are printed.
1904: .Pp
1905: With
1906: .Fl t ,
1907: the key bindings in
1908: .Ar key-table
1909: are listed; this may be one of:
1910: .Em vi-edit ,
1911: .Em emacs-edit ,
1912: .Em vi-choice ,
1913: .Em emacs-choice ,
1914: .Em vi-copy
1915: or
1916: .Em emacs-copy .
1917: .It Xo Ic send-keys
1.273 nicm 1918: .Op Fl lR
1.72 nicm 1919: .Op Fl t Ar target-pane
1.57 jmc 1920: .Ar key Ar ...
1.1 nicm 1921: .Xc
1.57 jmc 1922: .D1 (alias: Ic send )
1923: Send a key or keys to a window.
1924: Each argument
1925: .Ar key
1926: is the name of the key (such as
1927: .Ql C-a
1928: or
1929: .Ql npage
1930: ) to send; if the string is not recognised as a key, it is sent as a series of
1931: characters.
1.273 nicm 1932: The
1933: .Fl l
1934: flag disables key name lookup and sends the keys literally.
1.57 jmc 1935: All arguments are sent sequentially from first to last.
1.265 nicm 1936: The
1937: .Fl R
1938: flag causes the terminal state to be reset.
1.267 nicm 1939: .It Xo Ic send-prefix
1940: .Op Fl 2
1941: .Op Fl t Ar target-pane
1942: .Xc
1943: Send the prefix key, or with
1944: .Fl 2
1945: the secondary prefix key, to a window as if it was pressed.
1.57 jmc 1946: .It Xo Ic unbind-key
1.189 nicm 1947: .Op Fl acn
1.57 jmc 1948: .Op Fl t Ar key-table
1949: .Ar key
1.2 nicm 1950: .Xc
1.57 jmc 1951: .D1 (alias: Ic unbind )
1952: Unbind the command bound to
1953: .Ar key .
1954: Without
1955: .Fl t
1956: the primary key bindings are modified; in this case, if
1957: .Fl n
1958: is specified, the command bound to
1959: .Ar key
1960: without a prefix (if any) is removed.
1.189 nicm 1961: If
1962: .Fl a
1963: is present, all key bindings are removed.
1.57 jmc 1964: .Pp
1.47 nicm 1965: If
1.57 jmc 1966: .Fl t
1967: is present,
1968: .Ar key
1969: in
1970: .Ar key-table
1971: is unbound: the binding for command mode with
1972: .Fl c
1973: or for normal mode without.
1974: .El
1975: .Sh OPTIONS
1976: The appearance and behaviour of
1977: .Nm
1978: may be modified by changing the value of various options.
1.133 nicm 1979: There are three types of option:
1980: .Em server options ,
1.57 jmc 1981: .Em session options
1982: and
1983: .Em window options .
1984: .Pp
1.133 nicm 1985: The
1986: .Nm
1987: server has a set of global options which do not apply to any particular
1988: window or session.
1989: These are altered with the
1990: .Ic set-option
1991: .Fl s
1992: command, or displayed with the
1993: .Ic show-options
1994: .Fl s
1995: command.
1996: .Pp
1997: In addition, each individual session may have a set of session options, and
1998: there is a separate set of global session options.
1.57 jmc 1999: Sessions which do not have a particular option configured inherit the value
2000: from the global session options.
2001: Session options are set or unset with the
2002: .Ic set-option
2003: command and may be listed with the
2004: .Ic show-options
2005: command.
1.133 nicm 2006: The available server and session options are listed under the
1.57 jmc 2007: .Ic set-option
2008: command.
2009: .Pp
2010: Similarly, a set of window options is attached to each window, and there is
2011: a set of global window options from which any unset options are inherited.
2012: Window options are altered with the
2013: .Ic set-window-option
2014: command and can be listed with the
2015: .Ic show-window-options
2016: command.
2017: All window options are documented with the
2018: .Ic set-window-option
2019: command.
1.318 nicm 2020: .Pp
2021: .Nm
2022: also supports user options which are prefixed with a
2023: .Ql \&@ .
1.321 jmc 2024: User options may have any name, so long as they are prefixed with
2025: .Ql \&@ ,
1.318 nicm 2026: and be set to any string.
2027: For example
2028: .Bd -literal -offset indent
2029: $ tmux setw -q @foo "abc123"
2030: $ tmux showw -v @foo
2031: abc123
2032: .Ed
1.57 jmc 2033: .Pp
2034: Commands which set options are as follows:
2035: .Bl -tag -width Ds
1.1 nicm 2036: .It Xo Ic set-option
1.336 nicm 2037: .Op Fl agoqsuw
1.129 nicm 2038: .Op Fl t Ar target-session | Ar target-window
1.1 nicm 2039: .Ar option Ar value
2040: .Xc
2041: .D1 (alias: Ic set )
1.133 nicm 2042: Set a window option with
2043: .Fl w
2044: (equivalent to the
2045: .Ic set-window-option
2046: command),
2047: a server option with
2048: .Fl s ,
2049: otherwise a session option.
2050: .Pp
2051: If
2052: .Fl g
2053: is specified, the global session or window option is set.
1.58 nicm 2054: With
2055: .Fl a ,
2056: and if the option expects a string,
2057: .Ar value
2058: is appended to the existing setting.
1.1 nicm 2059: The
2060: .Fl u
2061: flag unsets an option, so a session inherits the option from the global
1.133 nicm 2062: options.
2063: It is not possible to unset a global option.
1.336 nicm 2064: .Pp
2065: The
2066: .Fl o
2067: flag prevents setting an option that is already set.
1.1 nicm 2068: .Pp
1.281 nicm 2069: The
2070: .Fl q
2071: flag suppresses the informational message (as if the
2072: .Ic quiet
2073: server option was set).
2074: .Pp
1.133 nicm 2075: Available window options are listed under
2076: .Ic set-window-option .
1.274 nicm 2077: .Pp
2078: .Ar value
2079: depends on the option and may be a number, a string, or a flag (on, off, or
2080: omitted to toggle).
1.133 nicm 2081: .Pp
2082: Available server options are:
2083: .Bl -tag -width Ds
1.198 nicm 2084: .It Ic buffer-limit Ar number
2085: Set the number of buffers; as new buffers are added to the top of the stack,
2086: old ones are removed from the bottom if necessary to maintain this maximum
2087: length.
1.239 nicm 2088: .It Ic escape-time Ar time
2089: Set the time in milliseconds for which
2090: .Nm
2091: waits after an escape is input to determine if it is part of a function or meta
2092: key sequences.
2093: The default is 500 milliseconds.
2094: .It Xo Ic exit-unattached
2095: .Op Ic on | off
2096: .Xc
2097: If enabled, the server will exit when there are no attached clients.
1.362 nicm 2098: .It Xo Ic focus-events
2099: .Op Ic on | off
2100: .Xc
2101: When enabled, focus events are requested from the terminal if supported and
2102: passed through to applications running in
2103: .Nm .
2104: Attached clients should be detached and attached again after changing this
2105: option.
1.239 nicm 2106: .It Xo Ic quiet
2107: .Op Ic on | off
2108: .Xc
2109: Enable or disable the display of various informational messages (see also the
2110: .Fl q
2111: command line flag).
1.228 nicm 2112: .It Xo Ic set-clipboard
2113: .Op Ic on | off
2114: .Xc
2115: Attempt to set the terminal clipboard content using the
2116: \ee]52;...\e007
2117: .Xr xterm 1
2118: escape sequences.
2119: This option is on by default if there is an
2120: .Em \&Ms
2121: entry in the
2122: .Xr terminfo 5
2123: description for the client terminal.
2124: Note that this feature needs to be enabled in
2125: .Xr xterm 1
2126: by setting the resource:
2127: .Bd -literal -offset indent
2128: disallowedWindowOps: 20,21,SetXprop
2129: .Ed
2130: .Pp
2131: Or changing this property from the
2132: .Xr xterm 1
2133: interactive menu when required.
1.133 nicm 2134: .El
1.129 nicm 2135: .Pp
1.18 nicm 2136: Available session options are:
1.1 nicm 2137: .Bl -tag -width Ds
1.312 nicm 2138: .It Ic assume-paste-time Ar milliseconds
2139: If keys are entered faster than one in
2140: .Ar milliseconds ,
2141: they are assumed to have been pasted rather than typed and
2142: .Nm
2143: key bindings are not processed.
2144: The default is one millisecond and zero disables.
1.69 nicm 2145: .It Ic base-index Ar index
2146: Set the base index from which an unused index should be searched when a new
2147: window is created.
2148: The default is zero.
1.1 nicm 2149: .It Xo Ic bell-action
1.56 jmc 2150: .Op Ic any | none | current
1.1 nicm 2151: .Xc
2152: Set action on window bell.
2153: .Ic any
2154: means a bell in any window linked to a session causes a bell in the current
2155: window of that session,
2156: .Ic none
2157: means all bells are ignored and
2158: .Ic current
1.305 nicm 2159: means only bells in windows other than the current window are ignored.
1.237 nicm 2160: .It Xo Ic bell-on-alert
2161: .Op Ic on | off
2162: .Xc
1.295 nicm 2163: If on, ring the terminal bell when an alert
1.237 nicm 2164: occurs.
1.153 nicm 2165: .It Ic default-command Ar shell-command
1.1 nicm 2166: Set the command used for new windows (if not specified when the window is
2167: created) to
1.153 nicm 2168: .Ar shell-command ,
1.79 nicm 2169: which may be any
2170: .Xr sh 1
2171: command.
1.19 nicm 2172: The default is an empty string, which instructs
2173: .Nm
1.79 nicm 2174: to create a login shell using the value of the
2175: .Ic default-shell
2176: option.
1.196 nicm 2177: .It Ic default-path Ar path
1.257 nicm 2178: Set the default working directory for new panes.
1.365 nicm 2179: If empty, the working directory is determined from the process
1.257 nicm 2180: running in the active pane, from the command line environment or from the
2181: working directory where the session was created.
1.292 nicm 2182: Otherwise the same options are available as for the
2183: .Fl c
2184: flag to
2185: .Ic new-window .
1.365 nicm 2186: The default is
2187: .Ql ~ .
1.79 nicm 2188: .It Ic default-shell Ar path
2189: Specify the default shell.
2190: This is used as the login shell for new windows when the
2191: .Ic default-command
2192: option is set to empty, and must be the full path of the executable.
2193: When started
2194: .Nm
2195: tries to set a default value from the first suitable of the
1.19 nicm 2196: .Ev SHELL
1.79 nicm 2197: environment variable, the shell returned by
2198: .Xr getpwuid 3 ,
2199: or
2200: .Pa /bin/sh .
2201: This option should be configured when
2202: .Nm
2203: is used as a login shell.
1.22 nicm 2204: .It Ic default-terminal Ar terminal
2205: Set the default terminal for new windows created in this session - the
2206: default value of the
2207: .Ev TERM
2208: environment variable.
2209: For
2210: .Nm
2211: to work correctly, this
2212: .Em must
2213: be set to
2214: .Ql screen
2215: or a derivative of it.
1.206 nicm 2216: .It Xo Ic destroy-unattached
2217: .Op Ic on | off
2218: .Xc
1.185 nicm 2219: If enabled and the session is no longer attached to any clients, it is
2220: destroyed.
1.206 nicm 2221: .It Xo Ic detach-on-destroy
2222: .Op Ic on | off
2223: .Xc
1.184 nicm 2224: If on (the default), the client is detached when the session it is attached to
2225: is destroyed.
2226: If off, the client is switched to the most recently active of the remaining
2227: sessions.
1.145 nicm 2228: .It Ic display-panes-active-colour Ar colour
2229: Set the colour used by the
2230: .Ic display-panes
2231: command to show the indicator for the active pane.
1.78 nicm 2232: .It Ic display-panes-colour Ar colour
1.145 nicm 2233: Set the colour used by the
1.78 nicm 2234: .Ic display-panes
1.145 nicm 2235: command to show the indicators for inactive panes.
1.78 nicm 2236: .It Ic display-panes-time Ar time
2237: Set the time in milliseconds for which the indicators shown by the
2238: .Ic display-panes
2239: command appear.
1.21 nicm 2240: .It Ic display-time Ar time
1.78 nicm 2241: Set the amount of time for which status line messages and other on-screen
2242: indicators are displayed.
1.21 nicm 2243: .Ar time
2244: is in milliseconds.
1.1 nicm 2245: .It Ic history-limit Ar lines
2246: Set the maximum number of lines held in window history.
2247: This setting applies only to new windows - existing window histories are not
2248: resized and retain the limit at the point they were created.
2249: .It Ic lock-after-time Ar number
1.100 nicm 2250: Lock the session (like the
2251: .Ic lock-session
1.90 nicm 2252: command) after
1.1 nicm 2253: .Ar number
1.100 nicm 2254: seconds of inactivity, or the entire server (all sessions) if the
2255: .Ic lock-server
2256: option is set.
2257: The default is not to lock (set to 0).
1.153 nicm 2258: .It Ic lock-command Ar shell-command
1.90 nicm 2259: Command to run when locking each client.
2260: The default is to run
2261: .Xr lock 1
2262: with
2263: .Fl np .
1.100 nicm 2264: .It Xo Ic lock-server
2265: .Op Ic on | off
2266: .Xc
2267: If this option is
1.102 nicm 2268: .Ic on
1.100 nicm 2269: (the default),
2270: instead of each session locking individually as each has been
2271: idle for
1.108 jmc 2272: .Ic lock-after-time ,
2273: the entire server will lock after
1.100 nicm 2274: .Em all
2275: sessions would have locked.
2276: This has no effect as a session option; it must be set as a global option.
1.1 nicm 2277: .It Ic message-attr Ar attributes
2278: Set status line message attributes, where
2279: .Ar attributes
2280: is either
1.168 nicm 2281: .Ic none
1.1 nicm 2282: or a comma-delimited list of one or more of:
2283: .Ic bright
2284: (or
2285: .Ic bold ) ,
2286: .Ic dim ,
2287: .Ic underscore ,
2288: .Ic blink ,
2289: .Ic reverse ,
2290: .Ic hidden ,
2291: or
2292: .Ic italics .
2293: .It Ic message-bg Ar colour
2294: Set status line message background colour, where
2295: .Ar colour
2296: is one of:
2297: .Ic black ,
2298: .Ic red ,
2299: .Ic green ,
2300: .Ic yellow ,
2301: .Ic blue ,
2302: .Ic magenta ,
2303: .Ic cyan ,
1.85 nicm 2304: .Ic white ,
1.266 nicm 2305: aixterm bright variants (if supported:
2306: .Ic brightred ,
2307: .Ic brightgreen ,
2308: and so on),
1.85 nicm 2309: .Ic colour0
2310: to
2311: .Ic colour255
1.205 nicm 2312: from the 256-colour set,
2313: .Ic default ,
2314: or a hexadecimal RGB string such as
2315: .Ql #ffffff ,
2316: which chooses the closest match from the default 256-colour set.
1.253 nicm 2317: .It Ic message-command-attr Ar attributes
2318: Set status line message attributes when in command mode.
2319: .It Ic message-command-bg Ar colour
2320: Set status line message background colour when in command mode.
2321: .It Ic message-command-fg Ar colour
2322: Set status line message foreground colour when in command mode.
1.1 nicm 2323: .It Ic message-fg Ar colour
2324: Set status line message foreground colour.
1.120 nicm 2325: .It Ic message-limit Ar number
2326: Set the number of error or information messages to save in the message log for
2327: each client.
2328: The default is 20.
1.226 nicm 2329: .It Xo Ic mouse-resize-pane
2330: .Op Ic on | off
2331: .Xc
2332: If on,
2333: .Nm
2334: captures the mouse and allows panes to be resized by dragging on their borders.
1.102 nicm 2335: .It Xo Ic mouse-select-pane
2336: .Op Ic on | off
2337: .Xc
2338: If on,
2339: .Nm
2340: captures the mouse and when a window is split into multiple panes the mouse may
2341: be used to select the current pane.
2342: The mouse click is also passed through to the application as normal.
1.222 nicm 2343: .It Xo Ic mouse-select-window
2344: .Op Ic on | off
2345: .Xc
2346: If on, clicking the mouse on a window name in the status line will select that
2347: window.
1.239 nicm 2348: .It Xo Ic mouse-utf8
2349: .Op Ic on | off
2350: .Xc
2351: If enabled, request mouse input as UTF-8 on UTF-8 terminals.
1.196 nicm 2352: .It Ic pane-active-border-bg Ar colour
2353: .It Ic pane-active-border-fg Ar colour
2354: Set the pane border colour for the currently active pane.
2355: .It Ic pane-border-bg Ar colour
1.135 nicm 2356: .It Ic pane-border-fg Ar colour
2357: Set the pane border colour for panes aside from the active pane.
1.267 nicm 2358: .It Ic prefix Ar key
2359: Set the key accepted as a prefix key.
2360: .It Ic prefix2 Ar key
2361: Set a secondary key accepted as a prefix key.
1.291 nicm 2362: .It Xo Ic renumber-windows
2363: .Op Ic on | off
2364: .Xc
2365: If on, when a window is closed in a session, automatically renumber the other
2366: windows in numerical order.
2367: This respects the
2368: .Ic base-index
2369: option if it has been set.
2370: If off, do not renumber the windows.
1.21 nicm 2371: .It Ic repeat-time Ar time
1.1 nicm 2372: Allow multiple commands to be entered without pressing the prefix-key again
2373: in the specified
1.21 nicm 2374: .Ar time
1.1 nicm 2375: milliseconds (the default is 500).
2376: Whether a key repeats may be set when it is bound using the
2377: .Fl r
2378: flag to
2379: .Ic bind-key .
1.52 nicm 2380: Repeat is enabled for the default keys bound to the
2381: .Ic resize-pane
2382: command.
1.1 nicm 2383: .It Xo Ic set-remain-on-exit
1.56 jmc 2384: .Op Ic on | off
1.1 nicm 2385: .Xc
2386: Set the
2387: .Ic remain-on-exit
2388: window option for any windows first created in this session.
1.153 nicm 2389: When this option is true, windows in which the running program has
2390: exited do not close, instead remaining open but inactivate.
2391: Use the
2392: .Ic respawn-window
2393: command to reactivate such a window, or the
2394: .Ic kill-window
2395: command to destroy it.
1.1 nicm 2396: .It Xo Ic set-titles
1.56 jmc 2397: .Op Ic on | off
1.1 nicm 2398: .Xc
1.261 nicm 2399: Attempt to set the client terminal title using the
2400: .Em tsl
2401: and
2402: .Em fsl
2403: .Xr terminfo 5
2404: entries if they exist.
2405: .Nm
2406: automatically sets these to the \ee]2;...\e007 sequence if
1.1 nicm 2407: the terminal appears to be an xterm.
1.11 nicm 2408: This option is off by default.
1.6 jmc 2409: Note that elinks
1.1 nicm 2410: will only attempt to set the window title if the STY environment
2411: variable is set.
1.86 nicm 2412: .It Ic set-titles-string Ar string
2413: String used to set the window title if
2414: .Ic set-titles
2415: is on.
2416: Character sequences are replaced as for the
2417: .Ic status-left
2418: option.
1.1 nicm 2419: .It Xo Ic status
1.56 jmc 2420: .Op Ic on | off
1.1 nicm 2421: .Xc
2422: Show or hide the status line.
2423: .It Ic status-attr Ar attributes
2424: Set status line attributes.
2425: .It Ic status-bg Ar colour
2426: Set status line background colour.
2427: .It Ic status-fg Ar colour
2428: Set status line foreground colour.
2429: .It Ic status-interval Ar interval
2430: Update the status bar every
2431: .Ar interval
2432: seconds.
2433: By default, updates will occur every 15 seconds.
2434: A setting of zero disables redrawing at interval.
1.41 nicm 2435: .It Xo Ic status-justify
1.56 jmc 2436: .Op Ic left | centre | right
1.41 nicm 2437: .Xc
2438: Set the position of the window list component of the status line: left, centre
2439: or right justified.
1.1 nicm 2440: .It Xo Ic status-keys
1.56 jmc 2441: .Op Ic vi | emacs
1.1 nicm 2442: .Xc
1.6 jmc 2443: Use vi or emacs-style
1.1 nicm 2444: key bindings in the status line, for example at the command prompt.
1.191 nicm 2445: The default is emacs, unless the
2446: .Ev VISUAL
2447: or
2448: .Ev EDITOR
2449: environment variables are set and contain the string
2450: .Ql vi .
1.1 nicm 2451: .It Ic status-left Ar string
2452: Display
2453: .Ar string
1.359 nicm 2454: (by default the session name) to the left of the status bar.
1.1 nicm 2455: .Ar string
2456: will be passed through
2457: .Xr strftime 3
1.359 nicm 2458: and formats (see
2459: .Sx FORMATS Ns )
2460: will be expanded.
2461: It may also contain any of the following special character sequences:
1.1 nicm 2462: .Bl -column "Character pair" "Replaced with" -offset indent
2463: .It Sy "Character pair" Ta Sy "Replaced with"
1.153 nicm 2464: .It Li "#(shell-command)" Ta "First line of the command's output"
1.83 nicm 2465: .It Li "#[attributes]" Ta "Colour or attribute change"
1.1 nicm 2466: .It Li "##" Ta "A literal" Ql #
2467: .El
1.83 nicm 2468: .Pp
1.153 nicm 2469: The #(shell-command) form executes
2470: .Ql shell-command
2471: and inserts the first line of its output.
1.103 nicm 2472: Note that shell commands are only executed once at the interval specified by
2473: the
2474: .Ic status-interval
2475: option: if the status line is redrawn in the meantime, the previous result is
2476: used.
1.161 nicm 2477: Shell commands are executed with the
2478: .Nm
2479: global environment set (see the
1.162 jmc 2480: .Sx ENVIRONMENT
2481: section).
1.163 nicm 2482: .Pp
1.263 nicm 2483: For details on how the names and titles can be set see the
1.261 nicm 2484: .Sx "NAMES AND TITLES"
2485: section.
1.109 nicm 2486: .Pp
1.83 nicm 2487: #[attributes] allows a comma-separated list of attributes to be specified,
2488: these may be
2489: .Ql fg=colour
2490: to set the foreground colour,
2491: .Ql bg=colour
1.131 nicm 2492: to set the background colour, the name of one of the attributes (listed under
2493: the
1.83 nicm 2494: .Ic message-attr
1.109 nicm 2495: option) to turn an attribute on, or an attribute prefixed with
2496: .Ql no
2497: to turn one off, for example
2498: .Ic nobright .
1.83 nicm 2499: Examples are:
2500: .Bd -literal -offset indent
2501: #(sysctl vm.loadavg)
2502: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
2503: .Ed
1.1 nicm 2504: .Pp
1.109 nicm 2505: Where appropriate, special character sequences may be prefixed with a number to
2506: specify the maximum length, for example
1.1 nicm 2507: .Ql #24T .
1.10 nicm 2508: .Pp
1.12 jmc 2509: By default, UTF-8 in
1.10 nicm 2510: .Ar string
2511: is not interpreted, to enable UTF-8, use the
2512: .Ic status-utf8
2513: option.
1.62 nicm 2514: .It Ic status-left-attr Ar attributes
1.66 jmc 2515: Set the attribute of the left part of the status line.
1.196 nicm 2516: .It Ic status-left-bg Ar colour
2517: Set the background colour of the left part of the status line.
1.62 nicm 2518: .It Ic status-left-fg Ar colour
2519: Set the foreground colour of the left part of the status line.
1.1 nicm 2520: .It Ic status-left-length Ar length
2521: Set the maximum
2522: .Ar length
2523: of the left component of the status bar.
2524: The default is 10.
1.269 nicm 2525: .It Xo Ic status-position
2526: .Op Ic top | bottom
2527: .Xc
2528: Set the position of the status line.
1.1 nicm 2529: .It Ic status-right Ar string
2530: Display
2531: .Ar string
2532: to the right of the status bar.
1.151 nicm 2533: By default, the current window title in double quotes, the date and the time
2534: are shown.
1.1 nicm 2535: As with
2536: .Ic status-left ,
2537: .Ar string
2538: will be passed to
1.10 nicm 2539: .Xr strftime 3 ,
2540: character pairs are replaced, and UTF-8 is dependent on the
2541: .Ic status-utf8
2542: option.
1.62 nicm 2543: .It Ic status-right-attr Ar attributes
1.66 jmc 2544: Set the attribute of the right part of the status line.
1.196 nicm 2545: .It Ic status-right-bg Ar colour
2546: Set the background colour of the right part of the status line.
1.62 nicm 2547: .It Ic status-right-fg Ar colour
2548: Set the foreground colour of the right part of the status line.
1.1 nicm 2549: .It Ic status-right-length Ar length
2550: Set the maximum
2551: .Ar length
2552: of the right component of the status bar.
2553: The default is 40.
1.10 nicm 2554: .It Xo Ic status-utf8
1.56 jmc 2555: .Op Ic on | off
1.10 nicm 2556: .Xc
2557: Instruct
2558: .Nm
2559: to treat top-bit-set characters in the
2560: .Ic status-left
2561: and
2562: .Ic status-right
2563: strings as UTF-8; notably, this is important for wide characters.
2564: This option defaults to off.
1.55 jmc 2565: .It Ic terminal-overrides Ar string
1.54 nicm 2566: Contains a list of entries which override terminal descriptions read using
2567: .Xr terminfo 5 .
2568: .Ar string
2569: is a comma-separated list of items each a colon-separated string made up of a
2570: terminal type pattern (matched using
2571: .Xr fnmatch 3 )
2572: and a set of
2573: .Em name=value
2574: entries.
2575: .Pp
2576: For example, to set the
2577: .Ql clear
2578: .Xr terminfo 5
2579: entry to
2580: .Ql \ee[H\ee[2J
2581: for all terminal types and the
2582: .Ql dch1
2583: entry to
2584: .Ql \ee[P
1.55 jmc 2585: for the
1.54 nicm 2586: .Ql rxvt
2587: terminal type, the option could be set to the string:
2588: .Bd -literal -offset indent
2589: "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
2590: .Ed
2591: .Pp
2592: The terminal entry value is passed through
2593: .Xr strunvis 3
2594: before interpretation.
2595: The default value forcibly corrects the
2596: .Ql colors
2597: entry for terminals which support 88 or 256 colours:
2598: .Bd -literal -offset indent
1.225 nicm 2599: "*88col*:colors=88,*256col*:colors=256,xterm*:XT"
1.54 nicm 2600: .Ed
1.63 nicm 2601: .It Ic update-environment Ar variables
2602: Set a space-separated string containing a list of environment variables to be
2603: copied into the session environment when a new session is created or an
2604: existing session is attached.
2605: Any variables that do not exist in the source environment are set to be
2606: removed from the session environment (as if
2607: .Fl r
2608: was given to the
2609: .Ic set-environment
2610: command).
2611: The default is
1.190 nicm 2612: "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
2613: XAUTHORITY".
1.37 nicm 2614: .It Xo Ic visual-activity
1.56 jmc 2615: .Op Ic on | off
1.37 nicm 2616: .Xc
2617: If on, display a status line message when activity occurs in a window
1.39 jmc 2618: for which the
1.37 nicm 2619: .Ic monitor-activity
2620: window option is enabled.
2621: .It Xo Ic visual-bell
1.56 jmc 2622: .Op Ic on | off
1.37 nicm 2623: .Xc
2624: If this option is on, a message is shown on a bell instead of it being passed
2625: through to the terminal (which normally makes a sound).
2626: Also see the
2627: .Ic bell-action
2628: option.
2629: .It Xo Ic visual-content
1.56 jmc 2630: .Op Ic on | off
1.37 nicm 2631: .Xc
2632: Like
2633: .Ic visual-activity ,
2634: display a message when content is present in a window
1.39 jmc 2635: for which the
1.37 nicm 2636: .Ic monitor-content
2637: window option is enabled.
1.192 nicm 2638: .It Xo Ic visual-silence
2639: .Op Ic on | off
2640: .Xc
2641: If
2642: .Ic monitor-silence
2643: is enabled, prints a message after the interval has expired on a given window.
1.255 nicm 2644: .It Ic word-separators Ar string
2645: Sets the session's conception of what characters are considered word
2646: separators, for the purposes of the next and previous word commands in
2647: copy mode.
2648: The default is
2649: .Ql \ -_@ .
1.1 nicm 2650: .El
2651: .It Xo Ic set-window-option
1.356 nicm 2652: .Op Fl agoqu
1.1 nicm 2653: .Op Fl t Ar target-window
2654: .Ar option Ar value
2655: .Xc
2656: .D1 (alias: Ic setw )
1.18 nicm 2657: Set a window option.
1.1 nicm 2658: The
1.58 nicm 2659: .Fl a ,
1.281 nicm 2660: .Fl g ,
1.356 nicm 2661: .Fl o ,
1.281 nicm 2662: .Fl q
1.1 nicm 2663: and
2664: .Fl u
2665: flags work similarly to the
2666: .Ic set-option
2667: command.
2668: .Pp
1.18 nicm 2669: Supported window options are:
1.56 jmc 2670: .Pp
2671: .Bl -tag -width Ds -compact
1.1 nicm 2672: .It Xo Ic aggressive-resize
1.56 jmc 2673: .Op Ic on | off
1.1 nicm 2674: .Xc
2675: Aggressively resize the chosen window.
2676: This means that
2677: .Nm
2678: will resize the window to the size of the smallest session for which it is the
2679: current window, rather than the smallest session to which it is attached.
2680: The window may resize when the current window is changed on another sessions;
1.6 jmc 2681: this option is good for full-screen programs which support
2682: .Dv SIGWINCH
2683: and poor for interactive programs such as shells.
1.262 nicm 2684: .Pp
2685: .It Xo Ic allow-rename
2686: .Op Ic on | off
2687: .Xc
2688: Allow programs to change the window name using a terminal escape
2689: sequence (\\033k...\\033\\\\).
2690: The default is on.
1.56 jmc 2691: .Pp
1.196 nicm 2692: .It Xo Ic alternate-screen
2693: .Op Ic on | off
2694: .Xc
2695: This option configures whether programs running inside
2696: .Nm
2697: may use the terminal alternate screen feature, which allows the
2698: .Em smcup
2699: and
2700: .Em rmcup
2701: .Xr terminfo 5
1.209 nicm 2702: capabilities.
2703: The alternate screen feature preserves the contents of the window when an
2704: interactive application starts and restores it on exit, so that any output
2705: visible before the application starts reappears unchanged after it exits.
2706: The default is on.
1.196 nicm 2707: .Pp
1.1 nicm 2708: .It Xo Ic automatic-rename
1.56 jmc 2709: .Op Ic on | off
1.1 nicm 2710: .Xc
2711: Control automatic window renaming.
2712: When this setting is enabled,
2713: .Nm
1.368 nicm 2714: will rename the window automatically using the format specified by
2715: .Ic automatic-rename-format .
1.1 nicm 2716: This flag is automatically disabled for an individual window when a name
2717: is specified at creation with
1.186 nicm 2718: .Ic new-window
2719: or
1.1 nicm 2720: .Ic new-session ,
2721: or later with
1.261 nicm 2722: .Ic rename-window ,
2723: or with a terminal escape sequence.
1.1 nicm 2724: It may be switched off globally with:
2725: .Bd -literal -offset indent
2726: set-window-option -g automatic-rename off
2727: .Ed
1.368 nicm 2728: .Pp
2729: .It Ic automatic-rename-format Ar format
2730: The format (see
2731: .Sx FORMATS )
2732: used when the
2733: .Ic automatic-rename
2734: option is enabled.
1.283 nicm 2735: .Pp
2736: .It Ic c0-change-interval Ar interval
2737: .It Ic c0-change-trigger Ar trigger
2738: These two options configure a simple form of rate limiting for a pane.
2739: If
2740: .Nm
2741: sees more than
2742: .Ar trigger
2743: C0 sequences that modify the screen (for example, carriage returns, linefeeds
2744: or backspaces) in one millisecond, it will stop updating the pane immediately and
2745: instead redraw it entirely every
2746: .Ar interval
2747: milliseconds.
2748: This helps to prevent fast output (such as
2749: .Xr yes 1
2750: overwhelming the terminal).
1.284 nicm 2751: The default is a trigger of 250 and an interval of 100.
1.283 nicm 2752: A trigger of zero disables the rate limiting.
1.56 jmc 2753: .Pp
1.1 nicm 2754: .It Ic clock-mode-colour Ar colour
2755: Set clock colour.
1.56 jmc 2756: .Pp
1.1 nicm 2757: .It Xo Ic clock-mode-style
1.56 jmc 2758: .Op Ic 12 | 24
1.1 nicm 2759: .Xc
2760: Set clock hour format.
1.56 jmc 2761: .Pp
1.1 nicm 2762: .It Ic force-height Ar height
2763: .It Ic force-width Ar width
2764: Prevent
2765: .Nm
2766: from resizing a window to greater than
2767: .Ar width
2768: or
2769: .Ar height .
2770: A value of zero restores the default unlimited setting.
1.56 jmc 2771: .Pp
1.196 nicm 2772: .It Ic main-pane-height Ar height
1.2 nicm 2773: .It Ic main-pane-width Ar width
2774: Set the width or height of the main (left or top) pane in the
2775: .Ic main-horizontal
2776: or
2777: .Ic main-vertical
2778: layouts.
1.56 jmc 2779: .Pp
1.1 nicm 2780: .It Ic mode-attr Ar attributes
2781: Set window modes attributes.
1.56 jmc 2782: .Pp
1.1 nicm 2783: .It Ic mode-bg Ar colour
2784: Set window modes background colour.
1.56 jmc 2785: .Pp
1.1 nicm 2786: .It Ic mode-fg Ar colour
2787: Set window modes foreground colour.
1.56 jmc 2788: .Pp
1.1 nicm 2789: .It Xo Ic mode-keys
1.56 jmc 2790: .Op Ic vi | emacs
1.1 nicm 2791: .Xc
1.105 nicm 2792: Use vi or emacs-style key bindings in copy and choice modes.
1.191 nicm 2793: As with the
2794: .Ic status-keys
2795: option, the default is emacs, unless
2796: .Ev VISUAL
2797: or
2798: .Ev EDITOR
2799: contains
2800: .Ql vi .
1.56 jmc 2801: .Pp
1.50 nicm 2802: .It Xo Ic mode-mouse
1.240 nicm 2803: .Op Ic on | off | copy-mode
1.50 nicm 2804: .Xc
1.51 jmc 2805: Mouse state in modes.
1.223 nicm 2806: If on, the mouse may be used to enter copy mode and copy a selection by
2807: dragging, to enter copy mode and scroll with the mouse wheel, or to select an
2808: option in choice mode.
1.240 nicm 2809: If set to
1.241 jmc 2810: .Em copy-mode ,
1.240 nicm 2811: the mouse behaves as set to on, but cannot be used to enter copy
2812: mode.
1.56 jmc 2813: .Pp
1.1 nicm 2814: .It Xo Ic monitor-activity
1.56 jmc 2815: .Op Ic on | off
1.1 nicm 2816: .Xc
2817: Monitor for activity in the window.
2818: Windows with activity are highlighted in the status line.
1.56 jmc 2819: .Pp
2820: .It Ic monitor-content Ar match-string
1.6 jmc 2821: Monitor content in the window.
2822: When
1.16 nicm 2823: .Xr fnmatch 3
2824: pattern
1.1 nicm 2825: .Ar match-string
2826: appears in the window, it is highlighted in the status line.
1.56 jmc 2827: .Pp
1.192 nicm 2828: .It Xo Ic monitor-silence
2829: .Op Ic interval
2830: .Xc
2831: Monitor for silence (no activity) in the window within
2832: .Ic interval
2833: seconds.
2834: Windows that have been silent for the interval are highlighted in the
2835: status line.
2836: An interval of zero disables the monitoring.
1.195 nicm 2837: .Pp
2838: .It Ic other-pane-height Ar height
2839: Set the height of the other panes (not the main pane) in the
2840: .Ic main-horizontal
2841: layout.
2842: If this option is set to 0 (the default), it will have no effect.
2843: If both the
2844: .Ic main-pane-height
2845: and
2846: .Ic other-pane-height
2847: options are set, the main pane will grow taller to make the other panes the
2848: specified height, but will never shrink to do so.
2849: .Pp
2850: .It Ic other-pane-width Ar width
2851: Like
2852: .Ic other-pane-height ,
2853: but set the width of other panes in the
2854: .Ic main-vertical
2855: layout.
1.243 nicm 2856: .Pp
2857: .It Ic pane-base-index Ar index
2858: Like
2859: .Ic base-index ,
2860: but set the starting index for pane numbers.
1.192 nicm 2861: .Pp
1.1 nicm 2862: .It Xo Ic remain-on-exit
1.56 jmc 2863: .Op Ic on | off
1.1 nicm 2864: .Xc
2865: A window with this flag set is not destroyed when the program running in it
2866: exits.
2867: The window may be reactivated with the
2868: .Ic respawn-window
2869: command.
1.56 jmc 2870: .Pp
1.99 nicm 2871: .It Xo Ic synchronize-panes
2872: .Op Ic on | off
2873: .Xc
1.164 nicm 2874: Duplicate input to any pane to all other panes in the same window (only
2875: for panes that are not in any special mode).
1.139 nicm 2876: .Pp
1.1 nicm 2877: .It Xo Ic utf8
1.56 jmc 2878: .Op Ic on | off
1.1 nicm 2879: .Xc
2880: Instructs
2881: .Nm
2882: to expect UTF-8 sequences to appear in this window.
1.56 jmc 2883: .Pp
1.264 nicm 2884: .It Ic window-status-bell-attr Ar attributes
2885: Set status line attributes for windows which have a bell alert.
1.169 nicm 2886: .Pp
1.264 nicm 2887: .It Ic window-status-bell-bg Ar colour
2888: Set status line background colour for windows with a bell alert.
1.169 nicm 2889: .Pp
1.264 nicm 2890: .It Ic window-status-bell-fg Ar colour
2891: Set status line foreground colour for windows with a bell alert.
2892: .Pp
2893: .It Ic window-status-content-attr Ar attributes
2894: Set status line attributes for windows which have a content alert.
2895: .Pp
2896: .It Ic window-status-content-bg Ar colour
2897: Set status line background colour for windows with a content alert.
2898: .Pp
2899: .It Ic window-status-content-fg Ar colour
2900: Set status line foreground colour for windows with a content alert.
2901: .Pp
2902: .It Ic window-status-activity-attr Ar attributes
2903: Set status line attributes for windows which have an activity (or silence) alert.
2904: .Pp
2905: .It Ic window-status-activity-bg Ar colour
2906: Set status line background colour for windows with an activity alert.
2907: .Pp
2908: .It Ic window-status-activity-fg Ar colour
2909: Set status line foreground colour for windows with an activity alert.
1.125 nicm 2910: .Pp
1.239 nicm 2911: .It Ic window-status-attr Ar attributes
2912: Set status line attributes for a single window.
2913: .Pp
2914: .It Ic window-status-bg Ar colour
2915: Set status line background colour for a single window.
2916: .Pp
1.40 nicm 2917: .It Ic window-status-current-attr Ar attributes
2918: Set status line attributes for the currently active window.
1.56 jmc 2919: .Pp
1.40 nicm 2920: .It Ic window-status-current-bg Ar colour
2921: Set status line background colour for the currently active window.
1.56 jmc 2922: .Pp
1.40 nicm 2923: .It Ic window-status-current-fg Ar colour
2924: Set status line foreground colour for the currently active window.
1.56 jmc 2925: .Pp
1.125 nicm 2926: .It Ic window-status-current-format Ar string
2927: Like
2928: .Ar window-status-format ,
2929: but is the format used when the window is the current window.
1.307 nicm 2930: .Pp
2931: .It Ic window-status-last-attr Ar attributes
2932: Set status line attributes for the last active window.
2933: .Pp
2934: .It Ic window-status-last-bg Ar colour
2935: Set status line background colour for the last active window.
2936: .Pp
2937: .It Ic window-status-last-fg Ar colour
2938: Set status line foreground colour for the last active window.
1.239 nicm 2939: .Pp
2940: .It Ic window-status-fg Ar colour
2941: Set status line foreground colour for a single window.
2942: .Pp
2943: .It Ic window-status-format Ar string
2944: Set the format in which the window is displayed in the status line window list.
2945: See the
2946: .Ar status-left
2947: option for details of special character sequences available.
2948: The default is
2949: .Ql #I:#W#F .
1.290 nicm 2950: .Pp
2951: .It Ic window-status-separator Ar string
2952: Sets the separator drawn between windows in the status line.
2953: The default is a single space character.
1.125 nicm 2954: .Pp
1.1 nicm 2955: .It Xo Ic xterm-keys
1.56 jmc 2956: .Op Ic on | off
1.1 nicm 2957: .Xc
2958: If this option is set,
2959: .Nm
2960: will generate
1.57 jmc 2961: .Xr xterm 1 -style
2962: function key sequences; these have a number included to indicate modifiers such
2963: as Shift, Alt or Ctrl.
1.123 nicm 2964: The default is off.
1.282 nicm 2965: .Pp
2966: .It Xo Ic wrap-search
2967: .Op Ic on | off
2968: .Xc
2969: If this option is set, searches will wrap around the end of the pane contents.
2970: The default is on.
1.57 jmc 2971: .El
2972: .It Xo Ic show-options
1.340 nicm 2973: .Op Fl gqsvw
1.129 nicm 2974: .Op Fl t Ar target-session | Ar target-window
1.276 nicm 2975: .Op Ar option
1.57 jmc 2976: .Xc
2977: .D1 (alias: Ic show )
1.276 nicm 2978: Show the window options (or a single window option if given) with
1.129 nicm 2979: .Fl w
1.133 nicm 2980: (equivalent to
1.134 nicm 2981: .Ic show-window-options ) ,
1.133 nicm 2982: the server options with
2983: .Fl s ,
2984: otherwise the session options for
2985: .Ar target session .
2986: Global session or window options are listed if
2987: .Fl g
2988: is used.
1.317 nicm 2989: .Fl v
2990: shows only the option value, not the name.
1.340 nicm 2991: If
2992: .Fl q
2993: is set, no error will be returned if
2994: .Ar option
2995: is unset.
1.57 jmc 2996: .It Xo Ic show-window-options
1.317 nicm 2997: .Op Fl gv
1.57 jmc 2998: .Op Fl t Ar target-window
1.276 nicm 2999: .Op Ar option
1.57 jmc 3000: .Xc
3001: .D1 (alias: Ic showw )
1.276 nicm 3002: List the window options or a single option for
1.57 jmc 3003: .Ar target-window ,
3004: or the global window options if
3005: .Fl g
3006: is used.
1.317 nicm 3007: .Fl v
3008: shows only the option value, not the name.
1.63 nicm 3009: .El
1.245 nicm 3010: .Sh FORMATS
1.294 nicm 3011: Certain commands accept the
1.245 nicm 3012: .Fl F
3013: flag with a
3014: .Ar format
3015: argument.
3016: This is a string which controls the output format of the command.
3017: Replacement variables are enclosed in
3018: .Ql #{
3019: and
3020: .Ql } ,
3021: for example
1.359 nicm 3022: .Ql #{session_name} .
3023: Some variables also have an shorter alias such as
1.245 nicm 3024: .Ql #S .
3025: Conditionals are also accepted by prefixing with
1.246 jmc 3026: .Ql \&?
1.245 nicm 3027: and separating two alternatives with a comma;
3028: if the specified variable exists and is not zero, the first alternative
1.246 jmc 3029: is chosen, otherwise the second is used.
3030: For example
1.245 nicm 3031: .Ql #{?session_attached,attached,not attached}
3032: will include the string
3033: .Ql attached
3034: if the session is attached and the string
3035: .Ql not attached
3036: if it is unattached.
1.367 nicm 3037: A limit may be placed on the length of the resultant string by prefixing it
3038: by an
3039: .Ql = ,
3040: a number and a colon, so
3041: .Ql #{=10:pane_title}
3042: will include at most the first 10 characters of the pane title.
1.245 nicm 3043: .Pp
3044: The following variables are available, where appropriate:
1.359 nicm 3045: .Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX"
3046: .It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with"
3047: .It Li "alternate_on" Ta "" Ta "If pane is in alternate screen"
3048: .It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen"
3049: .It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen"
3050: .It Li "buffer_sample" Ta "" Ta "First 50 characters from buffer"
3051: .It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes"
3052: .It Li "client_activity" Ta "" Ta "Integer time client last had activity"
3053: .It Li "client_activity_string" Ta "" Ta "String time client last had activity"
3054: .It Li "client_created" Ta "" Ta "Integer time client created"
3055: .It Li "client_created_string" Ta "" Ta "String time client created"
3056: .It Li "client_cwd" Ta "" Ta "Working directory of client"
3057: .It Li "client_height" Ta "" Ta "Height of client"
3058: .It Li "client_last_session" Ta "" Ta "Name of the client's last session"
3059: .It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed"
3060: .It Li "client_readonly" Ta "" Ta "1 if client is readonly"
3061: .It Li "client_session" Ta "" Ta "Name of the client's session"
3062: .It Li "client_termname" Ta "" Ta "Terminal name of client"
3063: .It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
3064: .It Li "client_utf8" Ta "" Ta "1 if client supports utf8"
3065: .It Li "client_width" Ta "" Ta "Width of client"
3066: .It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
3067: .It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
3068: .It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"
3069: .It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
3070: .It Li "history_limit" Ta "" Ta "Maximum window history lines"
3071: .It Li "history_size" Ta "" Ta "Size of history in bytes"
3072: .It Li "host" Ta "#H" Ta "Hostname of local host"
3073: .It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)"
3074: .It Li "insert_flag" Ta "" Ta "Pane insert flag"
3075: .It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag"
3076: .It Li "keypad_flag" Ta "" Ta "Pane keypad flag"
3077: .It Li "line" Ta "" Ta "Line number in the list"
3078: .It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag"
3079: .It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag"
3080: .It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
3081: .It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
3082: .It Li "pane_active" Ta "" Ta "1 if active pane"
3083: .It Li "pane_current_command" Ta "" Ta "Current command if available"
3084: .It Li "pane_current_path" Ta "" Ta "Current path if available"
3085: .It Li "pane_dead" Ta "" Ta "1 if pane is dead"
3086: .It Li "pane_height" Ta "" Ta "Height of pane"
3087: .It Li "pane_id" Ta "#D" Ta "Unique pane ID"
3088: .It Li "pane_in_mode" Ta "" Ta "If pane is in a mode"
1.363 nicm 3089: .It Li "pane_synchronized" Ta "" Ta "If pane is synchronized"
1.359 nicm 3090: .It Li "pane_index" Ta "#P" Ta "Index of pane"
3091: .It Li "pane_pid" Ta "" Ta "PID of first process in pane"
3092: .It Li "pane_start_command" Ta "" Ta "Command pane started with"
3093: .It Li "pane_start_path" Ta "" Ta "Path pane started with"
3094: .It Li "pane_tabs" Ta "" Ta "Pane tab positions"
3095: .It Li "pane_title" Ta "#T" Ta "Title of pane"
3096: .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
3097: .It Li "pane_width" Ta "" Ta "Width of pane"
3098: .It Li "saved_cursor_x" Ta "" Ta "Saved cursor X in pane"
3099: .It Li "saved_cursor_y" Ta "" Ta "Saved cursor Y in pane"
3100: .It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
3101: .It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
3102: .It Li "session_attached" Ta "" Ta "1 if session attached"
3103: .It Li "session_created" Ta "" Ta "Integer time session created"
3104: .It Li "session_created_string" Ta "" Ta "String time session created"
3105: .It Li "session_group" Ta "" Ta "Number of session group"
3106: .It Li "session_grouped" Ta "" Ta "1 if session in a group"
3107: .It Li "session_height" Ta "" Ta "Height of session"
3108: .It Li "session_id" Ta "" Ta "Unique session ID"
3109: .It Li "session_name" Ta "#S" Ta "Name of session"
3110: .It Li "session_width" Ta "" Ta "Width of session"
3111: .It Li "session_windows" Ta "" Ta "Number of windows in session"
3112: .It Li "window_active" Ta "" Ta "1 if window active"
1.366 nicm 3113: .It Li "window_activity_flag" Ta "" Ta "1 if window has activity alert"
3114: .It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
3115: .It Li "window_content_flag" Ta "" Ta "1 if window has content alert"
1.359 nicm 3116: .It Li "window_find_matches" Ta "" Ta "Matched data from the find-window"
3117: .It Li "window_flags" Ta "#F" Ta "Window flags"
3118: .It Li "window_height" Ta "" Ta "Height of window"
3119: .It Li "window_id" Ta "" Ta "Unique window ID"
3120: .It Li "window_index" Ta "#I" Ta "Index of window"
3121: .It Li "window_layout" Ta "" Ta "Window layout description"
3122: .It Li "window_name" Ta "#W" Ta "Name of window"
3123: .It Li "window_panes" Ta "" Ta "Number of panes in window"
1.366 nicm 3124: .It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
1.359 nicm 3125: .It Li "window_width" Ta "" Ta "Width of window"
3126: .It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
1.245 nicm 3127: .El
1.261 nicm 3128: .Sh NAMES AND TITLES
3129: .Nm
3130: distinguishes between names and titles.
3131: Windows and sessions have names, which may be used to specify them in targets
3132: and are displayed in the status line and various lists: the name is the
3133: .Nm
3134: identifier for a window or session.
3135: Only panes have titles.
3136: A pane's title is typically set by the program running inside the pane and
3137: is not modified by
3138: .Nm .
3139: It is the same mechanism used to set for example the
3140: .Xr xterm 1
3141: window title in an
3142: .Xr X 7
3143: window manager.
1.268 nicm 3144: Windows themselves do not have titles - a window's title is the title of its
1.261 nicm 3145: active pane.
3146: .Nm
3147: itself may set the title of the terminal in which the client is running, see
3148: the
3149: .Ic set-titles
3150: option.
3151: .Pp
3152: A session's name is set with the
3153: .Ic new-session
3154: and
3155: .Ic rename-session
3156: commands.
3157: A window's name is set with one of:
3158: .Bl -enum -width Ds
3159: .It
3160: A command argument (such as
3161: .Fl n
3162: for
3163: .Ic new-window
3164: or
3165: .Ic new-session ) .
3166: .It
3167: An escape sequence:
3168: .Bd -literal -offset indent
3169: $ printf '\e033kWINDOW_NAME\e033\e\e'
3170: .Ed
3171: .It
3172: Automatic renaming, which sets the name to the active command in the window's
3173: active pane.
3174: See the
3175: .Ic automatic-rename
3176: option.
3177: .El
3178: .Pp
3179: When a pane is first created, its title is the hostname.
3180: A pane's title can be set via the OSC title setting sequence, for example:
3181: .Bd -literal -offset indent
3182: $ printf '\e033]2;My Title\e033\e\e'
3183: .Ed
1.63 nicm 3184: .Sh ENVIRONMENT
3185: When the server is started,
3186: .Nm
3187: copies the environment into the
3188: .Em global environment ;
3189: in addition, each session has a
3190: .Em session environment .
1.193 nicm 3191: When a window is created, the session and global environments are merged.
3192: If a variable exists in both, the value from the session environment is used.
3193: The result is the initial environment passed to the new process.
1.63 nicm 3194: .Pp
3195: The
3196: .Ic update-environment
3197: session option may be used to update the session environment from the client
3198: when a new session is created or an old reattached.
3199: .Nm
3200: also initialises the
3201: .Ev TMUX
3202: variable with some internal information to allow commands to be executed
3203: from inside, and the
3204: .Ev TERM
3205: variable with the correct terminal setting of
3206: .Ql screen .
3207: .Pp
3208: Commands to alter and view the environment are:
3209: .Bl -tag -width Ds
3210: .It Xo Ic set-environment
3211: .Op Fl gru
3212: .Op Fl t Ar target-session
3213: .Ar name Op Ar value
3214: .Xc
1.115 nicm 3215: .D1 (alias: Ic setenv )
1.63 nicm 3216: Set or unset an environment variable.
3217: If
3218: .Fl g
3219: is used, the change is made in the global environment; otherwise, it is applied
3220: to the session environment for
3221: .Ar target-session .
3222: The
3223: .Fl u
3224: flag unsets a variable.
3225: .Fl r
3226: indicates the variable is to be removed from the environment before starting a
3227: new process.
3228: .It Xo Ic show-environment
3229: .Op Fl g
3230: .Op Fl t Ar target-session
1.286 nicm 3231: .Op Ar variable
1.63 nicm 3232: .Xc
1.115 nicm 3233: .D1 (alias: Ic showenv )
1.63 nicm 3234: Display the environment for
3235: .Ar target-session
3236: or the global environment with
3237: .Fl g .
1.286 nicm 3238: If
3239: .Ar variable
3240: is omitted, all variables are shown.
1.63 nicm 3241: Variables removed from the environment are prefixed with
3242: .Ql - .
1.57 jmc 3243: .El
3244: .Sh STATUS LINE
3245: .Nm
3246: includes an optional status line which is displayed in the bottom line of each
3247: terminal.
3248: By default, the status line is enabled (it may be disabled with the
3249: .Ic status
3250: session option) and contains, from left-to-right: the name of the current
1.261 nicm 3251: session in square brackets; the window list; the title of the active pane
3252: in double quotes; and the time and date.
1.57 jmc 3253: .Pp
3254: The status line is made of three parts: configurable left and right sections
3255: (which may contain dynamic content such as the time or output from a shell
3256: command, see the
3257: .Ic status-left ,
3258: .Ic status-left-length ,
3259: .Ic status-right ,
3260: and
3261: .Ic status-right-length
3262: options below), and a central window list.
1.125 nicm 3263: By default, the window list shows the index, name and (if any) flag of the
3264: windows present in the current session in ascending numerical order.
3265: It may be customised with the
3266: .Ar window-status-format
3267: and
3268: .Ar window-status-current-format
3269: options.
1.57 jmc 3270: The flag is one of the following symbols appended to the window name:
3271: .Bl -column "Symbol" "Meaning" -offset indent
3272: .It Sy "Symbol" Ta Sy "Meaning"
3273: .It Li "*" Ta "Denotes the current window."
3274: .It Li "-" Ta "Marks the last window (previously selected)."
3275: .It Li "#" Ta "Window is monitored and activity has been detected."
3276: .It Li "!" Ta "A bell has occurred in the window."
3277: .It Li "+" Ta "Window is monitored for content and it has appeared."
1.192 nicm 3278: .It Li "~" Ta "The window has been silent for the monitor-silence interval."
1.349 nicm 3279: .It Li "Z" Ta "The window's active pane is zoomed."
1.57 jmc 3280: .El
3281: .Pp
3282: The # symbol relates to the
3283: .Ic monitor-activity
3284: and + to the
3285: .Ic monitor-content
3286: window options.
3287: The window name is printed in inverted colours if an alert (bell, activity or
3288: content) is present.
3289: .Pp
1.131 nicm 3290: The colour and attributes of the status line may be configured, the entire
3291: status line using the
1.57 jmc 3292: .Ic status-attr ,
3293: .Ic status-fg
3294: and
3295: .Ic status-bg
3296: session options and individual windows using the
3297: .Ic window-status-attr ,
3298: .Ic window-status-fg
3299: and
3300: .Ic window-status-bg
3301: window options.
3302: .Pp
1.131 nicm 3303: The status line is automatically refreshed at interval if it has changed, the
3304: interval may be controlled with the
1.57 jmc 3305: .Ic status-interval
3306: session option.
3307: .Pp
3308: Commands related to the status line are as follows:
3309: .Bl -tag -width Ds
3310: .It Xo Ic command-prompt
1.235 nicm 3311: .Op Fl I Ar inputs
1.73 nicm 3312: .Op Fl p Ar prompts
1.57 jmc 3313: .Op Fl t Ar target-client
3314: .Op Ar template
3315: .Xc
3316: Open the command prompt in a client.
3317: This may be used from inside
3318: .Nm
3319: to execute commands interactively.
1.231 nicm 3320: .Pp
1.57 jmc 3321: If
3322: .Ar template
1.73 nicm 3323: is specified, it is used as the command.
1.235 nicm 3324: If present,
3325: .Fl I
3326: is a comma-separated list of the initial text for each prompt.
1.73 nicm 3327: If
3328: .Fl p
3329: is given,
3330: .Ar prompts
3331: is a comma-separated list of prompts which are displayed in order; otherwise
3332: a single prompt is displayed, constructed from
3333: .Ar template
3334: if it is present, or
3335: .Ql \&:
3336: if not.
1.235 nicm 3337: .Pp
3338: Both
3339: .Ar inputs
3340: and
1.231 nicm 3341: .Ar prompts
3342: may contain the special character sequences supported by the
3343: .Ic status-left
3344: option.
3345: .Pp
1.73 nicm 3346: Before the command is executed, the first occurrence of the string
3347: .Ql %%
1.74 jmc 3348: and all occurrences of
1.73 nicm 3349: .Ql %1
3350: are replaced by the response to the first prompt, the second
3351: .Ql %%
3352: and all
3353: .Ql %2
3354: are replaced with the response to the second prompt, and so on for further
1.74 jmc 3355: prompts.
3356: Up to nine prompt responses may be replaced
3357: .Po
3358: .Ql %1
1.73 nicm 3359: to
1.74 jmc 3360: .Ql %9
3361: .Pc .
1.57 jmc 3362: .It Xo Ic confirm-before
1.238 nicm 3363: .Op Fl p Ar prompt
1.57 jmc 3364: .Op Fl t Ar target-client
3365: .Ar command
3366: .Xc
3367: .D1 (alias: Ic confirm )
3368: Ask for confirmation before executing
3369: .Ar command .
1.238 nicm 3370: If
3371: .Fl p
3372: is given,
3373: .Ar prompt
3374: is the prompt to display; otherwise a prompt is constructed from
3375: .Ar command .
3376: It may contain the special character sequences supported by the
3377: .Ic status-left
3378: option.
3379: .Pp
1.57 jmc 3380: This command works only from inside
3381: .Nm .
3382: .It Xo Ic display-message
1.127 nicm 3383: .Op Fl p
1.215 nicm 3384: .Op Fl c Ar target-client
3385: .Op Fl t Ar target-pane
1.57 jmc 3386: .Op Ar message
3387: .Xc
3388: .D1 (alias: Ic display )
1.127 nicm 3389: Display a message.
3390: If
3391: .Fl p
3392: is given, the output is printed to stdout, otherwise it is displayed in the
3393: .Ar target-client
3394: status line.
1.122 nicm 3395: The format of
1.124 jmc 3396: .Ar message
1.275 nicm 3397: is described in the
3398: .Sx FORMATS
3399: section; information is taken from
1.215 nicm 3400: .Ar target-pane
3401: if
3402: .Fl t
3403: is given, otherwise the active pane for the session attached to
3404: .Ar target-client .
1.57 jmc 3405: .El
3406: .Sh BUFFERS
3407: .Nm
3408: maintains a stack of
1.199 nicm 3409: .Em paste buffers .
1.57 jmc 3410: Up to the value of the
3411: .Ic buffer-limit
3412: option are kept; when a new buffer is added, the buffer at the bottom of the
3413: stack is removed.
3414: Buffers may be added using
3415: .Ic copy-mode
3416: or the
3417: .Ic set-buffer
3418: command, and pasted into a window using the
3419: .Ic paste-buffer
3420: command.
3421: .Pp
3422: A configurable history buffer is also maintained for each window.
3423: By default, up to 2000 lines are kept; this can be altered with the
3424: .Ic history-limit
3425: option (see the
3426: .Ic set-option
3427: command above).
3428: .Pp
3429: The buffer commands are as follows:
3430: .Bl -tag -width Ds
1.178 nicm 3431: .It Xo
3432: .Ic choose-buffer
1.294 nicm 3433: .Op Fl F Ar format
1.178 nicm 3434: .Op Fl t Ar target-window
3435: .Op Ar template
3436: .Xc
3437: Put a window into buffer choice mode, where a buffer may be chosen
3438: interactively from a list.
3439: After a buffer is selected,
3440: .Ql %%
3441: is replaced by the buffer index in
3442: .Ar template
3443: and the result executed as a command.
3444: If
3445: .Ar template
3446: is not given, "paste-buffer -b '%%'" is used.
1.294 nicm 3447: For the meaning of the
3448: .Fl F
3449: flag, see the
3450: .Sx FORMATS
3451: section.
1.314 nicm 3452: This command works only if at least one client is attached.
1.57 jmc 3453: .It Ic clear-history Op Fl t Ar target-pane
3454: .D1 (alias: Ic clearhist )
3455: Remove and free the history for the specified pane.
1.198 nicm 3456: .It Ic delete-buffer Op Fl b Ar buffer-index
1.57 jmc 3457: .D1 (alias: Ic deleteb )
3458: Delete the buffer at
3459: .Ar buffer-index ,
3460: or the top buffer if not specified.
1.294 nicm 3461: .It Xo Ic list-buffers
3462: .Op Fl F Ar format
3463: .Xc
1.57 jmc 3464: .D1 (alias: Ic lsb )
1.198 nicm 3465: List the global buffers.
1.294 nicm 3466: For the meaning of the
3467: .Fl F
3468: flag, see the
3469: .Sx FORMATS
3470: section.
1.200 jmc 3471: .It Xo Ic load-buffer
1.57 jmc 3472: .Op Fl b Ar buffer-index
3473: .Ar path
3474: .Xc
3475: .D1 (alias: Ic loadb )
3476: Load the contents of the specified paste buffer from
3477: .Ar path .
3478: .It Xo Ic paste-buffer
1.278 nicm 3479: .Op Fl dpr
1.57 jmc 3480: .Op Fl b Ar buffer-index
1.170 nicm 3481: .Op Fl s Ar separator
1.158 nicm 3482: .Op Fl t Ar target-pane
1.57 jmc 3483: .Xc
3484: .D1 (alias: Ic pasteb )
1.158 nicm 3485: Insert the contents of a paste buffer into the specified pane.
3486: If not specified, paste into the current one.
1.57 jmc 3487: With
3488: .Fl d ,
3489: also delete the paste buffer from the stack.
3490: When output, any linefeed (LF) characters in the paste buffer are replaced with
1.170 nicm 3491: a separator, by default carriage return (CR).
3492: A custom separator may be specified using the
3493: .Fl s
3494: flag.
3495: The
1.57 jmc 3496: .Fl r
1.170 nicm 3497: flag means to do no replacement (equivalent to a separator of LF).
1.278 nicm 3498: If
3499: .Fl p
3500: is specified, paste bracket control codes are inserted around the
3501: buffer if the application has requested bracketed paste mode.
1.57 jmc 3502: .It Xo Ic save-buffer
3503: .Op Fl a
3504: .Op Fl b Ar buffer-index
3505: .Ar path
3506: .Xc
3507: .D1 (alias: Ic saveb )
3508: Save the contents of the specified paste buffer to
3509: .Ar path .
3510: The
3511: .Fl a
3512: option appends to rather than overwriting the file.
3513: .It Xo Ic set-buffer
3514: .Op Fl b Ar buffer-index
3515: .Ar data
3516: .Xc
3517: .D1 (alias: Ic setb )
3518: Set the contents of the specified buffer to
3519: .Ar data .
1.1 nicm 3520: .It Xo Ic show-buffer
3521: .Op Fl b Ar buffer-index
3522: .Xc
3523: .D1 (alias: Ic showb )
3524: Display the contents of the specified buffer.
1.57 jmc 3525: .El
3526: .Sh MISCELLANEOUS
3527: Miscellaneous commands are as follows:
3528: .Bl -tag -width Ds
1.72 nicm 3529: .It Ic clock-mode Op Fl t Ar target-pane
1.57 jmc 3530: Display a large clock.
1.334 nicm 3531: .It Xo Ic if-shell
1.352 nicm 3532: .Op Fl b
1.334 nicm 3533: .Op Fl t Ar target-pane
3534: .Ar shell-command command
3535: .Op Ar command
3536: .Xc
1.57 jmc 3537: .D1 (alias: Ic if )
1.251 nicm 3538: Execute the first
1.57 jmc 3539: .Ar command
3540: if
3541: .Ar shell-command
1.251 nicm 3542: returns success or the second
3543: .Ar command
3544: otherwise.
1.334 nicm 3545: Before being executed, shell-command is expanded using the rules specified in the
3546: .Sx FORMATS
3547: section, including those relevant to
3548: .Ar target-pane .
1.335 nicm 3549: With
3550: .Fl b ,
3551: .Ar shell-command
3552: is run in the background.
1.57 jmc 3553: .It Ic lock-server
3554: .D1 (alias: Ic lock )
1.90 nicm 3555: Lock each client individually by running the command specified by the
3556: .Ic lock-command
3557: option.
1.308 nicm 3558: .It Xo Ic run-shell
1.357 nicm 3559: .Op Fl b
1.308 nicm 3560: .Op Fl t Ar target-pane
3561: .Ar shell-command
3562: .Xc
1.87 nicm 3563: .D1 (alias: Ic run )
3564: Execute
1.153 nicm 3565: .Ar shell-command
1.106 nicm 3566: in the background without creating a window.
1.334 nicm 3567: Before being executed, shell-command is expanded using the rules specified in
3568: the
3569: .Sx FORMATS
3570: section.
1.335 nicm 3571: With
3572: .Fl b ,
3573: the command is run in the background.
1.308 nicm 3574: After it finishes, any output to stdout is displayed in copy mode (in the pane
3575: specified by
3576: .Fl t
3577: or the current pane if omitted).
1.153 nicm 3578: If the command doesn't return success, the exit status is also displayed.
1.57 jmc 3579: .It Ic server-info
3580: .D1 (alias: Ic info )
3581: Show server information and terminal details.
1.342 nicm 3582: .It Xo Ic wait-for
1.343 nicm 3583: .Fl LSU
1.342 nicm 3584: .Ar channel
3585: .Xc
3586: .D1 (alias: Ic wait )
1.343 nicm 3587: When used without options, prevents the client from exiting until woken using
1.342 nicm 3588: .Ic wait-for
3589: .Fl S
3590: with the same channel.
1.343 nicm 3591: When
3592: .Fl L
3593: is used, the channel is locked and any clients that try to lock the same
3594: channel are made to wait until the channel is unlocked with
3595: .Ic wait-for
3596: .Fl U .
1.342 nicm 3597: This command only works from outside
3598: .Nm .
1.228 nicm 3599: .El
3600: .Sh TERMINFO EXTENSIONS
3601: .Nm
3602: understands some extensions to
3603: .Xr terminfo 5 :
3604: .Bl -tag -width Ds
1.360 nicm 3605: .It Em Cs , Cr
1.233 nicm 3606: Set the cursor colour.
1.232 jmc 3607: The first takes a single string argument and is used to set the colour;
3608: the second takes no arguments and restores the default cursor colour.
3609: If set, a sequence such as this may be used
3610: to change the cursor colour from inside
3611: .Nm :
3612: .Bd -literal -offset indent
3613: $ printf '\e033]12;red\e033\e\e'
3614: .Ed
1.361 jmc 3615: .It Em \&Ss , Se
1.230 nicm 3616: Change the cursor style.
1.232 jmc 3617: If set, a sequence such as this may be used
3618: to change the cursor to an underline:
1.230 nicm 3619: .Bd -literal -offset indent
3620: $ printf '\e033[4 q'
3621: .Ed
3622: .Pp
3623: If
3624: .Em Csr
3625: is set, it will be used to reset the cursor style instead
3626: of
3627: .Em Cs .
1.232 jmc 3628: .It Em \&Ms
3629: This sequence can be used by
3630: .Nm
3631: to store the current buffer in the host terminal's selection (clipboard).
3632: See the
3633: .Em set-clipboard
3634: option above and the
3635: .Xr xterm 1
3636: man page.
1.345 nicm 3637: .El
3638: .Sh CONTROL MODE
3639: .Nm
3640: offers a textual interface called
3641: .Em control mode .
3642: This allows applications to communicate with
3643: .Nm
3644: using a simple text-only protocol.
3645: .Pp
3646: In control mode, a client sends
3647: .Nm
3648: commands or command sequences terminated by newlines on standard input.
3649: Each command will produce one block of output on standard output.
3650: An output block consists of a
3651: .Em %begin
3652: line followed by the output (which may be empty).
3653: The output block ends with a
3654: .Em %end
3655: or
3656: .Em %error .
3657: .Em %begin
3658: and matching
3659: .Em %end
3660: or
3661: .Em %error
3662: have two arguments: an integer time (as seconds from epoch) and command number.
3663: For example:
3664: .Bd -literal -offset indent
3665: %begin 1363006971 2
3666: 0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
3667: %end 1363006971 2
3668: .Ed
3669: .Pp
3670: In control mode,
3671: .Nm
3672: outputs notifications.
3673: A notification will never occur inside an output block.
3674: .Pp
3675: The following notifications are defined:
3676: .Bl -tag -width Ds
3677: .It Ic %exit Op Ar reason
3678: The
3679: .Nm
3680: client is exiting immediately, either because it is not attached to any session
3681: or an error occurred.
3682: If present,
3683: .Ar reason
3684: describes why the client exited.
3685: .It Ic %layout-change Ar window-id Ar window-layout
3686: The layout of a window with ID
3687: .Ar window-id
3688: changed.
3689: The new layout is
3690: .Ar window-layout .
1.347 nicm 3691: .It Ic %output Ar pane-id Ar value
3692: A window pane produced output.
1.345 nicm 3693: .Ar value
1.350 nicm 3694: escapes non-printable characters and backslash as octal \\xxx.
1.345 nicm 3695: .It Ic %session-changed Ar session-id Ar name
3696: The client is now attached to the session with ID
3697: .Ar session-id ,
3698: which is named
3699: .Ar name .
3700: .It Ic %session-renamed Ar name
3701: The current session was renamed to
3702: .Ar name .
3703: .It Ic %sessions-changed
3704: A session was created or destroyed.
3705: .It Ic %unlinked-window-add Ar window-id
3706: The window with ID
3707: .Ar window-id
3708: was created but is not linked to the current session.
3709: .It Ic %window-add Ar window-id
3710: The window with ID
3711: .Ar window-id
3712: was linked to the current session.
3713: .It Ic %window-close Ar window-id
3714: The window with ID
3715: .Ar window-id
3716: closed.
3717: .It Ic %window-renamed Ar window-id Ar name
3718: The window with ID
3719: .Ar window-id
3720: was renamed to
3721: .Ar name .
1.1 nicm 3722: .El
3723: .Sh FILES
1.26 nicm 3724: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1 nicm 3725: .It Pa ~/.tmux.conf
1.6 jmc 3726: Default
1.1 nicm 3727: .Nm
1.6 jmc 3728: configuration file.
1.26 nicm 3729: .It Pa /etc/tmux.conf
3730: System-wide configuration file.
1.1 nicm 3731: .El
1.57 jmc 3732: .Sh EXAMPLES
3733: To create a new
3734: .Nm
3735: session running
3736: .Xr vi 1 :
3737: .Pp
3738: .Dl $ tmux new-session vi
3739: .Pp
3740: Most commands have a shorter form, known as an alias.
3741: For new-session, this is
3742: .Ic new :
3743: .Pp
3744: .Dl $ tmux new vi
3745: .Pp
3746: Alternatively, the shortest unambiguous form of a command is accepted.
3747: If there are several options, they are listed:
3748: .Bd -literal -offset indent
3749: $ tmux n
3750: ambiguous command: n, could be: new-session, new-window, next-window
3751: .Ed
3752: .Pp
3753: Within an active session, a new window may be created by typing
3754: .Ql C-b c
3755: (Ctrl
3756: followed by the
3757: .Ql b
3758: key
3759: followed by the
3760: .Ql c
3761: key).
3762: .Pp
3763: Windows may be navigated with:
3764: .Ql C-b 0
3765: (to select window 0),
3766: .Ql C-b 1
3767: (to select window 1), and so on;
3768: .Ql C-b n
3769: to select the next window; and
3770: .Ql C-b p
3771: to select the previous window.
3772: .Pp
3773: A session may be detached using
3774: .Ql C-b d
1.64 nicm 3775: (or by an external event such as
3776: .Xr ssh 1
3777: disconnection) and reattached with:
1.57 jmc 3778: .Pp
3779: .Dl $ tmux attach-session
3780: .Pp
3781: Typing
3782: .Ql C-b \&?
3783: lists the current key bindings in the current window; up and down may be used
3784: to navigate the list or
3785: .Ql q
3786: to exit from it.
3787: .Pp
3788: Commands to be run when the
3789: .Nm
3790: server is started may be placed in the
3791: .Pa ~/.tmux.conf
3792: configuration file.
3793: Common examples include:
3794: .Pp
3795: Changing the default prefix key:
3796: .Bd -literal -offset indent
3797: set-option -g prefix C-a
3798: unbind-key C-b
3799: bind-key C-a send-prefix
3800: .Ed
3801: .Pp
3802: Turning the status line off, or changing its colour:
3803: .Bd -literal -offset indent
3804: set-option -g status off
3805: set-option -g status-bg blue
3806: .Ed
3807: .Pp
3808: Setting other options, such as the default command,
3809: or locking after 30 minutes of inactivity:
3810: .Bd -literal -offset indent
3811: set-option -g default-command "exec /bin/ksh"
3812: set-option -g lock-after-time 1800
3813: .Ed
3814: .Pp
3815: Creating new key bindings:
3816: .Bd -literal -offset indent
3817: bind-key b set-option status
3818: bind-key / command-prompt "split-window 'exec man %%'"
1.73 nicm 3819: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57 jmc 3820: .Ed
1.1 nicm 3821: .Sh SEE ALSO
3822: .Xr pty 4
3823: .Sh AUTHORS
1.364 schwarze 3824: .An Nicholas Marriott Aq Mt nicm@users.sourceforge.net