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