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