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