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