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