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