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