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