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