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