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