Annotation of src/usr.bin/tmux/tmux.1, Revision 1.707
1.707 ! nicm 1: .\" $OpenBSD: tmux.1,v 1.706 2020/01/27 08:53:13 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.707 ! nicm 17: .Dd $Mdocdate: January 27 2020 $
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.644 schwarze 179: Write UTF-8 output to the terminal even if the first environment
180: variable of
1.14 nicm 181: .Ev LC_ALL ,
1.644 schwarze 182: .Ev LC_CTYPE ,
183: or
1.2 nicm 184: .Ev LANG
1.644 schwarze 185: that is set does not contain
186: .Qq UTF-8
187: or
188: .Qq UTF8 .
1.1 nicm 189: .It Fl v
190: Request verbose logging.
191: Log messages will be saved into
192: .Pa tmux-client-PID.log
193: and
194: .Pa tmux-server-PID.log
195: files in the current directory, where
196: .Em PID
1.6 jmc 197: is the PID of the server or client process.
1.558 nicm 198: If
199: .Fl v
200: is specified twice, an additional
201: .Pa tmux-out-PID.log
202: file is generated with a copy of everything
203: .Nm
204: writes to the terminal.
205: .Pp
206: The
207: .Dv SIGUSR2
208: signal may be sent to the
209: .Nm
210: server process to toggle logging between on (as if
211: .Fl v
212: was given) and off.
1.1 nicm 213: .It Ar command Op Ar flags
214: This specifies one of a set of commands used to control
215: .Nm ,
1.6 jmc 216: as described in the following sections.
1.59 jmc 217: If no commands are specified, the
1.1 nicm 218: .Ic new-session
219: command is assumed.
1.57 jmc 220: .El
1.627 nicm 221: .Sh DEFAULT KEY BINDINGS
1.64 nicm 222: .Nm
223: may be controlled from an attached client by using a key combination of a
224: prefix key,
225: .Ql C-b
226: (Ctrl-b) by default, followed by a command key.
227: .Pp
1.172 nicm 228: The default command key bindings are:
1.64 nicm 229: .Pp
1.171 nicm 230: .Bl -tag -width "XXXXXXXXXX" -offset indent -compact
231: .It C-b
232: Send the prefix key (C-b) through to the application.
233: .It C-o
234: Rotate the panes in the current window forwards.
235: .It C-z
236: Suspend the
237: .Nm
238: client.
239: .It !
240: Break the current pane out of the window.
241: .It \&"
1.625 nicm 242: .\" "
1.171 nicm 243: Split the current pane into two, top and bottom.
244: .It #
245: List all paste buffers.
1.236 nicm 246: .It $
247: Rename the current session.
1.171 nicm 248: .It %
249: Split the current pane into two, left and right.
250: .It &
251: Kill the current window.
252: .It '
253: Prompt for a window index to select.
1.412 nicm 254: .It \&(
255: Switch the attached client to the previous session.
256: .It \&)
257: Switch the attached client to the next session.
1.171 nicm 258: .It ,
259: Rename the current window.
260: .It -
261: Delete the most recently copied buffer of text.
262: .It .
263: Prompt for an index to move the current window.
264: .It 0 to 9
265: Select windows 0 to 9.
266: .It :
267: Enter the
268: .Nm
269: command prompt.
1.187 nicm 270: .It ;
271: Move to the previously active pane.
1.178 nicm 272: .It =
273: Choose which buffer to paste interactively from a list.
1.171 nicm 274: .It \&?
275: List all key bindings.
276: .It D
277: Choose a client to detach.
1.412 nicm 278: .It L
279: Switch the attached client back to the last session.
1.182 jmc 280: .It \&[
1.171 nicm 281: Enter copy mode to copy text or view the history.
1.182 jmc 282: .It \&]
1.171 nicm 283: Paste the most recently copied buffer of text.
1.64 nicm 284: .It c
1.65 nicm 285: Create a new window.
1.64 nicm 286: .It d
1.65 nicm 287: Detach the current client.
1.171 nicm 288: .It f
289: Prompt to search for text in open windows.
290: .It i
291: Display some information about the current window.
1.64 nicm 292: .It l
1.65 nicm 293: Move to the previously selected window.
1.684 nicm 294: .It m
295: Mark the current pane (see
296: .Ic select-pane
297: .Fl m ) .
298: .It M
299: Clear the marked pane.
1.64 nicm 300: .It n
1.65 nicm 301: Change to the next window.
1.171 nicm 302: .It o
303: Select the next pane in the current window.
1.64 nicm 304: .It p
1.65 nicm 305: Change to the previous window.
1.171 nicm 306: .It q
307: Briefly display pane indexes.
308: .It r
309: Force redraw of the attached client.
310: .It s
311: Select a new session for the attached client interactively.
312: .It t
313: Show the time.
314: .It w
315: Choose the current window interactively.
316: .It x
317: Kill the current pane.
1.412 nicm 318: .It z
319: Toggle zoom state of the current pane.
1.171 nicm 320: .It {
321: Swap the current pane with the previous pane.
322: .It }
323: Swap the current pane with the next pane.
324: .It ~
325: Show previous messages from
326: .Nm ,
327: if any.
328: .It Page Up
329: Enter copy mode and scroll one page up.
330: .It Up, Down
331: .It Left, Right
332: Change to the pane above, below, to the left, or to the right of the current
333: pane.
334: .It M-1 to M-5
335: Arrange panes in one of the five preset layouts: even-horizontal,
336: even-vertical, main-horizontal, main-vertical, or tiled.
1.412 nicm 337: .It Space
338: Arrange the current window in the next preset layout.
1.171 nicm 339: .It M-n
340: Move to the next window with a bell or activity marker.
341: .It M-o
342: Rotate the panes in the current window backwards.
343: .It M-p
344: Move to the previous window with a bell or activity marker.
345: .It C-Up, C-Down
346: .It C-Left, C-Right
347: Resize the current pane in steps of one cell.
348: .It M-Up, M-Down
349: .It M-Left, M-Right
350: Resize the current pane in steps of five cells.
1.64 nicm 351: .El
352: .Pp
353: Key bindings may be changed with the
354: .Ic bind-key
355: and
356: .Ic unbind-key
357: commands.
1.651 nicm 358: .Sh COMMAND PARSING AND EXECUTION
359: .Nm
360: supports a large number of commands which can be used to control its
361: behaviour.
362: Each command is named and can accept zero or more flags and arguments.
363: They may be bound to a key with the
364: .Ic bind-key
365: command or run from the shell prompt, a shell script, a configuration file or
366: the command prompt.
367: For example, the same
368: .Ic set-option
369: command run from the shell prompt, from
370: .Pa ~/.tmux.conf
371: and bound to a key may look like:
372: .Bd -literal -offset indent
373: $ tmux set-option -g status-style bg=cyan
374:
375: set-option -g status-style bg=cyan
376:
377: bind-key C set-option -g status-style bg=cyan
378: .Ed
379: .Pp
380: Here, the command name is
381: .Ql set-option ,
382: .Ql Fl g
383: is a flag and
384: .Ql status-style
385: and
386: .Ql bg=cyan
387: are arguments.
388: .Pp
389: .Nm
390: distinguishes between command parsing and execution.
391: In order to execute a command,
392: .Nm
393: needs it to be split up into its name and arguments.
394: This is command parsing.
395: If a command is run from the shell, the shell parses it; from inside
396: .Nm
397: or from a configuration file,
398: .Nm
399: does.
400: Examples of when
401: .Nm
402: parses commands are:
403: .Bl -dash -offset indent
404: .It
405: in a configuration file;
406: .It
407: typed at the command prompt (see
408: .Ic command-prompt ) ;
409: .It
410: given to
411: .Ic bind-key ;
412: .It
413: passed as arguments to
414: .Ic if-shell
415: or
416: .Ic confirm-before .
417: .El
418: .Pp
419: To execute commands, each client has a
420: .Ql command queue .
421: A global command queue not attached to any client is used on startup
422: for configuration files like
423: .Pa ~/.tmux.conf .
424: Parsed commands added to the queue are executed in order.
425: Some commands, like
426: .Ic if-shell
427: and
428: .Ic confirm-before ,
429: parse their argument to create a new command which is inserted immediately
430: after themselves.
431: This means that arguments can be parsed twice or more - once when the parent command (such as
432: .Ic if-shell )
433: is parsed and again when it parses and executes its command.
434: Commands like
435: .Ic if-shell ,
436: .Ic run-shell
437: and
438: .Ic display-panes
439: stop execution of subsequent commands on the queue until something happens -
440: .Ic if-shell
441: and
442: .Ic run-shell
443: until a shell command finishes and
444: .Ic display-panes
445: until a key is pressed.
446: For example, the following commands:
447: .Bd -literal -offset indent
448: new-session; new-window
449: if-shell "true" "split-window"
450: kill-session
451: .Ed
452: .Pp
453: Will execute
454: .Ic new-session ,
455: .Ic new-window ,
456: .Ic if-shell ,
457: the shell command
458: .Xr true 1 ,
1.671 nicm 459: .Ic split-window
1.651 nicm 460: and
461: .Ic kill-session
462: in that order.
463: .Pp
464: The
465: .Sx COMMANDS
466: section lists the
467: .Nm
468: commands and their arguments.
469: .Sh PARSING SYNTAX
470: This section describes the syntax of commands parsed by
471: .Nm ,
472: for example in a configuration file or at the command prompt.
1.671 nicm 473: Note that when commands are entered into the shell, they are parsed by the shell
1.651 nicm 474: - see for example
475: .Xr ksh 1
476: or
477: .Xr csh 1 .
478: .Pp
479: Each command is terminated by a newline or a semicolon (;).
480: Commands separated by semicolons together form a
481: .Ql command sequence
482: - if a command in the sequence encounters an error, no subsequent commands are
483: executed.
484: .Pp
485: Comments are marked by the unquoted # character - any remaining text after a
486: comment is ignored until the end of the line.
487: .Pp
488: If the last character of a line is \e, the line is joined with the following
489: line (the \e and the newline are completely removed).
490: This is called line continuation and applies both inside and outside quoted
1.656 nicm 491: strings and in comments, but not inside braces.
1.651 nicm 492: .Pp
1.655 nicm 493: Command arguments may be specified as strings surrounded by single (') quotes,
494: double quotes (") or braces ({}).
1.651 nicm 495: .\" "
496: This is required when the argument contains any special character.
1.655 nicm 497: Single and double quoted strings cannot span multiple lines except with line
498: continuation.
499: Braces can span multiple lines.
1.651 nicm 500: .Pp
501: Outside of quotes and inside double quotes, these replacements are performed:
502: .Bl -dash -offset indent
503: .It
504: Environment variables preceded by $ are replaced with their value from the
505: global environment (see the
506: .Sx GLOBAL AND SESSION ENVIRONMENT
507: section).
508: .It
509: A leading ~ or ~user is expanded to the home directory of the current or
510: specified user.
511: .It
512: \euXXXX or \euXXXXXXXX is replaced by the Unicode codepoint corresponding to
513: the given four or eight digit hexadecimal number.
514: .It
515: When preceded (escaped) by a \e, the following characters are replaced: \ee by
516: the escape character; \er by a carriage return; \en by a newline; and \et by a
517: tab.
1.660 nicm 518: .It
519: \eooo is replaced by a character of the octal value ooo.
520: Three octal digits are required, for example \e001.
521: The largest valid character is \e377.
522: .It
1.651 nicm 523: Any other characters preceded by \e are replaced by themselves (that is, the \e
524: is removed) and are not treated as having any special meaning - so for example
525: \e; will not mark a command sequence and \e$ will not expand an environment
526: variable.
527: .El
528: .Pp
1.655 nicm 529: Braces are similar to single quotes in that the text inside is taken literally
1.656 nicm 530: without any replacements but this also includes line continuation.
531: Braces can span multiple lines in which case a literal newline is included in the
532: string.
1.655 nicm 533: They are designed to avoid the need for additional escaping when passing a group
534: of
535: .Nm
536: or shell commands as an argument (for example to
537: .Ic if-shell
538: or
539: .Ic pipe-pane ) .
540: These two examples produce an identical command - note that no escaping is
541: needed when using {}:
542: .Bd -literal -offset indent
543: if-shell true {
544: display -p 'brace-dollar-foo: }$foo'
545: }
546:
547: if-shell true "\en display -p 'brace-dollar-foo: }\e$foo'\en"
548: .Ed
549: .Pp
550: Braces may be enclosed inside braces, for example:
551: .Bd -literal -offset indent
552: bind x if-shell "true" {
553: if-shell "true" {
1.706 nicm 554: display "true!"
1.655 nicm 555: }
556: }
557: .Ed
558: .Pp
1.651 nicm 559: Environment variables may be set by using the syntax
560: .Ql name=value ,
561: for example
562: .Ql HOME=/home/user .
563: Variables set during parsing are added to the global environment.
564: .Pp
565: Commands may be parsed conditionally by surrounding them with
566: .Ql %if ,
567: .Ql %elif ,
568: .Ql %else
569: and
570: .Ql %endif .
571: The argument to
572: .Ql %if
573: and
574: .Ql %elif
575: is expanded as a format (see
576: .Sx FORMATS )
577: and if it evaluates to false (zero or empty), subsequent text is ignored until
578: the closing
579: .Ql %elif ,
580: .Ql %else
581: or
582: .Ql %endif .
583: For example:
584: .Bd -literal -offset indent
1.666 nicm 585: %if "#{==:#{host},myhost}"
1.651 nicm 586: set -g status-style bg=red
1.666 nicm 587: %elif "#{==:#{host},myotherhost}"
1.651 nicm 588: set -g status-style bg=green
589: %else
590: set -g status-style bg=blue
591: %endif
592: .Ed
593: .Pp
594: Will change the status line to red if running on
595: .Ql myhost ,
596: green if running on
597: .Ql myotherhost ,
598: or blue if running on another host.
599: Conditionals may be given on one line, for example:
600: .Bd -literal -offset indent
601: %if #{==:#{host},myhost} set -g status-style bg=red %endif
602: .Ed
1.57 jmc 603: .Sh COMMANDS
1.651 nicm 604: This section describes the commands supported by
1.57 jmc 605: .Nm .
606: Most commands accept the optional
607: .Fl t
1.432 nicm 608: (and sometimes
609: .Fl s )
1.57 jmc 610: argument with one of
611: .Ar target-client ,
1.678 nicm 612: .Ar target-session ,
1.57 jmc 613: .Ar target-window ,
614: or
615: .Ar target-pane .
616: These specify the client, session, window or pane which a command should affect.
1.423 nicm 617: .Pp
1.57 jmc 618: .Ar target-client
1.540 nicm 619: should be the name of the client,
620: typically the
1.57 jmc 621: .Xr pty 4
622: file to which the client is connected, for example either of
623: .Pa /dev/ttyp1
624: or
625: .Pa ttyp1
626: for the client attached to
627: .Pa /dev/ttyp1 .
1.423 nicm 628: If no client is specified,
629: .Nm
630: attempts to work out the client currently in use; if that fails, an error is
631: reported.
1.57 jmc 632: Clients may be listed with the
633: .Ic list-clients
634: command.
1.1 nicm 635: .Pp
1.57 jmc 636: .Ar target-session
1.423 nicm 637: is tried as, in order:
638: .Bl -enum -offset Ds
639: .It
640: A session ID prefixed with a $.
641: .It
642: An exact name of a session (as listed by the
1.57 jmc 643: .Ic list-sessions
1.423 nicm 644: command).
645: .It
646: The start of a session name, for example
647: .Ql mysess
648: would match a session named
649: .Ql mysession .
650: .It
651: An
1.57 jmc 652: .Xr fnmatch 3
1.423 nicm 653: pattern which is matched against the session name.
654: .El
655: .Pp
1.441 nicm 656: If the session name is prefixed with an
657: .Ql = ,
1.435 nicm 658: only an exact match is accepted (so
659: .Ql =mysess
660: will only match exactly
661: .Ql mysess ,
662: not
663: .Ql mysession ) .
1.441 nicm 664: .Pp
1.423 nicm 665: If a single session is found, it is used as the target session; multiple matches
1.57 jmc 666: produce an error.
667: If a session is omitted, the current session is used if available; if no
1.117 nicm 668: current session is available, the most recently used is chosen.
1.1 nicm 669: .Pp
1.57 jmc 670: .Ar target-window
1.472 nicm 671: (or
672: .Ar src-window
673: or
674: .Ar dst-window )
1.57 jmc 675: specifies a window in the form
676: .Em session Ns \&: Ns Em window .
677: .Em session
678: follows the same rules as for
679: .Ar target-session ,
680: and
681: .Em window
1.423 nicm 682: is looked for in order as:
683: .Bl -enum -offset Ds
684: .It
685: A special token, listed below.
686: .It
687: A window index, for example
688: .Ql mysession:1
689: is window 1 in session
690: .Ql mysession .
691: .It
692: A window ID, such as @1.
693: .It
694: An exact window name, such as
695: .Ql mysession:mywindow .
696: .It
697: The start of a window name, such as
698: .Ql mysession:mywin .
699: .It
700: As an
1.57 jmc 701: .Xr fnmatch 3
1.423 nicm 702: pattern matched against the window name.
703: .El
704: .Pp
1.435 nicm 705: Like sessions, a
706: .Ql =
707: prefix will do an exact match only.
1.57 jmc 708: An empty window name specifies the next unused index if appropriate (for
709: example the
710: .Ic new-window
711: and
712: .Ic link-window
713: commands)
714: otherwise the current window in
715: .Em session
716: is chosen.
1.423 nicm 717: .Pp
1.424 nicm 718: The following special tokens are available to indicate particular windows.
719: Each has a single-character alternative form.
1.423 nicm 720: .Bl -column "XXXXXXXXXX" "X"
721: .It Sy "Token" Ta Sy "" Ta Sy "Meaning"
722: .It Li "{start}" Ta "^" Ta "The lowest-numbered window"
723: .It Li "{end}" Ta "$" Ta "The highest-numbered window"
724: .It Li "{last}" Ta "!" Ta "The last (previously current) window"
725: .It Li "{next}" Ta "+" Ta "The next window by number"
726: .It Li "{previous}" Ta "-" Ta "The previous window by number"
727: .El
1.1 nicm 728: .Pp
1.57 jmc 729: .Ar target-pane
1.472 nicm 730: (or
731: .Ar src-pane
732: or
733: .Ar dst-pane )
734: may be a pane ID or takes a similar form to
1.57 jmc 735: .Ar target-window
1.423 nicm 736: but with the optional addition of a period followed by a pane index or pane ID,
737: for example:
738: .Ql mysession:mywindow.1 .
1.57 jmc 739: If the pane index is omitted, the currently active pane in the specified
740: window is used.
1.423 nicm 741: The following special tokens are available for the pane index:
742: .Bl -column "XXXXXXXXXXXXXX" "X"
743: .It Sy "Token" Ta Sy "" Ta Sy "Meaning"
744: .It Li "{last}" Ta "!" Ta "The last (previously active) pane"
745: .It Li "{next}" Ta "+" Ta "The next pane by number"
746: .It Li "{previous}" Ta "-" Ta "The previous pane by number"
747: .It Li "{top}" Ta "" Ta "The top pane"
748: .It Li "{bottom}" Ta "" Ta "The bottom pane"
749: .It Li "{left}" Ta "" Ta "The leftmost pane"
750: .It Li "{right}" Ta "" Ta "The rightmost pane"
751: .It Li "{top-left}" Ta "" Ta "The top-left pane"
752: .It Li "{top-right}" Ta "" Ta "The top-right pane"
753: .It Li "{bottom-left}" Ta "" Ta "The bottom-left pane"
754: .It Li "{bottom-right}" Ta "" Ta "The bottom-right pane"
1.447 nicm 755: .It Li "{up-of}" Ta "" Ta "The pane above the active pane"
756: .It Li "{down-of}" Ta "" Ta "The pane below the active pane"
757: .It Li "{left-of}" Ta "" Ta "The pane to the left of the active pane"
758: .It Li "{right-of}" Ta "" Ta "The pane to the right of the active pane"
1.423 nicm 759: .El
1.177 nicm 760: .Pp
1.423 nicm 761: The tokens
1.177 nicm 762: .Ql +
763: and
764: .Ql -
765: may be followed by an offset, for example:
766: .Bd -literal -offset indent
767: select-window -t:+2
768: .Ed
769: .Pp
1.432 nicm 770: In addition,
771: .Em target-session ,
772: .Em target-window
773: or
774: .Em target-pane
775: may consist entirely of the token
776: .Ql {mouse}
777: (alternative form
778: .Ql = )
1.678 nicm 779: to specify the session, window or pane where the most recent mouse event occurred
1.432 nicm 780: (see the
781: .Sx MOUSE SUPPORT
782: section)
783: or
784: .Ql {marked}
785: (alternative form
786: .Ql ~ )
787: to specify the marked pane (see
788: .Ic select-pane
789: .Fl m ) .
790: .Pp
1.423 nicm 791: Sessions, window and panes are each numbered with a unique ID; session IDs are
792: prefixed with a
793: .Ql $ ,
794: windows with a
795: .Ql @ ,
796: and panes with a
797: .Ql % .
798: These are unique and are unchanged for the life of the session, window or pane
799: in the
1.212 nicm 800: .Nm
1.423 nicm 801: server.
802: The pane ID is passed to the child process of the pane in the
1.212 nicm 803: .Ev TMUX_PANE
804: environment variable.
1.423 nicm 805: IDs may be displayed using the
806: .Ql session_id ,
807: .Ql window_id ,
808: or
809: .Ql pane_id
810: formats (see the
811: .Sx FORMATS
812: section) and the
813: .Ic display-message ,
814: .Ic list-sessions ,
815: .Ic list-windows
816: or
817: .Ic list-panes
818: commands.
1.15 jmc 819: .Pp
1.153 nicm 820: .Ar shell-command
821: arguments are
822: .Xr sh 1
823: commands.
1.394 nicm 824: This may be a single argument passed to the shell, for example:
1.153 nicm 825: .Bd -literal -offset indent
826: new-window 'vi /etc/passwd'
827: .Ed
1.394 nicm 828: .Pp
829: Will run:
830: .Bd -literal -offset indent
831: /bin/sh -c 'vi /etc/passwd'
832: .Ed
833: .Pp
834: Additionally, the
835: .Ic new-window ,
836: .Ic new-session ,
837: .Ic split-window ,
838: .Ic respawn-window
839: and
840: .Ic respawn-pane
841: commands allow
842: .Ar shell-command
843: to be given as multiple arguments and executed directly (without
844: .Ql sh -c ) .
845: This can avoid issues with shell quoting.
846: For example:
847: .Bd -literal -offset indent
848: $ tmux new-window vi /etc/passwd
849: .Ed
850: .Pp
851: Will run
852: .Xr vi 1
853: directly without invoking the shell.
1.153 nicm 854: .Pp
855: .Ar command
856: .Op Ar arguments
857: refers to a
858: .Nm
1.655 nicm 859: command, either passed with the command and arguments separately, for example:
1.153 nicm 860: .Bd -literal -offset indent
1.629 nicm 861: bind-key F1 set-option status off
1.153 nicm 862: .Ed
863: .Pp
1.655 nicm 864: Or passed as a single string argument in
865: .Pa .tmux.conf ,
866: for example:
1.153 nicm 867: .Bd -literal -offset indent
1.655 nicm 868: bind-key F1 { set-option status off }
1.153 nicm 869: .Ed
870: .Pp
871: Example
872: .Nm
873: commands include:
1.13 nicm 874: .Bd -literal -offset indent
1.57 jmc 875: refresh-client -t/dev/ttyp2
876:
877: rename-session -tfirst newname
878:
1.668 nicm 879: set-option -wt:0 monitor-activity on
1.57 jmc 880:
881: new-window ; split-window -d
1.244 nicm 882:
883: bind-key R source-file ~/.tmux.conf \e; \e
884: display-message "source-file done"
1.13 nicm 885: .Ed
1.153 nicm 886: .Pp
887: Or from
888: .Xr sh 1 :
889: .Bd -literal -offset indent
890: $ tmux kill-window -t :1
891:
1.159 jmc 892: $ tmux new-window \e; split-window -d
1.153 nicm 893:
1.159 jmc 894: $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
1.153 nicm 895: .Ed
1.57 jmc 896: .Sh CLIENTS AND SESSIONS
1.153 nicm 897: The
898: .Nm
899: server manages clients, sessions, windows and panes.
900: Clients are attached to sessions to interact with them, either
901: when they are created with the
902: .Ic new-session
903: command, or later with the
904: .Ic attach-session
905: command.
1.188 nicm 906: Each session has one or more windows
1.153 nicm 907: .Em linked
908: into it.
909: Windows may be linked to multiple sessions and are made up of one or
910: more panes,
911: each of which contains a pseudo terminal.
912: Commands for creating, linking and otherwise manipulating windows
913: are covered
914: in the
915: .Sx WINDOWS AND PANES
916: section.
917: .Pp
918: The following commands are available to manage clients and sessions:
1.57 jmc 919: .Bl -tag -width Ds
920: .It Xo Ic attach-session
1.662 nicm 921: .Op Fl dErx
1.372 nicm 922: .Op Fl c Ar working-directory
1.57 jmc 923: .Op Fl t Ar target-session
924: .Xc
925: .D1 (alias: Ic attach )
926: If run from outside
927: .Nm ,
928: create a new client in the current terminal and attach it to
929: .Ar target-session .
930: If used from inside, switch the current client.
931: If
932: .Fl d
933: is specified, any other clients attached to the session are detached.
1.662 nicm 934: If
935: .Fl x
1.703 nicm 936: is given, send
937: .Dv SIGHUP
938: to the parent process of the client as well as
1.662 nicm 939: detaching the client, typically causing it to exit.
1.148 nicm 940: .Fl r
941: signifies the client is read-only (only keys bound to the
942: .Ic detach-client
1.242 nicm 943: or
944: .Ic switch-client
945: commands have any effect)
1.13 nicm 946: .Pp
1.57 jmc 947: If no server is started,
948: .Ic attach-session
949: will attempt to start it; this will fail unless sessions are created in the
950: configuration file.
1.217 nicm 951: .Pp
952: The
953: .Ar target-session
954: rules for
955: .Ic attach-session
956: are slightly adjusted: if
957: .Nm
958: needs to select the most recently used session, it will prefer the most
959: recently used
960: .Em unattached
961: session.
1.372 nicm 962: .Pp
963: .Fl c
964: will set the session working directory (used for new windows) to
965: .Ar working-directory .
1.436 nicm 966: .Pp
967: If
968: .Fl E
1.480 nicm 969: is used, the
1.436 nicm 970: .Ic update-environment
971: option will not be applied.
1.211 nicm 972: .It Xo Ic detach-client
1.463 nicm 973: .Op Fl aP
1.525 nicm 974: .Op Fl E Ar shell-command
1.219 nicm 975: .Op Fl s Ar target-session
1.211 nicm 976: .Op Fl t Ar target-client
977: .Xc
1.57 jmc 978: .D1 (alias: Ic detach )
1.218 nicm 979: Detach the current client if bound to a key, the client specified with
980: .Fl t ,
1.258 jmc 981: or all clients currently attached to the session specified by
1.218 nicm 982: .Fl s .
1.296 nicm 983: The
984: .Fl a
985: option kills all but the client given with
986: .Fl t .
1.211 nicm 987: If
988: .Fl P
1.703 nicm 989: is given, send
990: .Dv SIGHUP
991: to the parent process of the client, typically causing it
1.211 nicm 992: to exit.
1.525 nicm 993: With
994: .Fl E ,
995: run
996: .Ar shell-command
997: to replace the client.
1.57 jmc 998: .It Ic has-session Op Fl t Ar target-session
999: .D1 (alias: Ic has )
1000: Report an error and exit with 1 if the specified session does not exist.
1001: If it does exist, exit with 0.
1002: .It Ic kill-server
1003: Kill the
1.1 nicm 1004: .Nm
1.57 jmc 1005: server and clients and destroy all sessions.
1.369 nicm 1006: .It Xo Ic kill-session
1.464 nicm 1007: .Op Fl aC
1.297 nicm 1008: .Op Fl t Ar target-session
1.369 nicm 1009: .Xc
1.57 jmc 1010: Destroy the given session, closing any windows linked to it and no other
1011: sessions, and detaching all clients attached to it.
1.297 nicm 1012: If
1013: .Fl a
1014: is given, all sessions but the specified one is killed.
1.464 nicm 1015: The
1016: .Fl C
1.467 nicm 1017: flag clears alerts (bell, activity, or silence) in all windows linked to the
1.464 nicm 1018: session.
1.250 nicm 1019: .It Xo Ic list-clients
1020: .Op Fl F Ar format
1021: .Op Fl t Ar target-session
1022: .Xc
1.57 jmc 1023: .D1 (alias: Ic lsc )
1.221 jmc 1024: List all clients attached to the server.
1.250 nicm 1025: For the meaning of the
1026: .Fl F
1027: flag, see the
1.252 jmc 1028: .Sx FORMATS
1029: section.
1.221 jmc 1030: If
1.220 nicm 1031: .Ar target-session
1032: is specified, list only clients connected to that session.
1.489 nicm 1033: .It Xo Ic list-commands
1034: .Op Fl F Ar format
1035: .Xc
1.57 jmc 1036: .D1 (alias: Ic lscm )
1037: List the syntax of all commands supported by
1038: .Nm .
1.247 nicm 1039: .It Ic list-sessions Op Fl F Ar format
1.57 jmc 1040: .D1 (alias: Ic ls )
1041: List all sessions managed by the server.
1.247 nicm 1042: For the meaning of the
1043: .Fl F
1044: flag, see the
1045: .Sx FORMATS
1046: section.
1.175 nicm 1047: .It Ic lock-client Op Fl t Ar target-client
1048: .D1 (alias: Ic lockc )
1.92 nicm 1049: Lock
1050: .Ar target-client ,
1051: see the
1052: .Ic lock-server
1053: command.
1.175 nicm 1054: .It Ic lock-session Op Fl t Ar target-session
1055: .D1 (alias: Ic locks )
1.92 nicm 1056: Lock all clients attached to
1057: .Ar target-session .
1.57 jmc 1058: .It Xo Ic new-session
1.662 nicm 1059: .Op Fl AdDEPX
1.371 nicm 1060: .Op Fl c Ar start-directory
1.351 nicm 1061: .Op Fl F Ar format
1.57 jmc 1062: .Op Fl n Ar window-name
1063: .Op Fl s Ar session-name
1.536 nicm 1064: .Op Fl t Ar group-name
1.210 nicm 1065: .Op Fl x Ar width
1066: .Op Fl y Ar height
1.153 nicm 1067: .Op Ar shell-command
1.57 jmc 1068: .Xc
1069: .D1 (alias: Ic new )
1070: Create a new session with name
1071: .Ar session-name .
1.153 nicm 1072: .Pp
1.57 jmc 1073: The new session is attached to the current terminal unless
1074: .Fl d
1075: is given.
1076: .Ar window-name
1.1 nicm 1077: and
1.153 nicm 1078: .Ar shell-command
1079: are the name of and shell command to execute in the initial window.
1.552 nicm 1080: With
1081: .Fl d ,
1.642 nicm 1082: the initial size comes from the global
1083: .Ic default-size
1084: option;
1.210 nicm 1085: .Fl x
1086: and
1087: .Fl y
1.602 nicm 1088: can be used to specify a different size.
1089: .Ql -
1090: uses the size of the current client if any.
1.642 nicm 1091: If
1092: .Fl x
1093: or
1094: .Fl y
1095: is given, the
1096: .Ic default-size
1097: option is set for the session.
1.68 nicm 1098: .Pp
1099: If run from a terminal, any
1100: .Xr termios 4
1101: special characters are saved and used for new windows in the new session.
1.338 nicm 1102: .Pp
1103: The
1104: .Fl A
1105: flag makes
1106: .Ic new-session
1107: behave like
1108: .Ic attach-session
1109: if
1110: .Ar session-name
1.416 nicm 1111: already exists; in this case,
1.338 nicm 1112: .Fl D
1113: behaves like
1114: .Fl d
1.662 nicm 1115: to
1116: .Ic attach-session ,
1117: and
1118: .Fl X
1119: behaves like
1120: .Fl x
1.338 nicm 1121: to
1122: .Ic attach-session .
1.101 nicm 1123: .Pp
1124: If
1125: .Fl t
1.536 nicm 1126: is given, it specifies a
1127: .Ic session group .
1128: Sessions in the same group share the same set of windows - new windows are
1.537 nicm 1129: linked to all sessions in the group and any windows closed removed from all
1.536 nicm 1130: sessions.
1.101 nicm 1131: The current and previous window and any session options remain independent and
1.536 nicm 1132: any session in a group may be killed without affecting the others.
1133: The
1134: .Ar group-name
1135: argument may be:
1136: .Bl -enum -width Ds
1137: .It
1138: the name of an existing group, in which case the new session is added to that
1139: group;
1140: .It
1141: the name of an existing session - the new session is added to the same group
1142: as that session, creating a new group if necessary;
1143: .It
1144: the name for a new group containing only the new session.
1145: .El
1146: .Pp
1.101 nicm 1147: .Fl n
1.480 nicm 1148: and
1.153 nicm 1149: .Ar shell-command
1.101 nicm 1150: are invalid if
1151: .Fl t
1152: is used.
1.351 nicm 1153: .Pp
1154: The
1155: .Fl P
1156: option prints information about the new session after it has been created.
1157: By default, it uses the format
1.683 nicm 1158: .Ql #{session_name}:\&
1.351 nicm 1159: but a different format may be specified with
1160: .Fl F .
1.436 nicm 1161: .Pp
1162: If
1163: .Fl E
1.480 nicm 1164: is used, the
1.436 nicm 1165: .Ic update-environment
1166: option will not be applied.
1.248 nicm 1167: .It Xo Ic refresh-client
1.613 nicm 1168: .Op Fl cDlLRSU
1.677 nicm 1169: .Op Fl C Ar XxY
1170: .Op Fl F Ar flags
1.248 nicm 1171: .Op Fl t Ar target-client
1.613 nicm 1172: .Op Ar adjustment
1.248 nicm 1173: .Xc
1.57 jmc 1174: .D1 (alias: Ic refresh )
1175: Refresh the current client if bound to a key, or a single client if one is given
1176: with
1177: .Fl t .
1.248 nicm 1178: If
1179: .Fl S
1.538 nicm 1180: is specified, only update the client's status line.
1.535 nicm 1181: .Pp
1.642 nicm 1182: The
1183: .Fl U ,
1184: .Fl D ,
1185: .Fl L
1186: .Fl R ,
1187: and
1188: .Fl c
1189: flags allow the visible portion of a window which is larger than the client
1190: to be changed.
1191: .Fl U
1192: moves the visible part up by
1193: .Ar adjustment
1194: rows and
1195: .Fl D
1196: down,
1197: .Fl L
1198: left by
1199: .Ar adjustment
1200: columns and
1201: .Fl R
1202: right.
1203: .Fl c
1204: returns to tracking the cursor automatically.
1205: If
1206: .Ar adjustment
1207: is omitted, 1 is used.
1208: Note that the visible position is a property of the client not of the
1209: window, changing the current window in the attached session will reset
1210: it.
1211: .Pp
1.535 nicm 1212: .Fl C
1.677 nicm 1213: sets the width and height of a control client and
1214: .Fl F
1215: sets a comma-separated list of flags.
1216: Currently the only flag available is
1217: .Ql no-output
1218: to disable receiving pane output.
1219: .Pp
1.612 nicm 1220: .Fl l
1221: requests the clipboard from the client using the
1222: .Xr xterm 1
1223: escape sequence and stores it in a new paste buffer.
1.613 nicm 1224: .Pp
1225: .Fl L ,
1226: .Fl R ,
1227: .Fl U
1228: and
1229: .Fl D
1230: move the visible portion of the window left, right, up or down
1231: by
1232: .Ar adjustment ,
1233: if the window is larger than the client.
1234: .Fl c
1235: resets so that the position follows the cursor.
1236: See the
1237: .Ic window-size
1238: option.
1.57 jmc 1239: .It Xo Ic rename-session
1240: .Op Fl t Ar target-session
1241: .Ar new-name
1242: .Xc
1243: .D1 (alias: Ic rename )
1244: Rename the session to
1245: .Ar new-name .
1.121 nicm 1246: .It Xo Ic show-messages
1.465 nicm 1247: .Op Fl JT
1.120 nicm 1248: .Op Fl t Ar target-client
1249: .Xc
1250: .D1 (alias: Ic showmsgs )
1.377 nicm 1251: Show client messages or server information.
1.120 nicm 1252: Any messages displayed on the status line are saved in a per-client message
1253: log, up to a maximum of the limit set by the
1254: .Ar message-limit
1.384 nicm 1255: server option.
1.377 nicm 1256: With
1257: .Fl t ,
1258: display the log for
1.120 nicm 1259: .Ar target-client .
1.377 nicm 1260: .Fl J
1261: and
1262: .Fl T
1.465 nicm 1263: show debugging information about jobs and terminals.
1.488 tim 1264: .It Xo Ic source-file
1.663 nicm 1265: .Op Fl nqv
1.488 tim 1266: .Ar path
1.659 nicm 1267: .Ar ...
1.488 tim 1268: .Xc
1.57 jmc 1269: .D1 (alias: Ic source )
1.659 nicm 1270: Execute commands from one or more files specified by
1.519 nicm 1271: .Ar path
1.659 nicm 1272: (which may be
1.607 kn 1273: .Xr glob 7
1.659 nicm 1274: patterns).
1.488 tim 1275: If
1276: .Fl q
1277: is given, no error will be returned if
1278: .Ar path
1279: does not exist.
1.651 nicm 1280: With
1281: .Fl n ,
1282: the file is parsed but no commands are executed.
1.663 nicm 1283: .Fl v
1284: shows the parsed commands and line numbers if possible.
1.57 jmc 1285: .It Ic start-server
1286: .D1 (alias: Ic start )
1287: Start the
1.1 nicm 1288: .Nm
1.57 jmc 1289: server, if not already running, without creating any sessions.
1.707 ! nicm 1290: .Pp
! 1291: Note that as by default the
! 1292: .Nm
! 1293: server will exit with no sessions, this is only useful if a session is created in
! 1294: .Pa ~/.tmux.conf ,
! 1295: .Ic exit-empty
! 1296: is turned off, or another command is run as part of the same command sequence.
! 1297: For example:
! 1298: .Bd -literal -offset indent
! 1299: $ tmux start \\; show -g
! 1300: .Ed
1.57 jmc 1301: .It Xo Ic suspend-client
1.202 nicm 1302: .Op Fl t Ar target-client
1.57 jmc 1303: .Xc
1304: .D1 (alias: Ic suspendc )
1305: Suspend a client by sending
1306: .Dv SIGTSTP
1307: (tty stop).
1308: .It Xo Ic switch-client
1.681 nicm 1309: .Op Fl ElnprZ
1.57 jmc 1310: .Op Fl c Ar target-client
1311: .Op Fl t Ar target-session
1.421 nicm 1312: .Op Fl T Ar key-table
1.57 jmc 1313: .Xc
1314: .D1 (alias: Ic switchc )
1315: Switch the current session for client
1316: .Ar target-client
1317: to
1318: .Ar target-session .
1.635 nicm 1319: As a special case,
1320: .Fl t
1321: may refer to a pane (a target that contains
1.636 jmc 1322: .Ql \&: ,
1323: .Ql \&.
1.635 nicm 1324: or
1.636 jmc 1325: .Ql % ) ,
1.681 nicm 1326: to change session, window and pane.
1327: In that case,
1328: .Fl Z
1329: keeps the window zoomed if it was zoomed.
1.183 nicm 1330: If
1.197 jmc 1331: .Fl l ,
1.183 nicm 1332: .Fl n
1333: or
1334: .Fl p
1.194 nicm 1335: is used, the client is moved to the last, next or previous session
1336: respectively.
1.242 nicm 1337: .Fl r
1338: toggles whether a client is read-only (see the
1339: .Ic attach-session
1340: command).
1.436 nicm 1341: .Pp
1342: If
1343: .Fl E
1344: is used,
1345: .Ic update-environment
1346: option will not be applied.
1.421 nicm 1347: .Pp
1348: .Fl T
1.706 nicm 1349: sets the client's key table; the next key from the client will be interpreted
1350: from
1.421 nicm 1351: .Ar key-table .
1352: This may be used to configure multiple prefix keys, or to bind commands to
1353: sequences of keys.
1354: For example, to make typing
1355: .Ql abc
1356: run the
1357: .Ic list-keys
1358: command:
1359: .Bd -literal -offset indent
1360: bind-key -Ttable2 c list-keys
1361: bind-key -Ttable1 b switch-client -Ttable2
1362: bind-key -Troot a switch-client -Ttable1
1363: .Ed
1.57 jmc 1364: .El
1365: .Sh WINDOWS AND PANES
1.679 nicm 1366: Each window displayed by
1367: .Nm
1368: may be split into one or more
1369: .Em panes ;
1370: each pane takes up a certain area of the display and is a separate terminal.
1371: A window may be split into panes using the
1372: .Ic split-window
1373: command.
1374: Windows may be split horizontally (with the
1375: .Fl h
1376: flag) or vertically.
1377: Panes may be resized with the
1378: .Ic resize-pane
1379: command (bound to
1380: .Ql C-Up ,
1381: .Ql C-Down
1382: .Ql C-Left
1383: and
1384: .Ql C-Right
1385: by default), the current pane may be changed with the
1386: .Ic select-pane
1387: command and the
1388: .Ic rotate-window
1389: and
1390: .Ic swap-pane
1391: commands may be used to swap panes without changing their position.
1392: Panes are numbered beginning from zero in the order they are created.
1393: .Pp
1394: By default, a
1.1 nicm 1395: .Nm
1.679 nicm 1396: pane permits direct access to the terminal contained in the pane.
1397: A pane may also be put into one of several modes:
1398: .Bl -dash -offset indent
1399: .It
1400: Copy mode, which permits a section of a window or its
1.164 nicm 1401: history to be copied to a
1.1 nicm 1402: .Em paste buffer
1403: for later insertion into another window.
1404: This mode is entered with the
1405: .Ic copy-mode
1406: command, bound to
1.113 nicm 1407: .Ql \&[
1.1 nicm 1408: by default.
1.679 nicm 1409: .It
1410: View mode, which is like copy mode but is entered when a command that produces
1411: output, such as
1.164 nicm 1412: .Ic list-keys ,
1413: is executed from a key binding.
1.679 nicm 1414: .It
1415: Choose mode, which allows an item to be chosen from a list.
1416: This may be a client, a session or window or pane, or a buffer.
1417: This mode is entered with the
1418: .Ic choose-buffer ,
1419: .Ic choose-client
1420: and
1421: .Ic choose-tree
1422: commands.
1423: .El
1.1 nicm 1424: .Pp
1.678 nicm 1425: In copy mode an indicator is displayed in the top-right corner of the pane with
1426: the current position and the number of lines in the history.
1427: .Pp
1.497 nicm 1428: Commands are sent to copy mode using the
1429: .Fl X
1430: flag to the
1431: .Ic send-keys
1432: command.
1433: When a key is pressed, copy mode automatically uses one of two key tables,
1434: depending on the
1.1 nicm 1435: .Ic mode-keys
1.497 nicm 1436: option:
1437: .Ic copy-mode
1438: for emacs, or
1439: .Ic copy-mode-vi
1440: for vi.
1441: Key tables may be viewed with the
1442: .Ic list-keys
1443: command.
1444: .Pp
1445: The following commands are supported in copy mode:
1.648 nicm 1446: .Bl -column "CommandXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
1.497 nicm 1447: .It Sy "Command" Ta Sy "vi" Ta Sy "emacs"
1448: .It Li "append-selection" Ta "" Ta ""
1449: .It Li "append-selection-and-cancel" Ta "A" Ta ""
1450: .It Li "back-to-indentation" Ta "^" Ta "M-m"
1451: .It Li "begin-selection" Ta "Space" Ta "C-Space"
1452: .It Li "bottom-line" Ta "L" Ta ""
1453: .It Li "cancel" Ta "q" Ta "Escape"
1454: .It Li "clear-selection" Ta "Escape" Ta "C-g"
1.633 nicm 1455: .It Li "copy-end-of-line [<prefix>]" Ta "D" Ta "C-k"
1456: .It Li "copy-line [<prefix>]" Ta "" Ta ""
1457: .It Li "copy-pipe <command> [<prefix>]" Ta "" Ta ""
1.638 nicm 1458: .It Li "copy-pipe-no-clear <command> [<prefix>]" Ta "" Ta ""
1.633 nicm 1459: .It Li "copy-pipe-and-cancel <command> [<prefix>]" Ta "" Ta ""
1460: .It Li "copy-selection [<prefix>]" Ta "" Ta ""
1.638 nicm 1461: .It Li "copy-selection-no-clear [<prefix>]" Ta "" Ta ""
1.633 nicm 1462: .It Li "copy-selection-and-cancel [<prefix>]" Ta "Enter" Ta "M-w"
1.497 nicm 1463: .It Li "cursor-down" Ta "j" Ta "Down"
1.685 nicm 1464: .It Li "cursor-down-and-cancel" Ta "" Ta ""
1.497 nicm 1465: .It Li "cursor-left" Ta "h" Ta "Left"
1466: .It Li "cursor-right" Ta "l" Ta "Right"
1467: .It Li "cursor-up" Ta "k" Ta "Up"
1468: .It Li "end-of-line" Ta "$" Ta "C-e"
1469: .It Li "goto-line <line>" Ta ":" Ta "g"
1470: .It Li "halfpage-down" Ta "C-d" Ta "M-Down"
1.589 nicm 1471: .It Li "halfpage-down-and-cancel" Ta "" Ta ""
1.497 nicm 1472: .It Li "halfpage-up" Ta "C-u" Ta "M-Up"
1.589 nicm 1473: .It Li "history-bottom" Ta "G" Ta "M->"
1474: .It Li "history-top" Ta "g" Ta "M-<"
1.497 nicm 1475: .It Li "jump-again" Ta ";" Ta ";"
1476: .It Li "jump-backward <to>" Ta "F" Ta "F"
1477: .It Li "jump-forward <to>" Ta "f" Ta "f"
1478: .It Li "jump-reverse" Ta "," Ta ","
1479: .It Li "jump-to-backward <to>" Ta "T" Ta ""
1480: .It Li "jump-to-forward <to>" Ta "t" Ta ""
1481: .It Li "middle-line" Ta "M" Ta "M-r"
1.678 nicm 1482: .It Li "next-matching-bracket" Ta "%" Ta "M-C-f"
1.497 nicm 1483: .It Li "next-paragraph" Ta "}" Ta "M-}"
1484: .It Li "next-space" Ta "W" Ta ""
1485: .It Li "next-space-end" Ta "E" Ta ""
1486: .It Li "next-word" Ta "w" Ta ""
1487: .It Li "next-word-end" Ta "e" Ta "M-f"
1488: .It Li "other-end" Ta "o" Ta ""
1489: .It Li "page-down" Ta "C-f" Ta "PageDown"
1.589 nicm 1490: .It Li "page-down-and-cancel" Ta "" Ta ""
1.497 nicm 1491: .It Li "page-up" Ta "C-b" Ta "PageUp"
1.678 nicm 1492: .It Li "previous-matching-bracket" Ta "" Ta "M-C-b"
1.497 nicm 1493: .It Li "previous-paragraph" Ta "{" Ta "M-{"
1494: .It Li "previous-space" Ta "B" Ta ""
1495: .It Li "previous-word" Ta "b" Ta "M-b"
1496: .It Li "rectangle-toggle" Ta "v" Ta "R"
1497: .It Li "scroll-down" Ta "C-e" Ta "C-Down"
1.589 nicm 1498: .It Li "scroll-down-and-cancel" Ta "" Ta ""
1.497 nicm 1499: .It Li "scroll-up" Ta "C-y" Ta "C-Up"
1500: .It Li "search-again" Ta "n" Ta "n"
1.517 nicm 1501: .It Li "search-backward <for>" Ta "?" Ta ""
1502: .It Li "search-forward <for>" Ta "/" Ta ""
1503: .It Li "search-backward-incremental <for>" Ta "" Ta "C-r"
1504: .It Li "search-forward-incremental <for>" Ta "" Ta "C-s"
1.497 nicm 1505: .It Li "search-reverse" Ta "N" Ta "N"
1506: .It Li "select-line" Ta "V" Ta ""
1.634 nicm 1507: .It Li "select-word" Ta "" Ta ""
1.497 nicm 1508: .It Li "start-of-line" Ta "0" Ta "C-a"
1.515 nicm 1509: .It Li "stop-selection" Ta "" Ta ""
1.497 nicm 1510: .It Li "top-line" Ta "H" Ta "M-R"
1.1 nicm 1511: .El
1.589 nicm 1512: .Pp
1.633 nicm 1513: Copy commands may take an optional buffer prefix argument which is used
1514: to generate the buffer name (the default is
1515: .Ql buffer
1516: so buffers are named
1517: .Ql buffer0 ,
1518: .Ql buffer1
1519: and so on).
1520: Pipe commands take a command argument which is the command to which the
1521: copied text is piped.
1.589 nicm 1522: The
1523: .Ql -and-cancel
1524: variants of some commands exit copy mode after they have completed (for copy
1525: commands) or when the cursor reaches the bottom (for scrolling commands).
1.638 nicm 1526: .Ql -no-clear
1527: variants do not clear the selection.
1.146 nicm 1528: .Pp
1529: The next and previous word keys use space and the
1530: .Ql - ,
1.154 nicm 1531: .Ql _
1.146 nicm 1532: and
1533: .Ql @
1.154 nicm 1534: characters as word delimiters by default, but this can be adjusted by
1535: setting the
1536: .Em word-separators
1.255 nicm 1537: session option.
1.146 nicm 1538: Next word moves to the start of the next word, next word end to the end of the
1539: next word and previous word to the start of the previous word.
1540: The three next and previous space keys work similarly but use a space alone as
1541: the word separator.
1.157 nicm 1542: .Pp
1543: The jump commands enable quick movement within a line.
1544: For instance, typing
1545: .Ql f
1546: followed by
1547: .Ql /
1548: will move the cursor to the next
1549: .Ql /
1550: character on the current line.
1551: A
1552: .Ql \&;
1553: will then jump to the next occurrence.
1.1 nicm 1554: .Pp
1.155 nicm 1555: Commands in copy mode may be prefaced by an optional repeat count.
1556: With vi key bindings, a prefix is entered using the number keys; with
1557: emacs, the Alt (meta) key and a number begins prefix entry.
1558: .Pp
1.164 nicm 1559: The synopsis for the
1560: .Ic copy-mode
1561: command is:
1.57 jmc 1562: .Bl -tag -width Ds
1563: .It Xo Ic copy-mode
1.450 nicm 1564: .Op Fl Meu
1.72 nicm 1565: .Op Fl t Ar target-pane
1.57 jmc 1566: .Xc
1567: Enter copy mode.
1568: The
1569: .Fl u
1570: option scrolls one page up.
1.419 nicm 1571: .Fl M
1572: begins a mouse drag (only valid if bound to a mouse key binding, see
1.420 jmc 1573: .Sx MOUSE SUPPORT ) .
1.450 nicm 1574: .Fl e
1575: specifies that scrolling to the bottom of the history (to the visible screen)
1576: should exit copy mode.
1577: While in copy mode, pressing a key other than those used for scrolling will
1578: disable this behaviour.
1579: This is intended to allow fast scrolling through a pane's history, for
1580: example with:
1581: .Bd -literal -offset indent
1582: bind PageUp copy-mode -eu
1583: .Ed
1.57 jmc 1584: .El
1.18 nicm 1585: .Pp
1.679 nicm 1586: A number of preset arrangements of panes are available, these are called layouts.
1.38 nicm 1587: These may be selected with the
1588: .Ic select-layout
1589: command or cycled with
1590: .Ic next-layout
1591: (bound to
1.149 nicm 1592: .Ql Space
1.131 nicm 1593: by default); once a layout is chosen, panes within it may be moved and resized
1594: as normal.
1.1 nicm 1595: .Pp
1596: The following layouts are supported:
1597: .Bl -tag -width Ds
1598: .It Ic even-horizontal
1599: Panes are spread out evenly from left to right across the window.
1600: .It Ic even-vertical
1601: Panes are spread evenly from top to bottom.
1.2 nicm 1602: .It Ic main-horizontal
1.131 nicm 1603: A large (main) pane is shown at the top of the window and the remaining panes
1604: are spread from left to right in the leftover space at the bottom.
1.2 nicm 1605: Use the
1606: .Em main-pane-height
1607: window option to specify the height of the top pane.
1.1 nicm 1608: .It Ic main-vertical
1.2 nicm 1609: Similar to
1610: .Ic main-horizontal
1611: but the large pane is placed on the left and the others spread from top to
1612: bottom along the right.
1613: See the
1614: .Em main-pane-width
1615: window option.
1.165 nicm 1616: .It Ic tiled
1617: Panes are spread out as evenly as possible over the window in both rows and
1618: columns.
1.1 nicm 1619: .El
1.8 nicm 1620: .Pp
1.181 nicm 1621: In addition,
1622: .Ic select-layout
1623: may be used to apply a previously used layout - the
1624: .Ic list-windows
1625: command displays the layout of each window in a form suitable for use with
1626: .Ic select-layout .
1627: For example:
1628: .Bd -literal -offset indent
1629: $ tmux list-windows
1630: 0: ksh [159x48]
1631: layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
1632: $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
1633: .Ed
1.196 nicm 1634: .Pp
1.181 nicm 1635: .Nm
1636: automatically adjusts the size of the layout for the current window size.
1637: Note that a layout cannot be applied to a window with more panes than that
1638: from which the layout was originally defined.
1639: .Pp
1.57 jmc 1640: Commands related to windows and panes are as follows:
1641: .Bl -tag -width Ds
1642: .It Xo Ic break-pane
1.280 nicm 1643: .Op Fl dP
1644: .Op Fl F Ar format
1.532 nicm 1645: .Op Fl n Ar window-name
1.440 nicm 1646: .Op Fl s Ar src-pane
1.480 nicm 1647: .Op Fl t Ar dst-window
1.57 jmc 1648: .Xc
1649: .D1 (alias: Ic breakp )
1650: Break
1.440 nicm 1651: .Ar src-pane
1652: off from its containing window to make it the only pane in
1653: .Ar dst-window .
1.57 jmc 1654: If
1655: .Fl d
1656: is given, the new window does not become the current window.
1.280 nicm 1657: The
1658: .Fl P
1659: option prints information about the new window after it has been created.
1660: By default, it uses the format
1661: .Ql #{session_name}:#{window_index}
1662: but a different format may be specified with
1663: .Fl F .
1.128 nicm 1664: .It Xo Ic capture-pane
1.680 nicm 1665: .Op Fl aepPqCJN
1.392 nicm 1666: .Op Fl b Ar buffer-name
1.213 nicm 1667: .Op Fl E Ar end-line
1668: .Op Fl S Ar start-line
1.128 nicm 1669: .Op Fl t Ar target-pane
1670: .Xc
1671: .D1 (alias: Ic capturep )
1.322 nicm 1672: Capture the contents of a pane.
1673: If
1674: .Fl p
1.325 nicm 1675: is given, the output goes to stdout, otherwise to the buffer specified with
1.322 nicm 1676: .Fl b
1677: or a new buffer if omitted.
1.339 nicm 1678: If
1679: .Fl a
1680: is given, the alternate screen is used, and the history is not accessible.
1.340 nicm 1681: If no alternate screen exists, an error will be returned unless
1682: .Fl q
1683: is given.
1.326 nicm 1684: If
1685: .Fl e
1.328 nicm 1686: is given, the output includes escape sequences for text and background
1687: attributes.
1688: .Fl C
1.330 nicm 1689: also escapes non-printable characters as octal \exxx.
1.680 nicm 1690: .Fl N
1691: preserves trailing spaces at each line's end and
1.328 nicm 1692: .Fl J
1.680 nicm 1693: preserves trailing spaces and joins any wrapped lines.
1.346 nicm 1694: .Fl P
1695: captures only any output that the pane has received that is the beginning of an
1696: as-yet incomplete escape sequence.
1.213 nicm 1697: .Pp
1698: .Fl S
1699: and
1700: .Fl E
1701: specify the starting and ending line numbers, zero is the first line of the
1702: visible pane and negative numbers are lines in the history.
1.397 nicm 1703: .Ql -
1704: to
1705: .Fl S
1706: is the start of the history and to
1707: .Fl E
1708: the end of the visible pane.
1.213 nicm 1709: The default is to capture only the visible contents of the pane.
1.76 nicm 1710: .It Xo
1711: .Ic choose-client
1.682 nicm 1712: .Op Fl NrZ
1.572 nicm 1713: .Op Fl F Ar format
1.562 nicm 1714: .Op Fl f Ar filter
1.561 nicm 1715: .Op Fl O Ar sort-order
1.555 nicm 1716: .Op Fl t Ar target-pane
1.76 nicm 1717: .Op Ar template
1718: .Xc
1.555 nicm 1719: Put a pane into client mode, allowing a client to be selected interactively from
1720: a list.
1.593 nicm 1721: .Fl Z
1722: zooms the pane.
1.555 nicm 1723: The following keys may be used in client mode:
1724: .Bl -column "Key" "Function" -offset indent
1725: .It Sy "Key" Ta Sy "Function"
1726: .It Li "Enter" Ta "Choose selected client"
1727: .It Li "Up" Ta "Select previous client"
1728: .It Li "Down" Ta "Select next client"
1.559 nicm 1729: .It Li "C-s" Ta "Search by name"
1730: .It Li "n" Ta "Repeat last search"
1.555 nicm 1731: .It Li "t" Ta "Toggle if client is tagged"
1732: .It Li "T" Ta "Tag no clients"
1733: .It Li "C-t" Ta "Tag all clients"
1734: .It Li "d" Ta "Detach selected client"
1735: .It Li "D" Ta "Detach tagged clients"
1736: .It Li "x" Ta "Detach and HUP selected client"
1737: .It Li "X" Ta "Detach and HUP tagged clients"
1738: .It Li "z" Ta "Suspend selected client"
1739: .It Li "Z" Ta "Suspend tagged clients"
1.562 nicm 1740: .It Li "f" Ta "Enter a format to filter items"
1.682 nicm 1741: .It Li "O" Ta "Change sort field"
1742: .It Li "r" Ta "Reverse sort order"
1.576 nicm 1743: .It Li "v" Ta "Toggle preview"
1.555 nicm 1744: .It Li "q" Ta "Exit mode"
1745: .El
1746: .Pp
1.76 nicm 1747: After a client is chosen,
1748: .Ql %%
1.555 nicm 1749: is replaced by the client name in
1.76 nicm 1750: .Ar template
1751: and the result executed as a command.
1752: If
1753: .Ar template
1754: is not given, "detach-client -t '%%'" is used.
1.555 nicm 1755: .Pp
1.561 nicm 1756: .Fl O
1.682 nicm 1757: specifies the initial sort field: one of
1.561 nicm 1758: .Ql name ,
1759: .Ql size ,
1760: .Ql creation ,
1761: or
1762: .Ql activity .
1.682 nicm 1763: .Fl r
1764: reverses the sort order.
1.562 nicm 1765: .Fl f
1.579 nicm 1766: specifies an initial filter: the filter is a format - if it evaluates to zero,
1767: the item in the list is not shown, otherwise it is shown.
1768: If a filter would lead to an empty list, it is ignored.
1.572 nicm 1769: .Fl F
1770: specifies the format for each item in the list.
1.576 nicm 1771: .Fl N
1772: starts without the preview.
1.314 nicm 1773: This command works only if at least one client is attached.
1.76 nicm 1774: .It Xo
1.555 nicm 1775: .Ic choose-tree
1.682 nicm 1776: .Op Fl GNrswZ
1.572 nicm 1777: .Op Fl F Ar format
1.562 nicm 1778: .Op Fl f Ar filter
1.561 nicm 1779: .Op Fl O Ar sort-order
1.555 nicm 1780: .Op Fl t Ar target-pane
1.76 nicm 1781: .Op Ar template
1782: .Xc
1.555 nicm 1783: Put a pane into tree mode, where a session, window or pane may be chosen
1.76 nicm 1784: interactively from a list.
1.298 nicm 1785: .Fl s
1.555 nicm 1786: starts with sessions collapsed and
1.298 nicm 1787: .Fl w
1.555 nicm 1788: with windows collapsed.
1.593 nicm 1789: .Fl Z
1790: zooms the pane.
1.555 nicm 1791: The following keys may be used in tree mode:
1792: .Bl -column "Key" "Function" -offset indent
1793: .It Sy "Key" Ta Sy "Function"
1794: .It Li "Enter" Ta "Choose selected item"
1795: .It Li "Up" Ta "Select previous item"
1796: .It Li "Down" Ta "Select next item"
1.594 nicm 1797: .It Li "x" Ta "Kill selected item"
1798: .It Li "X" Ta "Kill tagged items"
1.566 nicm 1799: .It Li "<" Ta "Scroll list of previews left"
1800: .It Li ">" Ta "Scroll list of previews right"
1.559 nicm 1801: .It Li "C-s" Ta "Search by name"
1802: .It Li "n" Ta "Repeat last search"
1.555 nicm 1803: .It Li "t" Ta "Toggle if item is tagged"
1804: .It Li "T" Ta "Tag no items"
1805: .It Li "C-t" Ta "Tag all items"
1.557 nicm 1806: .It Li "\&:" Ta "Run a command for each tagged item"
1.555 nicm 1807: .It Li "f" Ta "Enter a format to filter items"
1.682 nicm 1808: .It Li "O" Ta "Change sort field"
1809: .It Li "r" Ta "Reverse sort order"
1.576 nicm 1810: .It Li "v" Ta "Toggle preview"
1.555 nicm 1811: .It Li "q" Ta "Exit mode"
1812: .El
1.320 nicm 1813: .Pp
1.555 nicm 1814: After a session, window or pane is chosen,
1.76 nicm 1815: .Ql %%
1.555 nicm 1816: is replaced by the target in
1.76 nicm 1817: .Ar template
1818: and the result executed as a command.
1819: If
1820: .Ar template
1.555 nicm 1821: is not given, "switch-client -t '%%'" is used.
1822: .Pp
1.561 nicm 1823: .Fl O
1.682 nicm 1824: specifies the initial sort field: one of
1.561 nicm 1825: .Ql index ,
1826: .Ql name ,
1827: or
1828: .Ql time .
1.682 nicm 1829: .Fl r
1830: reverses the sort order.
1.562 nicm 1831: .Fl f
1.579 nicm 1832: specifies an initial filter: the filter is a format - if it evaluates to zero,
1833: the item in the list is not shown, otherwise it is shown.
1834: If a filter would lead to an empty list, it is ignored.
1.572 nicm 1835: .Fl F
1836: specifies the format for each item in the tree.
1.576 nicm 1837: .Fl N
1838: starts without the preview.
1.586 nicm 1839: .Fl G
1840: includes all sessions in any session groups in the tree rather than only the
1841: first.
1.314 nicm 1842: This command works only if at least one client is attached.
1.491 nicm 1843: .It Xo
1844: .Ic display-panes
1.616 nicm 1845: .Op Fl b
1.573 nicm 1846: .Op Fl d Ar duration
1.491 nicm 1847: .Op Fl t Ar target-client
1848: .Op Ar template
1849: .Xc
1.398 nicm 1850: .D1 (alias: Ic displayp )
1.78 nicm 1851: Display a visible indicator of each pane shown by
1852: .Ar target-client .
1853: See the
1.573 nicm 1854: .Ic display-panes-colour
1.78 nicm 1855: and
1.145 nicm 1856: .Ic display-panes-active-colour
1.78 nicm 1857: session options.
1.573 nicm 1858: The indicator is closed when a key is pressed or
1859: .Ar duration
1860: milliseconds have passed.
1861: If
1862: .Fl d
1863: is not given,
1864: .Ic display-panes-time
1865: is used.
1866: A duration of zero means the indicator stays until a key is pressed.
1.491 nicm 1867: While the indicator is on screen, a pane may be chosen with the
1.84 nicm 1868: .Ql 0
1869: to
1870: .Ql 9
1.491 nicm 1871: keys, which will cause
1872: .Ar template
1873: to be executed as a command with
1874: .Ql %%
1875: substituted by the pane ID.
1876: The default
1877: .Ar template
1878: is "select-pane -t '%%'".
1.616 nicm 1879: With
1880: .Fl b ,
1881: other commands are not blocked from running until the indicator is closed.
1.57 jmc 1882: .It Xo Ic find-window
1.670 nicm 1883: .Op Fl rCNTZ
1.555 nicm 1884: .Op Fl t Ar target-pane
1.57 jmc 1885: .Ar match-string
1886: .Xc
1887: .D1 (alias: Ic findw )
1.670 nicm 1888: Search for a
1.57 jmc 1889: .Xr fnmatch 3
1.670 nicm 1890: pattern or, with
1891: .Fl r ,
1892: regular expression
1.57 jmc 1893: .Ar match-string
1894: in window names, titles, and visible content (but not history).
1.285 nicm 1895: The flags control matching behavior:
1896: .Fl C
1897: matches only visible window contents,
1898: .Fl N
1899: matches only the window name and
1900: .Fl T
1901: matches only the window title.
1902: The default is
1903: .Fl CNT .
1.608 nicm 1904: .Fl Z
1905: zooms the pane.
1.555 nicm 1906: .Pp
1.314 nicm 1907: This command works only if at least one client is attached.
1.137 nicm 1908: .It Xo Ic join-pane
1.697 nicm 1909: .Op Fl bdfhv
1.690 nicm 1910: .Op Fl l Ar size
1.137 nicm 1911: .Op Fl s Ar src-pane
1912: .Op Fl t Ar dst-pane
1913: .Xc
1914: .D1 (alias: Ic joinp )
1915: Like
1916: .Ic split-window ,
1917: but instead of splitting
1918: .Ar dst-pane
1919: and creating a new pane, split it and move
1920: .Ar src-pane
1921: into the space.
1922: This can be used to reverse
1923: .Ic break-pane .
1.277 nicm 1924: The
1925: .Fl b
1926: option causes
1927: .Ar src-pane
1928: to be joined to left of or above
1929: .Ar dst-pane .
1.432 nicm 1930: .Pp
1931: If
1932: .Fl s
1933: is omitted and a marked pane is present (see
1934: .Ic select-pane
1935: .Fl m ) ,
1936: the marked pane is used rather than the current pane.
1.112 nicm 1937: .It Xo Ic kill-pane
1938: .Op Fl a
1939: .Op Fl t Ar target-pane
1940: .Xc
1.57 jmc 1941: .D1 (alias: Ic killp )
1942: Destroy the given pane.
1943: If no panes remain in the containing window, it is also destroyed.
1.112 nicm 1944: The
1945: .Fl a
1946: option kills all but the pane given with
1947: .Fl t .
1.289 nicm 1948: .It Xo Ic kill-window
1949: .Op Fl a
1950: .Op Fl t Ar target-window
1951: .Xc
1.57 jmc 1952: .D1 (alias: Ic killw )
1953: Kill the current window or the window at
1954: .Ar target-window ,
1.1 nicm 1955: removing it from any sessions to which it is linked.
1.289 nicm 1956: The
1957: .Fl a
1958: option kills all but the window given with
1959: .Fl t .
1.398 nicm 1960: .It Xo Ic last-pane
1.681 nicm 1961: .Op Fl deZ
1.398 nicm 1962: .Op Fl t Ar target-window
1963: .Xc
1.187 nicm 1964: .D1 (alias: Ic lastp )
1965: Select the last (previously selected) pane.
1.681 nicm 1966: .Fl Z
1967: keeps the window zoomed if it was zoomed.
1.398 nicm 1968: .Fl e
1969: enables or
1970: .Fl d
1971: disables input to the pane.
1.56 jmc 1972: .It Ic last-window Op Fl t Ar target-session
1.1 nicm 1973: .D1 (alias: Ic last )
1974: Select the last (previously selected) window.
1975: If no
1976: .Ar target-session
1977: is specified, select the last window of the current session.
1978: .It Xo Ic link-window
1.439 nicm 1979: .Op Fl adk
1.1 nicm 1980: .Op Fl s Ar src-window
1981: .Op Fl t Ar dst-window
1982: .Xc
1983: .D1 (alias: Ic linkw )
1984: Link the window at
1985: .Ar src-window
1986: to the specified
1987: .Ar dst-window .
1988: If
1989: .Ar dst-window
1990: is specified and no such window exists, the
1991: .Ar src-window
1992: is linked there.
1.439 nicm 1993: With
1994: .Fl a ,
1995: the window is moved to the next index up (following windows
1996: are moved if necessary).
1.1 nicm 1997: If
1998: .Fl k
1999: is given and
2000: .Ar dst-window
2001: exists, it is killed, otherwise an error is generated.
2002: If
2003: .Fl d
2004: is given, the newly linked window is not selected.
1.214 nicm 2005: .It Xo Ic list-panes
2006: .Op Fl as
1.245 nicm 2007: .Op Fl F Ar format
1.214 nicm 2008: .Op Fl t Ar target
2009: .Xc
1.104 nicm 2010: .D1 (alias: Ic lsp )
1.214 nicm 2011: If
2012: .Fl a
2013: is given,
2014: .Ar target
2015: is ignored and all panes on the server are listed.
2016: If
2017: .Fl s
2018: is given,
2019: .Ar target
2020: is a session (or the current session).
2021: If neither is given,
2022: .Ar target
2023: is a window (or the current window).
1.247 nicm 2024: For the meaning of the
2025: .Fl F
2026: flag, see the
2027: .Sx FORMATS
2028: section.
1.214 nicm 2029: .It Xo Ic list-windows
2030: .Op Fl a
1.245 nicm 2031: .Op Fl F Ar format
1.214 nicm 2032: .Op Fl t Ar target-session
2033: .Xc
1.1 nicm 2034: .D1 (alias: Ic lsw )
1.214 nicm 2035: If
2036: .Fl a
2037: is given, list all windows on the server.
2038: Otherwise, list windows in the current session or in
1.1 nicm 2039: .Ar target-session .
1.245 nicm 2040: For the meaning of the
2041: .Fl F
2042: flag, see the
2043: .Sx FORMATS
2044: section.
1.277 nicm 2045: .It Xo Ic move-pane
2046: .Op Fl bdhv
1.690 nicm 2047: .Op Fl l Ar size
1.277 nicm 2048: .Op Fl s Ar src-pane
2049: .Op Fl t Ar dst-pane
2050: .Xc
2051: .D1 (alias: Ic movep )
2052: Like
2053: .Ic join-pane ,
2054: but
2055: .Ar src-pane
2056: and
2057: .Ar dst-pane
2058: may belong to the same window.
1.1 nicm 2059: .It Xo Ic move-window
1.439 nicm 2060: .Op Fl ardk
1.1 nicm 2061: .Op Fl s Ar src-window
2062: .Op Fl t Ar dst-window
2063: .Xc
2064: .D1 (alias: Ic movew )
2065: This is similar to
2066: .Ic link-window ,
2067: except the window at
2068: .Ar src-window
2069: is moved to
2070: .Ar dst-window .
1.291 nicm 2071: With
2072: .Fl r ,
2073: all windows in the session are renumbered in sequential order, respecting
2074: the
2075: .Ic base-index
2076: option.
1.1 nicm 2077: .It Xo Ic new-window
1.201 nicm 2078: .Op Fl adkP
1.272 nicm 2079: .Op Fl c Ar start-directory
1.641 nicm 2080: .Op Fl e Ar environment
1.351 nicm 2081: .Op Fl F Ar format
1.1 nicm 2082: .Op Fl n Ar window-name
2083: .Op Fl t Ar target-window
1.153 nicm 2084: .Op Ar shell-command
1.1 nicm 2085: .Xc
2086: .D1 (alias: Ic neww )
2087: Create a new window.
1.160 nicm 2088: With
2089: .Fl a ,
2090: the new window is inserted at the next index up from the specified
2091: .Ar target-window ,
2092: moving windows up if necessary,
2093: otherwise
2094: .Ar target-window
2095: is the new window location.
2096: .Pp
1.1 nicm 2097: If
2098: .Fl d
2099: is given, the session does not make the new window the current window.
2100: .Ar target-window
1.28 nicm 2101: represents the window to be created; if the target already exists an error is
2102: shown, unless the
2103: .Fl k
2104: flag is used, in which case it is destroyed.
1.153 nicm 2105: .Ar shell-command
1.1 nicm 2106: is the command to execute.
2107: If
1.153 nicm 2108: .Ar shell-command
2109: is not specified, the value of the
2110: .Ic default-command
2111: option is used.
1.272 nicm 2112: .Fl c
2113: specifies the working directory in which the new window is created.
1.153 nicm 2114: .Pp
2115: When the shell command completes, the window closes.
2116: See the
2117: .Ic remain-on-exit
2118: option to change this behaviour.
1.1 nicm 2119: .Pp
1.641 nicm 2120: .Fl e
2121: takes the form
2122: .Ql VARIABLE=value
2123: and sets an environment variable for the newly created window; it may be
2124: specified multiple times.
2125: .Pp
1.1 nicm 2126: The
2127: .Ev TERM
2128: environment variable must be set to
1.523 nicm 2129: .Ql screen
2130: or
2131: .Ql tmux
1.1 nicm 2132: for all programs running
2133: .Em inside
2134: .Nm .
2135: New windows will automatically have
1.523 nicm 2136: .Ql TERM=screen
1.1 nicm 2137: added to their environment, but care must be taken not to reset this in shell
1.641 nicm 2138: start-up files or by the
2139: .Fl e
2140: option.
1.201 nicm 2141: .Pp
2142: The
2143: .Fl P
1.279 nicm 2144: option prints information about the new window after it has been created.
2145: By default, it uses the format
2146: .Ql #{session_name}:#{window_index}
2147: but a different format may be specified with
2148: .Fl F .
1.56 jmc 2149: .It Ic next-layout Op Fl t Ar target-window
1.1 nicm 2150: .D1 (alias: Ic nextl )
2151: Move a window to the next layout and rearrange the panes to fit.
2152: .It Xo Ic next-window
1.9 nicm 2153: .Op Fl a
1.1 nicm 2154: .Op Fl t Ar target-session
2155: .Xc
2156: .D1 (alias: Ic next )
2157: Move to the next window in the session.
1.9 nicm 2158: If
1.12 jmc 2159: .Fl a
1.295 nicm 2160: is used, move to the next window with an alert.
1.107 nicm 2161: .It Xo Ic pipe-pane
1.591 nicm 2162: .Op Fl IOo
1.107 nicm 2163: .Op Fl t Ar target-pane
1.153 nicm 2164: .Op Ar shell-command
1.107 nicm 2165: .Xc
2166: .D1 (alias: Ic pipep )
1.591 nicm 2167: Pipe output sent by the program in
1.107 nicm 2168: .Ar target-pane
1.591 nicm 2169: to a shell command or vice versa.
2170: A pane may only be connected to one command at a time, any existing pipe is
1.107 nicm 2171: closed before
1.153 nicm 2172: .Ar shell-command
1.107 nicm 2173: is executed.
1.174 nicm 2174: The
2175: .Ar shell-command
2176: string may contain the special character sequences supported by the
2177: .Ic status-left
1.231 nicm 2178: option.
1.107 nicm 2179: If no
1.153 nicm 2180: .Ar shell-command
1.107 nicm 2181: is given, the current pipe (if any) is closed.
1.591 nicm 2182: .Pp
2183: .Fl I
2184: and
2185: .Fl O
2186: specify which of the
2187: .Ar shell-command
2188: output streams are connected to the pane:
2189: with
2190: .Fl I
2191: stdout is connected (so anything
2192: .Ar shell-command
2193: prints is written to the pane as if it were typed);
2194: with
2195: .Fl O
2196: stdin is connected (so any output in the pane is piped to
2197: .Ar shell-command ) .
2198: Both may be used together and if neither are specified,
2199: .Fl O
2200: is used.
1.107 nicm 2201: .Pp
2202: The
2203: .Fl o
2204: option only opens a new pipe if no previous pipe exists, allowing a pipe to
2205: be toggled with a single key, for example:
2206: .Bd -literal -offset indent
1.174 nicm 2207: bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1.107 nicm 2208: .Ed
1.176 nicm 2209: .It Xo Ic previous-layout
2210: .Op Fl t Ar target-window
2211: .Xc
2212: .D1 (alias: Ic prevl )
2213: Move to the previous layout in the session.
1.1 nicm 2214: .It Xo Ic previous-window
1.9 nicm 2215: .Op Fl a
1.1 nicm 2216: .Op Fl t Ar target-session
2217: .Xc
2218: .D1 (alias: Ic prev )
2219: Move to the previous window in the session.
1.9 nicm 2220: With
2221: .Fl a ,
1.295 nicm 2222: move to the previous window with an alert.
1.1 nicm 2223: .It Xo Ic rename-window
2224: .Op Fl t Ar target-window
2225: .Ar new-name
2226: .Xc
2227: .D1 (alias: Ic renamew )
2228: Rename the current window, or the window at
2229: .Ar target-window
2230: if specified, to
2231: .Ar new-name .
2232: .It Xo Ic resize-pane
1.419 nicm 2233: .Op Fl DLMRUZ
1.52 nicm 2234: .Op Fl t Ar target-pane
1.324 nicm 2235: .Op Fl x Ar width
2236: .Op Fl y Ar height
1.1 nicm 2237: .Op Ar adjustment
2238: .Xc
2239: .D1 (alias: Ic resizep )
1.324 nicm 2240: Resize a pane, up, down, left or right by
2241: .Ar adjustment
2242: with
2243: .Fl U ,
1.57 jmc 2244: .Fl D ,
2245: .Fl L
1.324 nicm 2246: or
2247: .Fl R ,
2248: or
2249: to an absolute size
2250: with
2251: .Fl x
2252: or
2253: .Fl y .
1.57 jmc 2254: The
2255: .Ar adjustment
1.690 nicm 2256: is given in lines or columns (the default is 1);
2257: .Fl x
2258: and
2259: .Fl y
2260: may be a given as a number of lines or columns or followed by
2261: .Ql %
2262: for a percentage of the window size (for example
2263: .Ql -x 10% ) .
1.337 nicm 2264: With
2265: .Fl Z ,
1.349 nicm 2266: the active pane is toggled between zoomed (occupying the whole of the window)
2267: and unzoomed (its normal position in the layout).
1.419 nicm 2268: .Pp
2269: .Fl M
2270: begins mouse resizing (only valid if bound to a mouse key binding, see
1.420 jmc 2271: .Sx MOUSE SUPPORT ) .
1.629 nicm 2272: .It Xo Ic resize-window
2273: .Op Fl aADLRU
2274: .Op Fl t Ar target-window
2275: .Op Fl x Ar width
2276: .Op Fl y Ar height
2277: .Op Ar adjustment
2278: .Xc
2279: .D1 (alias: Ic resizew )
2280: Resize a window, up, down, left or right by
2281: .Ar adjustment
2282: with
2283: .Fl U ,
2284: .Fl D ,
2285: .Fl L
2286: or
2287: .Fl R ,
2288: or
2289: to an absolute size
2290: with
2291: .Fl x
2292: or
2293: .Fl y .
2294: The
2295: .Ar adjustment
2296: is given in lines or cells (the default is 1).
2297: .Fl A
2298: sets the size of the largest session containing the window;
2299: .Fl a
2300: the size of the smallest.
2301: This command will automatically set
2302: .Ic window-size
2303: to manual in the window options.
1.234 nicm 2304: .It Xo Ic respawn-pane
1.641 nicm 2305: .Op Fl k
1.568 nicm 2306: .Op Fl c Ar start-directory
1.641 nicm 2307: .Op Fl e Ar environment
1.234 nicm 2308: .Op Fl t Ar target-pane
2309: .Op Ar shell-command
2310: .Xc
2311: .D1 (alias: Ic respawnp )
2312: Reactivate a pane in which the command has exited (see the
2313: .Ic remain-on-exit
2314: window option).
2315: If
2316: .Ar shell-command
2317: is not given, the command used when the pane was created is executed.
2318: The pane must be already inactive, unless
2319: .Fl k
2320: is given, in which case any existing command is killed.
1.568 nicm 2321: .Fl c
2322: specifies a new working directory for the pane.
1.641 nicm 2323: The
2324: .Fl e
2325: option has the same meaning as for the
2326: .Ic new-window
2327: command.
1.57 jmc 2328: .It Xo Ic respawn-window
1.641 nicm 2329: .Op Fl k
1.568 nicm 2330: .Op Fl c Ar start-directory
1.641 nicm 2331: .Op Fl e Ar environment
1.57 jmc 2332: .Op Fl t Ar target-window
1.153 nicm 2333: .Op Ar shell-command
1.57 jmc 2334: .Xc
2335: .D1 (alias: Ic respawnw )
1.153 nicm 2336: Reactivate a window in which the command has exited (see the
1.57 jmc 2337: .Ic remain-on-exit
2338: window option).
2339: If
1.153 nicm 2340: .Ar shell-command
1.57 jmc 2341: is not given, the command used when the window was created is executed.
2342: The window must be already inactive, unless
2343: .Fl k
2344: is given, in which case any existing command is killed.
1.568 nicm 2345: .Fl c
2346: specifies a new working directory for the window.
1.641 nicm 2347: The
2348: .Fl e
2349: option has the same meaning as for the
2350: .Ic new-window
2351: command.
1.57 jmc 2352: .It Xo Ic rotate-window
1.681 nicm 2353: .Op Fl DUZ
1.57 jmc 2354: .Op Fl t Ar target-window
2355: .Xc
2356: .D1 (alias: Ic rotatew )
2357: Rotate the positions of the panes within a window, either upward (numerically
2358: lower) with
2359: .Fl U
2360: or downward (numerically higher).
1.681 nicm 2361: .Fl Z
2362: keeps the window zoomed if it was zoomed.
1.57 jmc 2363: .It Xo Ic select-layout
1.588 nicm 2364: .Op Fl Enop
2365: .Op Fl t Ar target-pane
1.57 jmc 2366: .Op Ar layout-name
2367: .Xc
1.176 nicm 2368: .D1 (alias: Ic selectl )
1.57 jmc 2369: Choose a specific layout for a window.
2370: If
2371: .Ar layout-name
1.181 nicm 2372: is not given, the last preset layout used (if any) is reapplied.
1.204 nicm 2373: .Fl n
2374: and
2375: .Fl p
2376: are equivalent to the
2377: .Ic next-layout
2378: and
2379: .Ic previous-layout
2380: commands.
1.424 nicm 2381: .Fl o
2382: applies the last set layout if possible (undoes the most recent layout change).
1.588 nicm 2383: .Fl E
2384: spreads the current pane and any panes next to it out evenly.
1.156 nicm 2385: .It Xo Ic select-pane
1.681 nicm 2386: .Op Fl DdeLlMmRUZ
1.577 nicm 2387: .Op Fl T Ar title
1.156 nicm 2388: .Op Fl t Ar target-pane
2389: .Xc
1.57 jmc 2390: .D1 (alias: Ic selectp )
2391: Make pane
2392: .Ar target-pane
2393: the active pane in window
1.673 jmc 2394: .Ar target-window .
1.156 nicm 2395: If one of
2396: .Fl D ,
2397: .Fl L ,
2398: .Fl R ,
2399: or
2400: .Fl U
2401: is used, respectively the pane below, to the left, to the right, or above the
2402: target pane is used.
1.681 nicm 2403: .Fl Z
2404: keeps the window zoomed if it was zoomed.
1.204 nicm 2405: .Fl l
2406: is the same as using the
2407: .Ic last-pane
2408: command.
1.398 nicm 2409: .Fl e
2410: enables or
2411: .Fl d
2412: disables input to the pane.
1.668 nicm 2413: .Fl T
2414: sets the pane title.
1.418 nicm 2415: .Pp
1.432 nicm 2416: .Fl m
2417: and
2418: .Fl M
2419: are used to set and clear the
2420: .Em marked pane .
2421: There is one marked pane at a time, setting a new marked pane clears the last.
2422: The marked pane is the default target for
2423: .Fl s
2424: to
2425: .Ic join-pane ,
2426: .Ic swap-pane
2427: and
2428: .Ic swap-window .
1.204 nicm 2429: .It Xo Ic select-window
1.310 nicm 2430: .Op Fl lnpT
1.204 nicm 2431: .Op Fl t Ar target-window
2432: .Xc
1.57 jmc 2433: .D1 (alias: Ic selectw )
2434: Select the window at
2435: .Ar target-window .
1.204 nicm 2436: .Fl l ,
2437: .Fl n
2438: and
2439: .Fl p
2440: are equivalent to the
2441: .Ic last-window ,
2442: .Ic next-window
2443: and
2444: .Ic previous-window
2445: commands.
1.310 nicm 2446: If
2447: .Fl T
2448: is given and the selected window is already the current window,
2449: the command behaves like
2450: .Ic last-window .
1.57 jmc 2451: .It Xo Ic split-window
1.643 nicm 2452: .Op Fl bdfhIvP
1.272 nicm 2453: .Op Fl c Ar start-directory
1.641 nicm 2454: .Op Fl e Ar environment
1.690 nicm 2455: .Op Fl l Ar size
1.136 nicm 2456: .Op Fl t Ar target-pane
1.153 nicm 2457: .Op Ar shell-command
1.279 nicm 2458: .Op Fl F Ar format
1.57 jmc 2459: .Xc
1.176 nicm 2460: .D1 (alias: Ic splitw )
1.136 nicm 2461: Create a new pane by splitting
2462: .Ar target-pane :
1.57 jmc 2463: .Fl h
2464: does a horizontal split and
2465: .Fl v
2466: a vertical split; if neither is specified,
2467: .Fl v
2468: is assumed.
2469: The
2470: .Fl l
1.690 nicm 2471: option specifies the size of the new pane in lines (for vertical split) or in
2472: columns (for horizontal split);
2473: .Ar size
2474: may be followed by
2475: .Ql %
2476: to specify a percentage of the available space.
1.408 nicm 2477: The
2478: .Fl b
2479: option causes the new pane to be created to the left of or above
2480: .Ar target-pane .
1.494 nicm 2481: The
2482: .Fl f
2483: option creates a new pane spanning the full window height (with
2484: .Fl h )
2485: or full window width (with
2486: .Fl v ) ,
2487: instead of splitting the active pane.
1.643 nicm 2488: .Pp
2489: An empty
2490: .Ar shell-command
2491: ('') will create a pane with no command running in it.
2492: Output can be sent to such a pane with the
2493: .Ic display-message
2494: command.
2495: The
2496: .Fl I
2497: flag (if
2498: .Ar shell-command
2499: is not specified or empty)
2500: will create an empty pane and forward any output from stdin to it.
2501: For example:
2502: .Bd -literal -offset indent
2503: $ make 2>&1|tmux splitw -dI &
2504: .Ed
2505: .Pp
1.136 nicm 2506: All other options have the same meaning as for the
1.57 jmc 2507: .Ic new-window
2508: command.
2509: .It Xo Ic swap-pane
1.681 nicm 2510: .Op Fl dDUZ
1.57 jmc 2511: .Op Fl s Ar src-pane
2512: .Op Fl t Ar dst-pane
2513: .Xc
2514: .D1 (alias: Ic swapp )
2515: Swap two panes.
2516: If
2517: .Fl U
2518: is used and no source pane is specified with
2519: .Fl s ,
2520: .Ar dst-pane
2521: is swapped with the previous pane (before it numerically);
2522: .Fl D
2523: swaps with the next pane (after it numerically).
1.138 nicm 2524: .Fl d
2525: instructs
2526: .Nm
1.681 nicm 2527: not to change the active pane and
2528: .Fl Z
2529: keeps the window zoomed if it was zoomed.
1.432 nicm 2530: .Pp
2531: If
2532: .Fl s
2533: is omitted and a marked pane is present (see
2534: .Ic select-pane
2535: .Fl m ) ,
2536: the marked pane is used rather than the current pane.
1.57 jmc 2537: .It Xo Ic swap-window
2538: .Op Fl d
2539: .Op Fl s Ar src-window
2540: .Op Fl t Ar dst-window
2541: .Xc
2542: .D1 (alias: Ic swapw )
2543: This is similar to
2544: .Ic link-window ,
2545: except the source and destination windows are swapped.
2546: It is an error if no window exists at
2547: .Ar src-window .
1.705 nicm 2548: If
2549: .Fl d
2550: is given, the new window does not become the current window.
1.432 nicm 2551: .Pp
1.705 nicm 2552: If
1.432 nicm 2553: .Fl s
2554: is omitted and a marked pane is present (see
2555: .Ic select-pane
2556: .Fl m ) ,
2557: the window containing the marked pane is used rather than the current window.
1.57 jmc 2558: .It Xo Ic unlink-window
1.1 nicm 2559: .Op Fl k
2560: .Op Fl t Ar target-window
2561: .Xc
1.57 jmc 2562: .D1 (alias: Ic unlinkw )
2563: Unlink
2564: .Ar target-window .
2565: Unless
2566: .Fl k
2567: is given, a window may be unlinked only if it is linked to multiple sessions -
2568: windows may not be linked to no sessions;
2569: if
1.1 nicm 2570: .Fl k
1.57 jmc 2571: is specified and the window is linked to only one session, it is unlinked and
2572: destroyed.
2573: .El
2574: .Sh KEY BINDINGS
1.93 nicm 2575: .Nm
2576: allows a command to be bound to most keys, with or without a prefix key.
2577: When specifying keys, most represent themselves (for example
2578: .Ql A
2579: to
1.95 jmc 2580: .Ql Z ) .
1.93 nicm 2581: Ctrl keys may be prefixed with
2582: .Ql C-
2583: or
1.95 jmc 2584: .Ql ^ ,
2585: and Alt (meta) with
1.93 nicm 2586: .Ql M- .
2587: In addition, the following special key names are accepted:
1.126 nicm 2588: .Em Up ,
2589: .Em Down ,
2590: .Em Left ,
2591: .Em Right ,
1.93 nicm 2592: .Em BSpace ,
2593: .Em BTab ,
2594: .Em DC
2595: (Delete),
2596: .Em End ,
2597: .Em Enter ,
2598: .Em Escape ,
2599: .Em F1
2600: to
1.402 nicm 2601: .Em F12 ,
1.93 nicm 2602: .Em Home ,
2603: .Em IC
2604: (Insert),
1.254 nicm 2605: .Em NPage/PageDown/PgDn ,
2606: .Em PPage/PageUp/PgUp ,
1.93 nicm 2607: .Em Space ,
2608: and
2609: .Em Tab .
2610: Note that to bind the
2611: .Ql \&"
2612: or
2613: .Ql '
2614: keys, quotation marks are necessary, for example:
2615: .Bd -literal -offset indent
2616: bind-key '"' split-window
1.167 nicm 2617: bind-key "'" new-window
1.93 nicm 2618: .Ed
1.693 nicm 2619: .Pp
2620: A command bound to the
2621: .Em Any
2622: key will execute for all keys which do not have a more specific binding.
1.93 nicm 2623: .Pp
1.57 jmc 2624: Commands related to key bindings are as follows:
2625: .Bl -tag -width Ds
2626: .It Xo Ic bind-key
1.501 nicm 2627: .Op Fl nr
1.706 nicm 2628: .Op Fl N Ar note
1.421 nicm 2629: .Op Fl T Ar key-table
1.57 jmc 2630: .Ar key Ar command Op Ar arguments
1.1 nicm 2631: .Xc
1.57 jmc 2632: .D1 (alias: Ic bind )
2633: Bind key
2634: .Ar key
2635: to
2636: .Ar command .
1.421 nicm 2637: Keys are bound in a key table.
2638: By default (without -T), the key is bound in
2639: the
2640: .Em prefix
2641: key table.
2642: This table is used for keys pressed after the prefix key (for example,
2643: by default
2644: .Ql c
2645: is bound to
2646: .Ic new-window
2647: in the
2648: .Em prefix
2649: table, so
2650: .Ql C-b c
2651: creates a new window).
2652: The
2653: .Em root
2654: table is used for keys pressed without the prefix key: binding
2655: .Ql c
2656: to
2657: .Ic new-window
2658: in the
2659: .Em root
2660: table (not recommended) means a plain
2661: .Ql c
2662: will create a new window.
1.57 jmc 2663: .Fl n
1.421 nicm 2664: is an alias
2665: for
2666: .Fl T Ar root .
2667: Keys may also be bound in custom key tables and the
2668: .Ic switch-client
2669: .Fl T
2670: command used to switch to them from a key binding.
1.1 nicm 2671: The
1.57 jmc 2672: .Fl r
2673: flag indicates this key may repeat, see the
2674: .Ic repeat-time
2675: option.
1.706 nicm 2676: .Fl N
2677: attaches a note to the key (shown with
2678: .Ic list-keys
2679: .Fl N ) .
1.57 jmc 2680: .Pp
2681: To view the default bindings and possible commands, see the
2682: .Ic list-keys
2683: command.
1.421 nicm 2684: .It Xo Ic list-keys
1.706 nicm 2685: .Op Fl 1N
2686: .Op Fl P Ar prefix-string Fl T Ar key-table
2687: .Op key
1.421 nicm 2688: .Xc
1.57 jmc 2689: .D1 (alias: Ic lsk )
2690: List all key bindings.
1.706 nicm 2691: By default this shows all keys or any bindings for
2692: .Ar key
2693: in the syntax of the
2694: .Ic bind-key
2695: command.
2696: .Fl N
2697: instead show keys and attached notes, i
2698: .Ar key-table
2699: if given or in the
2700: .Em root
2701: and
2702: .Em prefix
2703: key tables by default.
2704: .Fl P
2705: specifies a prefix to print before each key.
2706: With
2707: .Fl 1
2708: only the first matching key and note is shown.
2709: .Pp
1.57 jmc 2710: Without
1.706 nicm 2711: .Fl N ,
1.421 nicm 2712: .Fl T
1.706 nicm 2713: prints only keys in
2714: .Ar key-table ,
2715: otherwise all key tables are printed.
1.57 jmc 2716: .It Xo Ic send-keys
1.694 nicm 2717: .Op Fl FHlMRX
1.497 nicm 2718: .Op Fl N Ar repeat-count
1.72 nicm 2719: .Op Fl t Ar target-pane
1.57 jmc 2720: .Ar key Ar ...
1.1 nicm 2721: .Xc
1.57 jmc 2722: .D1 (alias: Ic send )
2723: Send a key or keys to a window.
2724: Each argument
2725: .Ar key
2726: is the name of the key (such as
2727: .Ql C-a
2728: or
1.523 nicm 2729: .Ql NPage )
2730: to send; if the string is not recognised as a key, it is sent as a series of
1.57 jmc 2731: characters.
1.676 nicm 2732: All arguments are sent sequentially from first to last.
2733: .Pp
1.273 nicm 2734: The
2735: .Fl l
1.676 nicm 2736: flag disables key name lookup and processes the keys as literal UTF-8
2737: characters.
2738: The
2739: .Fl H
2740: flag expects each key to be a hexadecimal number for an ASCII character.
2741: .Pp
1.265 nicm 2742: The
2743: .Fl R
2744: flag causes the terminal state to be reset.
1.419 nicm 2745: .Pp
2746: .Fl M
2747: passes through a mouse event (only valid if bound to a mouse key binding, see
1.420 jmc 2748: .Sx MOUSE SUPPORT ) .
1.497 nicm 2749: .Pp
2750: .Fl X
2751: is used to send a command into copy mode - see
2752: the
2753: .Sx WINDOWS AND PANES
2754: section.
2755: .Fl N
1.694 nicm 2756: specifies a repeat count and
2757: .Fl F
2758: expands formats in arguments where appropriate.
1.267 nicm 2759: .It Xo Ic send-prefix
2760: .Op Fl 2
2761: .Op Fl t Ar target-pane
2762: .Xc
2763: Send the prefix key, or with
2764: .Fl 2
2765: the secondary prefix key, to a window as if it was pressed.
1.57 jmc 2766: .It Xo Ic unbind-key
1.501 nicm 2767: .Op Fl an
1.421 nicm 2768: .Op Fl T Ar key-table
1.57 jmc 2769: .Ar key
1.2 nicm 2770: .Xc
1.57 jmc 2771: .D1 (alias: Ic unbind )
2772: Unbind the command bound to
2773: .Ar key .
1.530 nicm 2774: .Fl n
2775: and
1.421 nicm 2776: .Fl T
2777: are the same as for
2778: .Ic bind-key .
1.189 nicm 2779: If
2780: .Fl a
2781: is present, all key bindings are removed.
1.57 jmc 2782: .El
2783: .Sh OPTIONS
2784: The appearance and behaviour of
2785: .Nm
2786: may be modified by changing the value of various options.
1.668 nicm 2787: There are four types of option:
1.133 nicm 2788: .Em server options ,
1.57 jmc 2789: .Em session options
1.668 nicm 2790: .Em window options
1.57 jmc 2791: and
1.668 nicm 2792: .Em pane options .
1.57 jmc 2793: .Pp
1.133 nicm 2794: The
2795: .Nm
1.686 nicm 2796: server has a set of global server options which do not apply to any particular
1.668 nicm 2797: window or session or pane.
1.133 nicm 2798: These are altered with the
2799: .Ic set-option
2800: .Fl s
2801: command, or displayed with the
2802: .Ic show-options
2803: .Fl s
2804: command.
2805: .Pp
2806: In addition, each individual session may have a set of session options, and
2807: there is a separate set of global session options.
1.57 jmc 2808: Sessions which do not have a particular option configured inherit the value
2809: from the global session options.
2810: Session options are set or unset with the
2811: .Ic set-option
2812: command and may be listed with the
2813: .Ic show-options
2814: command.
1.133 nicm 2815: The available server and session options are listed under the
1.57 jmc 2816: .Ic set-option
2817: command.
2818: .Pp
1.668 nicm 2819: Similarly, a set of window options is attached to each window and a set of pane
2820: options to each pane.
2821: Pane options inherit from window options.
2822: This means any pane option may be set as a window option to apply the option to
2823: all panes in the window without the option set, for example these commands will
2824: set the background colour to red for all panes except pane 0:
2825: .Bd -literal -offset indent
2826: set -w window-style bg=red
2827: set -pt:.0 window-style bg=blue
2828: .Ed
2829: .Pp
2830: There is also a set of global window options from which any unset window or
2831: pane options are inherited.
2832: Window and pane options are altered with
2833: .Ic set-option
2834: .Fl w
2835: and
2836: .Fl p
2837: commands and displayed with
2838: .Ic show-option
2839: .Fl w
2840: and
2841: .Fl p .
1.318 nicm 2842: .Pp
2843: .Nm
2844: also supports user options which are prefixed with a
2845: .Ql \&@ .
1.321 jmc 2846: User options may have any name, so long as they are prefixed with
2847: .Ql \&@ ,
1.318 nicm 2848: and be set to any string.
1.418 nicm 2849: For example:
1.318 nicm 2850: .Bd -literal -offset indent
2851: $ tmux setw -q @foo "abc123"
2852: $ tmux showw -v @foo
2853: abc123
2854: .Ed
1.57 jmc 2855: .Pp
2856: Commands which set options are as follows:
2857: .Bl -tag -width Ds
1.1 nicm 2858: .It Xo Ic set-option
1.668 nicm 2859: .Op Fl aFgopqsuw
2860: .Op Fl t Ar target-pane
1.1 nicm 2861: .Ar option Ar value
2862: .Xc
2863: .D1 (alias: Ic set )
1.668 nicm 2864: Set a pane option with
2865: .Fl p ,
2866: a window option with
2867: .Fl w ,
1.133 nicm 2868: a server option with
2869: .Fl s ,
2870: otherwise a session option.
1.637 nicm 2871: If the option is not a user option,
2872: .Fl w
1.668 nicm 2873: or
1.637 nicm 2874: .Fl s
1.668 nicm 2875: may be unnecessary -
1.637 nicm 2876: .Nm
1.668 nicm 2877: will infer the type from the option name, assuming
2878: .Fl w
2879: for pane options.
1.133 nicm 2880: If
2881: .Fl g
1.433 nicm 2882: is given, the global session or window option is set.
1.637 nicm 2883: .Pp
1.550 nicm 2884: .Fl F
2885: expands formats in the option value.
1.1 nicm 2886: The
2887: .Fl u
2888: flag unsets an option, so a session inherits the option from the global
1.433 nicm 2889: options (or with
2890: .Fl g ,
2891: restores a global option to the default).
1.336 nicm 2892: .Pp
2893: The
2894: .Fl o
1.446 nicm 2895: flag prevents setting an option that is already set and the
1.281 nicm 2896: .Fl q
1.446 nicm 2897: flag suppresses errors about unknown or ambiguous options.
1.281 nicm 2898: .Pp
1.378 nicm 2899: With
2900: .Fl a ,
2901: and if the option expects a string or a style,
2902: .Ar value
2903: is appended to the existing setting.
2904: For example:
2905: .Bd -literal -offset indent
2906: set -g status-left "foo"
2907: set -ag status-left "bar"
2908: .Ed
2909: .Pp
2910: Will result in
2911: .Ql foobar .
2912: And:
2913: .Bd -literal -offset indent
2914: set -g status-style "bg=red"
2915: set -ag status-style "fg=blue"
2916: .Ed
2917: .Pp
2918: Will result in a red background
2919: .Em and
2920: blue foreground.
2921: Without
2922: .Fl a ,
2923: the result would be the default background and a blue foreground.
1.668 nicm 2924: .It Xo Ic show-options
2925: .Op Fl AgHpqsvw
2926: .Op Fl t Ar target-pane
2927: .Op Ar option
2928: .Xc
2929: .D1 (alias: Ic show )
2930: Show the pane options (or a single option if
2931: .Ar option
2932: is provided) with
2933: .Fl p ,
2934: the window options with
2935: .Fl w ,
2936: the server options with
2937: .Fl s ,
2938: otherwise the session options.
2939: If the option is not a user option,
2940: .Fl w
2941: or
2942: .Fl s
2943: may be unnecessary -
2944: .Nm
2945: will infer the type from the option name, assuming
2946: .Fl w
2947: for pane options.
2948: Global session or window options are listed if
2949: .Fl g
2950: is used.
2951: .Fl v
2952: shows only the option value, not the name.
2953: If
2954: .Fl q
2955: is set, no error will be returned if
2956: .Ar option
2957: is unset.
2958: .Fl H
2959: includes hooks (omitted by default).
2960: .Fl A
2961: includes options inherited from a parent set of options, such options are
2962: marked with an asterisk.
1.274 nicm 2963: .Ar value
2964: depends on the option and may be a number, a string, or a flag (on, off, or
2965: omitted to toggle).
1.668 nicm 2966: .El
1.133 nicm 2967: .Pp
2968: Available server options are:
2969: .Bl -tag -width Ds
1.695 nicm 2970: .It Ic backspace Ar key
2971: Set the key sent by
2972: .Nm
2973: for backspace.
1.198 nicm 2974: .It Ic buffer-limit Ar number
2975: Set the number of buffers; as new buffers are added to the top of the stack,
2976: old ones are removed from the bottom if necessary to maintain this maximum
2977: length.
1.526 nicm 2978: .It Xo Ic command-alias[]
2979: .Ar name=value
2980: .Xc
2981: This is an array of custom aliases for commands.
2982: If an unknown command matches
2983: .Ar name ,
2984: it is replaced with
2985: .Ar value .
2986: For example, after:
2987: .Pp
1.565 nicm 2988: .Dl set -s command-alias[100] zoom='resize-pane -Z'
1.526 nicm 2989: .Pp
2990: Using:
2991: .Pp
2992: .Dl zoom -t:.1
2993: .Pp
2994: Is equivalent to:
2995: .Pp
2996: .Dl resize-pane -Z -t:.1
2997: .Pp
2998: Note that aliases are expanded when a command is parsed rather than when it is
2999: executed, so binding an alias with
3000: .Ic bind-key
3001: will bind the expanded form.
1.425 nicm 3002: .It Ic default-terminal Ar terminal
3003: Set the default terminal for new windows created in this session - the
3004: default value of the
3005: .Ev TERM
3006: environment variable.
3007: For
3008: .Nm
3009: to work correctly, this
3010: .Em must
3011: be set to
3012: .Ql screen ,
3013: .Ql tmux
3014: or a derivative of them.
1.239 nicm 3015: .It Ic escape-time Ar time
3016: Set the time in milliseconds for which
3017: .Nm
3018: waits after an escape is input to determine if it is part of a function or meta
3019: key sequences.
3020: The default is 500 milliseconds.
1.592 nicm 3021: .It Xo Ic exit-empty
3022: .Op Ic on | off
3023: .Xc
3024: If enabled (the default), the server will exit when there are no active
3025: sessions.
1.239 nicm 3026: .It Xo Ic exit-unattached
3027: .Op Ic on | off
3028: .Xc
3029: If enabled, the server will exit when there are no attached clients.
1.362 nicm 3030: .It Xo Ic focus-events
3031: .Op Ic on | off
3032: .Xc
3033: When enabled, focus events are requested from the terminal if supported and
3034: passed through to applications running in
3035: .Nm .
3036: Attached clients should be detached and attached again after changing this
3037: option.
1.445 nicm 3038: .It Ic history-file Ar path
3039: If not empty, a file to which
3040: .Nm
3041: will write command prompt history on exit and load it from on start.
1.384 nicm 3042: .It Ic message-limit Ar number
3043: Set the number of error or information messages to save in the message log for
3044: each client.
3045: The default is 100.
1.228 nicm 3046: .It Xo Ic set-clipboard
1.556 nicm 3047: .Op Ic on | external | off
1.228 nicm 3048: .Xc
3049: Attempt to set the terminal clipboard content using the
3050: .Xr xterm 1
1.560 nicm 3051: escape sequence, if there is an
1.228 nicm 3052: .Em \&Ms
3053: entry in the
3054: .Xr terminfo 5
1.560 nicm 3055: description (see the
3056: .Sx TERMINFO EXTENSIONS
3057: section).
3058: .Pp
1.556 nicm 3059: If set to
3060: .Ic on ,
3061: .Nm
3062: will both accept the escape sequence to create a buffer and attempt to set
3063: the terminal clipboard.
3064: If set to
3065: .Ic external ,
3066: .Nm
3067: will attempt to set the terminal clipboard but ignore attempts
3068: by applications to set
3069: .Nm
3070: buffers.
3071: If
3072: .Ic off ,
3073: .Nm
3074: will neither accept the clipboard escape sequence nor attempt to set the
3075: clipboard.
3076: .Pp
1.228 nicm 3077: Note that this feature needs to be enabled in
3078: .Xr xterm 1
3079: by setting the resource:
3080: .Bd -literal -offset indent
3081: disallowedWindowOps: 20,21,SetXprop
3082: .Ed
3083: .Pp
3084: Or changing this property from the
3085: .Xr xterm 1
3086: interactive menu when required.
1.528 nicm 3087: .It Ic terminal-overrides[] Ar string
3088: Allow terminal descriptions read using
3089: .Xr terminfo 5
1.531 nicm 3090: to be overridden.
1.528 nicm 3091: Each entry is a colon-separated string made up of a terminal type pattern
3092: (matched using
1.381 nicm 3093: .Xr fnmatch 3 )
3094: and a set of
3095: .Em name=value
3096: entries.
3097: .Pp
3098: For example, to set the
3099: .Ql clear
3100: .Xr terminfo 5
3101: entry to
3102: .Ql \ee[H\ee[2J
1.528 nicm 3103: for all terminal types matching
3104: .Ql rxvt* :
3105: .Pp
3106: .Dl "rxvt*:clear=\ee[H\ee[2J"
1.381 nicm 3107: .Pp
3108: The terminal entry value is passed through
3109: .Xr strunvis 3
3110: before interpretation.
1.678 nicm 3111: .It Ic user-keys[] Ar key
3112: Set list of user-defined key escape sequences.
3113: Each item is associated with a key named
3114: .Ql User0 ,
3115: .Ql User1 ,
3116: and so on.
3117: .Pp
3118: For example:
3119: .Bd -literal -offset indent
3120: set -s user-keys[0] "\ee[5;30012~"
3121: bind User0 resize-pane -L 3
3122: .Ed
1.133 nicm 3123: .El
1.129 nicm 3124: .Pp
1.18 nicm 3125: Available session options are:
1.1 nicm 3126: .Bl -tag -width Ds
1.569 nicm 3127: .It Xo Ic activity-action
3128: .Op Ic any | none | current | other
3129: .Xc
3130: Set action on window activity when
3131: .Ic monitor-activity
3132: is on.
3133: .Ic any
3134: means activity in any window linked to a session causes a bell or message
3135: (depending on
3136: .Ic visual-activity )
3137: in the current window of that session,
3138: .Ic none
3139: means all activity is ignored (equivalent to
3140: .Ic monitor-activity
3141: being off),
3142: .Ic current
3143: means only activity in windows other than the current window are ignored and
3144: .Ic other
3145: means activity in the current window is ignored but not those in other windows.
1.312 nicm 3146: .It Ic assume-paste-time Ar milliseconds
3147: If keys are entered faster than one in
3148: .Ar milliseconds ,
3149: they are assumed to have been pasted rather than typed and
3150: .Nm
3151: key bindings are not processed.
3152: The default is one millisecond and zero disables.
1.69 nicm 3153: .It Ic base-index Ar index
3154: Set the base index from which an unused index should be searched when a new
3155: window is created.
3156: The default is zero.
1.1 nicm 3157: .It Xo Ic bell-action
1.429 nicm 3158: .Op Ic any | none | current | other
1.1 nicm 3159: .Xc
1.574 nicm 3160: Set action on a bell in a window when
3161: .Ic monitor-bell
3162: is on.
1.569 nicm 3163: The values are the same as those for
3164: .Ic activity-action .
1.153 nicm 3165: .It Ic default-command Ar shell-command
1.1 nicm 3166: Set the command used for new windows (if not specified when the window is
3167: created) to
1.153 nicm 3168: .Ar shell-command ,
1.79 nicm 3169: which may be any
3170: .Xr sh 1
3171: command.
1.19 nicm 3172: The default is an empty string, which instructs
3173: .Nm
1.79 nicm 3174: to create a login shell using the value of the
3175: .Ic default-shell
3176: option.
3177: .It Ic default-shell Ar path
3178: Specify the default shell.
3179: This is used as the login shell for new windows when the
3180: .Ic default-command
3181: option is set to empty, and must be the full path of the executable.
3182: When started
3183: .Nm
3184: tries to set a default value from the first suitable of the
1.19 nicm 3185: .Ev SHELL
1.79 nicm 3186: environment variable, the shell returned by
3187: .Xr getpwuid 3 ,
3188: or
3189: .Pa /bin/sh .
3190: This option should be configured when
3191: .Nm
3192: is used as a login shell.
1.629 nicm 3193: .It Ic default-size Ar XxY
1.642 nicm 3194: Set the default size of new windows when the
1.643 nicm 3195: .Ic window-size
1.642 nicm 3196: option is set to manual or when a session is created with
3197: .Ic new-session
3198: .Fl d .
3199: The value is the width and height separated by an
3200: .Ql x
3201: character.
3202: The default is 80x24.
1.206 nicm 3203: .It Xo Ic destroy-unattached
3204: .Op Ic on | off
3205: .Xc
1.185 nicm 3206: If enabled and the session is no longer attached to any clients, it is
3207: destroyed.
1.206 nicm 3208: .It Xo Ic detach-on-destroy
3209: .Op Ic on | off
3210: .Xc
1.184 nicm 3211: If on (the default), the client is detached when the session it is attached to
3212: is destroyed.
3213: If off, the client is switched to the most recently active of the remaining
3214: sessions.
1.145 nicm 3215: .It Ic display-panes-active-colour Ar colour
3216: Set the colour used by the
3217: .Ic display-panes
3218: command to show the indicator for the active pane.
1.78 nicm 3219: .It Ic display-panes-colour Ar colour
1.145 nicm 3220: Set the colour used by the
1.78 nicm 3221: .Ic display-panes
1.145 nicm 3222: command to show the indicators for inactive panes.
1.78 nicm 3223: .It Ic display-panes-time Ar time
3224: Set the time in milliseconds for which the indicators shown by the
3225: .Ic display-panes
3226: command appear.
1.21 nicm 3227: .It Ic display-time Ar time
1.78 nicm 3228: Set the amount of time for which status line messages and other on-screen
3229: indicators are displayed.
1.462 tim 3230: If set to 0, messages and indicators are displayed until a key is pressed.
1.21 nicm 3231: .Ar time
3232: is in milliseconds.
1.1 nicm 3233: .It Ic history-limit Ar lines
3234: Set the maximum number of lines held in window history.
3235: This setting applies only to new windows - existing window histories are not
3236: resized and retain the limit at the point they were created.
1.474 nicm 3237: .It Ic key-table Ar key-table
3238: Set the default key table to
3239: .Ar key-table
3240: instead of
3241: .Em root .
1.1 nicm 3242: .It Ic lock-after-time Ar number
1.100 nicm 3243: Lock the session (like the
3244: .Ic lock-session
1.90 nicm 3245: command) after
1.1 nicm 3246: .Ar number
1.448 nicm 3247: seconds of inactivity.
1.100 nicm 3248: The default is not to lock (set to 0).
1.153 nicm 3249: .It Ic lock-command Ar shell-command
1.90 nicm 3250: Command to run when locking each client.
3251: The default is to run
3252: .Xr lock 1
3253: with
3254: .Fl np .
1.378 nicm 3255: .It Ic message-command-style Ar style
1.623 nicm 3256: Set status line message command style.
3257: For how to specify
3258: .Ar style ,
3259: see the
3260: .Sx STYLES
3261: section.
1.378 nicm 3262: .It Ic message-style Ar style
3263: Set status line message style.
3264: For how to specify
3265: .Ar style ,
3266: see the
1.623 nicm 3267: .Sx STYLES
3268: section.
1.419 nicm 3269: .It Xo Ic mouse
1.226 nicm 3270: .Op Ic on | off
3271: .Xc
3272: If on,
3273: .Nm
1.419 nicm 3274: captures the mouse and allows mouse events to be bound as key bindings.
3275: See the
3276: .Sx MOUSE SUPPORT
3277: section for details.
1.267 nicm 3278: .It Ic prefix Ar key
3279: Set the key accepted as a prefix key.
1.473 nicm 3280: In addition to the standard keys described under
3281: .Sx KEY BINDINGS ,
3282: .Ic prefix
3283: can be set to the special key
3284: .Ql None
3285: to set no prefix.
1.267 nicm 3286: .It Ic prefix2 Ar key
3287: Set a secondary key accepted as a prefix key.
1.473 nicm 3288: Like
3289: .Ic prefix ,
3290: .Ic prefix2
3291: can be set to
3292: .Ql None .
1.291 nicm 3293: .It Xo Ic renumber-windows
3294: .Op Ic on | off
3295: .Xc
3296: If on, when a window is closed in a session, automatically renumber the other
3297: windows in numerical order.
3298: This respects the
3299: .Ic base-index
3300: option if it has been set.
3301: If off, do not renumber the windows.
1.21 nicm 3302: .It Ic repeat-time Ar time
1.1 nicm 3303: Allow multiple commands to be entered without pressing the prefix-key again
3304: in the specified
1.21 nicm 3305: .Ar time
1.1 nicm 3306: milliseconds (the default is 500).
3307: Whether a key repeats may be set when it is bound using the
3308: .Fl r
3309: flag to
3310: .Ic bind-key .
1.52 nicm 3311: Repeat is enabled for the default keys bound to the
3312: .Ic resize-pane
3313: command.
1.1 nicm 3314: .It Xo Ic set-titles
1.56 jmc 3315: .Op Ic on | off
1.1 nicm 3316: .Xc
1.261 nicm 3317: Attempt to set the client terminal title using the
3318: .Em tsl
3319: and
3320: .Em fsl
3321: .Xr terminfo 5
3322: entries if they exist.
3323: .Nm
1.444 nicm 3324: automatically sets these to the \ee]0;...\e007 sequence if
3325: the terminal appears to be
3326: .Xr xterm 1 .
1.11 nicm 3327: This option is off by default.
1.86 nicm 3328: .It Ic set-titles-string Ar string
1.678 nicm 3329: String used to set the client terminal title if
1.86 nicm 3330: .Ic set-titles
3331: is on.
1.414 nicm 3332: Formats are expanded, see the
3333: .Sx FORMATS
3334: section.
1.569 nicm 3335: .It Xo Ic silence-action
3336: .Op Ic any | none | current | other
3337: .Xc
3338: Set action on window silence when
3339: .Ic monitor-silence
3340: is on.
3341: The values are the same as those for
3342: .Ic activity-action .
1.1 nicm 3343: .It Xo Ic status
1.625 nicm 3344: .Op Ic off | on | 2 | 3 | 4 | 5
1.1 nicm 3345: .Xc
1.625 nicm 3346: Show or hide the status line or specify its size.
3347: Using
3348: .Ic on
3349: gives a status line one row in height;
3350: .Ic 2 ,
3351: .Ic 3 ,
3352: .Ic 4
3353: or
3354: .Ic 5
3355: more rows.
3356: .It Ic status-format[] Ar format
3357: Specify the format to be used for each line of the status line.
3358: The default builds the top status line from the various individual status
3359: options below.
1.1 nicm 3360: .It Ic status-interval Ar interval
1.538 nicm 3361: Update the status line every
1.1 nicm 3362: .Ar interval
3363: seconds.
3364: By default, updates will occur every 15 seconds.
3365: A setting of zero disables redrawing at interval.
1.41 nicm 3366: .It Xo Ic status-justify
1.56 jmc 3367: .Op Ic left | centre | right
1.41 nicm 3368: .Xc
3369: Set the position of the window list component of the status line: left, centre
3370: or right justified.
1.1 nicm 3371: .It Xo Ic status-keys
1.56 jmc 3372: .Op Ic vi | emacs
1.1 nicm 3373: .Xc
1.6 jmc 3374: Use vi or emacs-style
1.1 nicm 3375: key bindings in the status line, for example at the command prompt.
1.191 nicm 3376: The default is emacs, unless the
3377: .Ev VISUAL
3378: or
3379: .Ev EDITOR
3380: environment variables are set and contain the string
3381: .Ql vi .
1.1 nicm 3382: .It Ic status-left Ar string
3383: Display
3384: .Ar string
1.538 nicm 3385: (by default the session name) to the left of the status line.
1.1 nicm 3386: .Ar string
3387: will be passed through
1.623 nicm 3388: .Xr strftime 3 .
3389: Also see the
3390: .Sx FORMATS
3391: and
3392: .Sx STYLES
3393: sections.
1.83 nicm 3394: .Pp
1.263 nicm 3395: For details on how the names and titles can be set see the
1.261 nicm 3396: .Sx "NAMES AND TITLES"
3397: section.
1.109 nicm 3398: .Pp
1.83 nicm 3399: Examples are:
3400: .Bd -literal -offset indent
3401: #(sysctl vm.loadavg)
3402: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
3403: .Ed
1.10 nicm 3404: .Pp
1.405 nicm 3405: The default is
3406: .Ql "[#S] " .
1.1 nicm 3407: .It Ic status-left-length Ar length
3408: Set the maximum
3409: .Ar length
1.538 nicm 3410: of the left component of the status line.
1.1 nicm 3411: The default is 10.
1.378 nicm 3412: .It Ic status-left-style Ar style
3413: Set the style of the left part of the status line.
3414: For how to specify
3415: .Ar style ,
3416: see the
1.623 nicm 3417: .Sx STYLES
3418: section.
1.269 nicm 3419: .It Xo Ic status-position
3420: .Op Ic top | bottom
3421: .Xc
3422: Set the position of the status line.
1.1 nicm 3423: .It Ic status-right Ar string
3424: Display
3425: .Ar string
1.538 nicm 3426: to the right of the status line.
1.577 nicm 3427: By default, the current pane title in double quotes, the date and the time
1.151 nicm 3428: are shown.
1.1 nicm 3429: As with
3430: .Ic status-left ,
3431: .Ar string
3432: will be passed to
1.459 jmc 3433: .Xr strftime 3
3434: and character pairs are replaced.
1.1 nicm 3435: .It Ic status-right-length Ar length
3436: Set the maximum
3437: .Ar length
1.538 nicm 3438: of the right component of the status line.
1.1 nicm 3439: The default is 40.
1.378 nicm 3440: .It Ic status-right-style Ar style
3441: Set the style of the right part of the status line.
3442: For how to specify
3443: .Ar style ,
3444: see the
1.623 nicm 3445: .Sx STYLES
3446: section.
1.378 nicm 3447: .It Ic status-style Ar style
3448: Set status line style.
3449: For how to specify
3450: .Ar style ,
3451: see the
1.623 nicm 3452: .Sx STYLES
3453: section.
1.529 nicm 3454: .It Ic update-environment[] Ar variable
3455: Set list of environment variables to be copied into the session environment
3456: when a new session is created or an existing session is attached.
1.63 nicm 3457: Any variables that do not exist in the source environment are set to be
3458: removed from the session environment (as if
3459: .Fl r
3460: was given to the
3461: .Ic set-environment
3462: command).
1.37 nicm 3463: .It Xo Ic visual-activity
1.569 nicm 3464: .Op Ic on | off | both
1.37 nicm 3465: .Xc
1.569 nicm 3466: If on, display a message instead of sending a bell when activity occurs in a
3467: window for which the
1.37 nicm 3468: .Ic monitor-activity
3469: window option is enabled.
1.569 nicm 3470: If set to both, a bell and a message are produced.
1.37 nicm 3471: .It Xo Ic visual-bell
1.569 nicm 3472: .Op Ic on | off | both
1.37 nicm 3473: .Xc
1.574 nicm 3474: If on, a message is shown on a bell in a window for which the
3475: .Ic monitor-bell
3476: window option is enabled instead of it being passed through to the
1.569 nicm 3477: terminal (which normally makes a sound).
3478: If set to both, a bell and a message are produced.
1.37 nicm 3479: Also see the
3480: .Ic bell-action
3481: option.
1.192 nicm 3482: .It Xo Ic visual-silence
1.569 nicm 3483: .Op Ic on | off | both
1.192 nicm 3484: .Xc
3485: If
3486: .Ic monitor-silence
1.569 nicm 3487: is enabled, prints a message after the interval has expired on a given window
3488: instead of sending a bell.
3489: If set to both, a bell and a message are produced.
1.255 nicm 3490: .It Ic word-separators Ar string
3491: Sets the session's conception of what characters are considered word
3492: separators, for the purposes of the next and previous word commands in
3493: copy mode.
3494: The default is
3495: .Ql \ -_@ .
1.1 nicm 3496: .El
3497: .Pp
1.668 nicm 3498: Available window options are:
1.56 jmc 3499: .Pp
3500: .Bl -tag -width Ds -compact
1.1 nicm 3501: .It Xo Ic aggressive-resize
1.56 jmc 3502: .Op Ic on | off
1.1 nicm 3503: .Xc
3504: Aggressively resize the chosen window.
3505: This means that
3506: .Nm
1.642 nicm 3507: will resize the window to the size of the smallest or largest session
3508: (see the
3509: .Ic window-size
3510: option) for which it is the current window, rather than the session to
3511: which it is attached.
3512: The window may resize when the current window is changed on another
3513: session; this option is good for full-screen programs which support
1.6 jmc 3514: .Dv SIGWINCH
3515: and poor for interactive programs such as shells.
1.262 nicm 3516: .Pp
1.1 nicm 3517: .It Xo Ic automatic-rename
1.56 jmc 3518: .Op Ic on | off
1.1 nicm 3519: .Xc
3520: Control automatic window renaming.
3521: When this setting is enabled,
3522: .Nm
1.368 nicm 3523: will rename the window automatically using the format specified by
3524: .Ic automatic-rename-format .
1.1 nicm 3525: This flag is automatically disabled for an individual window when a name
3526: is specified at creation with
1.186 nicm 3527: .Ic new-window
3528: or
1.1 nicm 3529: .Ic new-session ,
3530: or later with
1.261 nicm 3531: .Ic rename-window ,
3532: or with a terminal escape sequence.
1.1 nicm 3533: It may be switched off globally with:
3534: .Bd -literal -offset indent
1.668 nicm 3535: set-option -wg automatic-rename off
1.1 nicm 3536: .Ed
1.368 nicm 3537: .Pp
3538: .It Ic automatic-rename-format Ar format
3539: The format (see
3540: .Sx FORMATS )
3541: used when the
3542: .Ic automatic-rename
3543: option is enabled.
1.56 jmc 3544: .Pp
1.1 nicm 3545: .It Ic clock-mode-colour Ar colour
3546: Set clock colour.
1.56 jmc 3547: .Pp
1.1 nicm 3548: .It Xo Ic clock-mode-style
1.56 jmc 3549: .Op Ic 12 | 24
1.1 nicm 3550: .Xc
3551: Set clock hour format.
1.56 jmc 3552: .Pp
1.196 nicm 3553: .It Ic main-pane-height Ar height
1.2 nicm 3554: .It Ic main-pane-width Ar width
3555: Set the width or height of the main (left or top) pane in the
3556: .Ic main-horizontal
3557: or
3558: .Ic main-vertical
3559: layouts.
1.56 jmc 3560: .Pp
1.1 nicm 3561: .It Xo Ic mode-keys
1.56 jmc 3562: .Op Ic vi | emacs
1.1 nicm 3563: .Xc
1.500 nicm 3564: Use vi or emacs-style key bindings in copy mode.
3565: The default is emacs, unless
1.191 nicm 3566: .Ev VISUAL
3567: or
3568: .Ev EDITOR
3569: contains
3570: .Ql vi .
1.56 jmc 3571: .Pp
1.378 nicm 3572: .It Ic mode-style Ar style
3573: Set window modes style.
3574: For how to specify
3575: .Ar style ,
3576: see the
1.623 nicm 3577: .Sx STYLES
3578: section.
1.378 nicm 3579: .Pp
1.1 nicm 3580: .It Xo Ic monitor-activity
1.56 jmc 3581: .Op Ic on | off
1.1 nicm 3582: .Xc
3583: Monitor for activity in the window.
3584: Windows with activity are highlighted in the status line.
1.56 jmc 3585: .Pp
1.574 nicm 3586: .It Xo Ic monitor-bell
3587: .Op Ic on | off
3588: .Xc
3589: Monitor for a bell in the window.
3590: Windows with a bell are highlighted in the status line.
3591: .Pp
1.192 nicm 3592: .It Xo Ic monitor-silence
3593: .Op Ic interval
3594: .Xc
3595: Monitor for silence (no activity) in the window within
3596: .Ic interval
3597: seconds.
3598: Windows that have been silent for the interval are highlighted in the
3599: status line.
3600: An interval of zero disables the monitoring.
1.195 nicm 3601: .Pp
3602: .It Ic other-pane-height Ar height
3603: Set the height of the other panes (not the main pane) in the
3604: .Ic main-horizontal
3605: layout.
3606: If this option is set to 0 (the default), it will have no effect.
3607: If both the
3608: .Ic main-pane-height
3609: and
3610: .Ic other-pane-height
3611: options are set, the main pane will grow taller to make the other panes the
3612: specified height, but will never shrink to do so.
3613: .Pp
3614: .It Ic other-pane-width Ar width
3615: Like
3616: .Ic other-pane-height ,
3617: but set the width of other panes in the
3618: .Ic main-vertical
3619: layout.
1.243 nicm 3620: .Pp
1.413 nicm 3621: .It Ic pane-active-border-style Ar style
3622: Set the pane border style for the currently active pane.
3623: For how to specify
3624: .Ar style ,
3625: see the
1.623 nicm 3626: .Sx STYLES
3627: section.
1.413 nicm 3628: Attributes are ignored.
3629: .Pp
1.243 nicm 3630: .It Ic pane-base-index Ar index
3631: Like
3632: .Ic base-index ,
3633: but set the starting index for pane numbers.
1.484 nicm 3634: .Pp
3635: .It Ic pane-border-format Ar format
3636: Set the text shown in pane border status lines.
3637: .Pp
3638: .It Xo Ic pane-border-status
3639: .Op Ic off | top | bottom
3640: .Xc
3641: Turn pane border status lines off or set their position.
1.413 nicm 3642: .Pp
3643: .It Ic pane-border-style Ar style
3644: Set the pane border style for panes aside from the active pane.
3645: For how to specify
3646: .Ar style ,
3647: see the
1.623 nicm 3648: .Sx STYLES
3649: section.
1.413 nicm 3650: Attributes are ignored.
1.192 nicm 3651: .Pp
1.99 nicm 3652: .It Xo Ic synchronize-panes
3653: .Op Ic on | off
3654: .Xc
1.164 nicm 3655: Duplicate input to any pane to all other panes in the same window (only
3656: for panes that are not in any special mode).
1.56 jmc 3657: .Pp
1.378 nicm 3658: .It Ic window-status-activity-style Ar style
3659: Set status line style for windows with an activity alert.
3660: For how to specify
3661: .Ar style ,
3662: see the
1.623 nicm 3663: .Sx STYLES
3664: section.
1.169 nicm 3665: .Pp
1.378 nicm 3666: .It Ic window-status-bell-style Ar style
3667: Set status line style for windows with a bell alert.
3668: For how to specify
3669: .Ar style ,
3670: see the
1.623 nicm 3671: .Sx STYLES
3672: section.
1.169 nicm 3673: .Pp
1.125 nicm 3674: .It Ic window-status-current-format Ar string
3675: Like
3676: .Ar window-status-format ,
3677: but is the format used when the window is the current window.
1.307 nicm 3678: .Pp
1.378 nicm 3679: .It Ic window-status-current-style Ar style
3680: Set status line style for the currently active window.
3681: For how to specify
3682: .Ar style ,
3683: see the
1.623 nicm 3684: .Sx STYLES
3685: section.
1.239 nicm 3686: .Pp
3687: .It Ic window-status-format Ar string
3688: Set the format in which the window is displayed in the status line window list.
3689: See the
1.623 nicm 3690: .Sx FORMATS
3691: and
3692: .Sx STYLES
3693: sections.
1.290 nicm 3694: .Pp
1.378 nicm 3695: .It Ic window-status-last-style Ar style
3696: Set status line style for the last active window.
3697: For how to specify
3698: .Ar style ,
3699: see the
1.623 nicm 3700: .Sx STYLES
3701: section.
1.378 nicm 3702: .Pp
1.290 nicm 3703: .It Ic window-status-separator Ar string
3704: Sets the separator drawn between windows in the status line.
3705: The default is a single space character.
1.125 nicm 3706: .Pp
1.378 nicm 3707: .It Ic window-status-style Ar style
3708: Set status line style for a single window.
1.418 nicm 3709: For how to specify
3710: .Ar style ,
3711: see the
1.623 nicm 3712: .Sx STYLES
3713: section.
1.418 nicm 3714: .Pp
1.642 nicm 3715: .It Xo Ic window-size
1.689 nicm 3716: .Ar largest | Ar smallest | Ar manual | Ar latest
1.642 nicm 3717: .Xc
3718: Configure how
3719: .Nm
3720: determines the window size.
3721: If set to
3722: .Ar largest ,
3723: the size of the largest attached session is used; if
3724: .Ar smallest ,
3725: the size of the smallest.
3726: If
3727: .Ar manual ,
3728: the size of a new window is set from the
3729: .Ic default-size
3730: option and windows are resized automatically.
1.689 nicm 3731: With
3732: .Ar latest ,
3733: .Nm
3734: uses the size of the client that had the most recent activity.
1.642 nicm 3735: See also the
3736: .Ic resize-window
3737: command and the
3738: .Ic aggressive-resize
3739: option.
3740: .Pp
1.512 nicm 3741: .It Xo Ic wrap-search
3742: .Op Ic on | off
3743: .Xc
3744: If this option is set, searches will wrap around the end of the pane contents.
3745: The default is on.
1.513 nicm 3746: .Pp
1.1 nicm 3747: .It Xo Ic xterm-keys
1.56 jmc 3748: .Op Ic on | off
1.1 nicm 3749: .Xc
3750: If this option is set,
3751: .Nm
3752: will generate
1.57 jmc 3753: .Xr xterm 1 -style
3754: function key sequences; these have a number included to indicate modifiers such
3755: as Shift, Alt or Ctrl.
3756: .El
1.668 nicm 3757: .Pp
3758: Available pane options are:
3759: .Pp
3760: .Bl -tag -width Ds -compact
1.669 nicm 3761: .It Xo Ic allow-rename
3762: .Op Ic on | off
3763: .Xc
3764: Allow programs in the pane to change the window name using a terminal escape
3765: sequence (\eek...\ee\e\e).
3766: .Pp
3767: .It Xo Ic alternate-screen
3768: .Op Ic on | off
3769: .Xc
3770: This option configures whether programs running inside the pane may use the
3771: terminal alternate screen feature, which allows the
3772: .Em smcup
3773: and
3774: .Em rmcup
3775: .Xr terminfo 5
3776: capabilities.
3777: The alternate screen feature preserves the contents of the window when an
3778: interactive application starts and restores it on exit, so that any output
3779: visible before the application starts reappears unchanged after it exits.
3780: .Pp
1.668 nicm 3781: .It Xo Ic remain-on-exit
3782: .Op Ic on | off
1.57 jmc 3783: .Xc
1.668 nicm 3784: A pane with this flag set is not destroyed when the program running in it
3785: exits.
3786: The pane may be reactivated with the
3787: .Ic respawn-pane
3788: command.
3789: .Pp
3790: .It Ic window-active-style Ar style
3791: Set the pane style when it is the active pane.
3792: For how to specify
3793: .Ar style ,
3794: see the
3795: .Sx STYLES
3796: section.
3797: .Pp
3798: .It Ic window-style Ar style
3799: Set the pane style.
3800: For how to specify
3801: .Ar style ,
3802: see the
3803: .Sx STYLES
3804: section.
1.63 nicm 3805: .El
1.469 nicm 3806: .Sh HOOKS
3807: .Nm
3808: allows commands to run on various triggers, called
3809: .Em hooks .
1.505 nicm 3810: Most
1.483 nicm 3811: .Nm
1.505 nicm 3812: commands have an
1.483 nicm 3813: .Em after
3814: hook and there are a number of hooks not associated with commands.
3815: .Pp
1.640 nicm 3816: Hooks are stored as array options, members of the array are executed in
3817: order when the hook is triggered.
3818: Hooks may be configured with the
3819: .Ic set-hook
3820: or
3821: .Ic set-option
3822: commands and displayed with
3823: .Ic show-hooks
3824: or
3825: .Ic show-options
3826: .Fl H .
3827: The following two commands are equivalent:
3828: .Bd -literal -offset indent.
3829: set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red'
3830: set-option -g pane-mode-changed[42] 'set -g status-left-style bg=red'
3831: .Ed
3832: .Pp
3833: Setting a hook without specifying an array index clears the hook and sets the
3834: first member of the array.
3835: .Pp
1.505 nicm 3836: A command's after
3837: hook is run after it completes, except when the command is run as part of a hook
1.483 nicm 3838: itself.
1.505 nicm 3839: They are named with an
1.483 nicm 3840: .Ql after-
3841: prefix.
3842: For example, the following command adds a hook to select the even-vertical
3843: layout after every
3844: .Ic split-window :
3845: .Bd -literal -offset indent
1.640 nicm 3846: set-hook -g after-split-window "selectl even-vertical"
1.483 nicm 3847: .Ed
3848: .Pp
1.584 nicm 3849: All the notifications listed in the
3850: .Sx CONTROL MODE
3851: section are hooks (without any arguments), except
3852: .Ic %exit .
3853: The following additional hooks are available:
1.560 nicm 3854: .Bl -tag -width "XXXXXXXXXXXXXXXXXXXXXX"
1.476 nicm 3855: .It alert-activity
3856: Run when a window has activity.
3857: See
3858: .Ic monitor-activity .
3859: .It alert-bell
3860: Run when a window has received a bell.
1.574 nicm 3861: See
3862: .Ic monitor-bell .
1.476 nicm 3863: .It alert-silence
3864: Run when a window has been silent.
3865: See
3866: .Ic monitor-silence .
1.469 nicm 3867: .It client-attached
3868: Run when a client is attached.
3869: .It client-detached
3870: Run when a client is detached
3871: .It client-resized
3872: Run when a client is resized.
1.511 nicm 3873: .It client-session-changed
3874: Run when a client's attached session is changed.
1.475 nicm 3875: .It pane-died
3876: Run when the program running in a pane exits, but
3877: .Ic remain-on-exit
3878: is on so the pane has not closed.
3879: .It pane-exited
3880: Run when the program running in a pane exits.
1.603 nicm 3881: .It pane-focus-in
3882: Run when the focus enters a pane, if the
3883: .Ic focus-events
3884: option is on.
3885: .It pane-focus-out
3886: Run when the focus exits a pane, if the
3887: .Ic focus-events
3888: option is on.
1.560 nicm 3889: .It pane-set-clipboard
3890: Run when the terminal clipboard is set using the
3891: .Xr xterm 1
3892: escape sequence.
1.510 nicm 3893: .It session-created
3894: Run when a new session created.
3895: .It session-closed
3896: Run when a session closed.
1.507 nicm 3897: .It session-renamed
3898: Run when a session is renamed.
1.511 nicm 3899: .It window-linked
3900: Run when a window is linked into a session.
1.507 nicm 3901: .It window-renamed
3902: Run when a window is renamed.
1.511 nicm 3903: .It window-unlinked
3904: Run when a window is unlinked from a session.
1.469 nicm 3905: .El
3906: .Pp
3907: Hooks are managed with these commands:
3908: .Bl -tag -width Ds
3909: .It Xo Ic set-hook
1.640 nicm 3910: .Op Fl agRu
1.469 nicm 3911: .Op Fl t Ar target-session
3912: .Ar hook-name
3913: .Ar command
3914: .Xc
1.604 nicm 3915: Without
1.605 jmc 3916: .Fl R ,
1.604 nicm 3917: sets (or with
1.496 nicm 3918: .Fl u
3919: unsets) hook
1.469 nicm 3920: .Ar hook-name
3921: to
3922: .Ar command .
3923: If
3924: .Fl g
3925: is given,
3926: .Em hook-name
3927: is added to the global list of hooks, otherwise it is added to the session
3928: hooks (for
3929: .Ar target-session
3930: with
3931: .Fl t ) .
1.640 nicm 3932: .Fl a
3933: appends to a hook.
1.469 nicm 3934: Like options, session hooks inherit from the global ones.
1.604 nicm 3935: .Pp
3936: With
3937: .Fl R ,
3938: run
3939: .Ar hook-name
3940: immediately.
1.469 nicm 3941: .It Xo Ic show-hooks
3942: .Op Fl g
3943: .Op Fl t Ar target-session
3944: .Xc
3945: Shows the global list of hooks with
3946: .Fl g ,
3947: otherwise the session hooks.
1.470 jmc 3948: .El
1.419 nicm 3949: .Sh MOUSE SUPPORT
3950: If the
3951: .Ic mouse
3952: option is on (the default is off),
3953: .Nm
3954: allows mouse events to be bound as keys.
3955: The name of each key is made up of a mouse event (such as
3956: .Ql MouseUp1 )
1.632 nicm 3957: and a location suffix, one of the following:
3958: .Bl -column "XXXXXXXXXXXXX" -offset indent
3959: .It Li "Pane" Ta "the contents of a pane"
3960: .It Li "Border" Ta "a pane border"
3961: .It Li "Status" Ta "the status line window list"
3962: .It Li "StatusLeft" Ta "the left part of the status line"
3963: .It Li "StatusRight" Ta "the right part of the status line"
3964: .It Li "StatusDefault" Ta "any other part of the status line"
3965: .El
3966: .Pp
1.419 nicm 3967: The following mouse events are available:
3968: .Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent
1.498 nicm 3969: .It Li "WheelUp" Ta "WheelDown" Ta ""
1.481 nicm 3970: .It Li "MouseDown1" Ta "MouseUp1" Ta "MouseDrag1" Ta "MouseDragEnd1"
3971: .It Li "MouseDown2" Ta "MouseUp2" Ta "MouseDrag2" Ta "MouseDragEnd2"
3972: .It Li "MouseDown3" Ta "MouseUp3" Ta "MouseDrag3" Ta "MouseDragEnd3"
1.590 nicm 3973: .It Li "DoubleClick1" Ta "DoubleClick2" Ta "DoubleClick3"
3974: .It Li "TripleClick1" Ta "TripleClick2" Ta "TripleClick3"
1.419 nicm 3975: .El
3976: .Pp
3977: Each should be suffixed with a location, for example
3978: .Ql MouseDown1Status .
3979: .Pp
1.423 nicm 3980: The special token
3981: .Ql {mouse}
3982: or
1.419 nicm 3983: .Ql =
3984: may be used as
3985: .Ar target-window
3986: or
3987: .Ar target-pane
3988: in commands bound to mouse key bindings.
3989: It resolves to the window or pane over which the mouse event took place
3990: (for example, the window in the status line over which button 1 was released for a
3991: .Ql MouseUp1Status
3992: binding, or the pane over which the wheel was scrolled for a
3993: .Ql WheelDownPane
3994: binding).
3995: .Pp
3996: The
3997: .Ic send-keys
3998: .Fl M
3999: flag may be used to forward a mouse event to a pane.
4000: .Pp
4001: The default key bindings allow the mouse to be used to select and resize panes,
4002: to copy text and to change window using the status line.
4003: These take effect if the
4004: .Ic mouse
4005: option is turned on.
1.245 nicm 4006: .Sh FORMATS
1.294 nicm 4007: Certain commands accept the
1.245 nicm 4008: .Fl F
4009: flag with a
4010: .Ar format
4011: argument.
4012: This is a string which controls the output format of the command.
1.678 nicm 4013: Format variables are enclosed in
1.245 nicm 4014: .Ql #{
4015: and
4016: .Ql } ,
4017: for example
1.359 nicm 4018: .Ql #{session_name} .
1.409 nicm 4019: The possible variables are listed in the table below, or the name of a
4020: .Nm
4021: option may be used for an option's value.
4022: Some variables have a shorter alias such as
1.598 nicm 4023: .Ql #S ;
1.376 nicm 4024: .Ql ##
4025: is replaced by a single
1.598 nicm 4026: .Ql # ,
4027: .Ql #,
4028: by a
4029: .Ql \&,
4030: and
4031: .Ql #}
4032: by a
4033: .Ql } .
1.409 nicm 4034: .Pp
4035: Conditionals are available by prefixing with
1.246 jmc 4036: .Ql \&?
1.245 nicm 4037: and separating two alternatives with a comma;
4038: if the specified variable exists and is not zero, the first alternative
1.246 jmc 4039: is chosen, otherwise the second is used.
4040: For example
1.245 nicm 4041: .Ql #{?session_attached,attached,not attached}
4042: will include the string
4043: .Ql attached
4044: if the session is attached and the string
4045: .Ql not attached
1.409 nicm 4046: if it is unattached, or
4047: .Ql #{?automatic-rename,yes,no}
4048: will include
4049: .Ql yes
4050: if
4051: .Ic automatic-rename
4052: is enabled, or
4053: .Ql no
4054: if not.
1.599 nicm 4055: Conditionals can be nested arbitrarily.
4056: Inside a conditional,
4057: .Ql \&,
4058: and
4059: .Ql }
4060: must be escaped as
4061: .Ql #,
4062: and
4063: .Ql #} ,
4064: unless they are part of a
4065: .Ql #{...}
1.600 nicm 4066: replacement.
4067: For example:
1.599 nicm 4068: .Bd -literal -offset indent
4069: #{?pane_in_mode,#[fg=white#,bg=red],#[fg=red#,bg=white]}#W .
4070: .Ed
1.520 nicm 4071: .Pp
1.678 nicm 4072: String comparisons may be expressed by prefixing two comma-separated
1.520 nicm 4073: alternatives by
1.652 nicm 4074: .Ql == ,
4075: .Ql != ,
4076: .Ql < ,
4077: .Ql > ,
4078: .Ql <=
1.520 nicm 4079: or
1.652 nicm 4080: .Ql >=
1.520 nicm 4081: and a colon.
4082: For example
1.544 nicm 4083: .Ql #{==:#{host},myhost}
1.520 nicm 4084: will be replaced by
4085: .Ql 1
4086: if running on
4087: .Ql myhost ,
4088: otherwise by
1.554 nicm 4089: .Ql 0 .
4090: .Ql ||
4091: and
4092: .Ql &&
4093: evaluate to true if either or both of two comma-separated alternatives are
4094: true, for example
1.595 nicm 4095: .Ql #{||:#{pane_in_mode},#{alternate_on}} .
1.664 nicm 4096: .Pp
4097: An
4098: .Ql m
4099: specifies an
4100: .Xr fnmatch 3
4101: or regular expression comparison.
4102: The first argument is the pattern and the second the string to compare.
4103: An optional third argument specifies flags:
4104: .Ql r
4105: means the pattern is a regular expression instead of the default
4106: .Xr fnmatch 3
4107: pattern, and
4108: .Ql i
4109: means to ignore case.
4110: For example:
4111: .Ql #{m:*foo*,#{host}}
4112: or
4113: .Ql #{m/ri:^A,MYVAR} .
1.554 nicm 4114: A
4115: .Ql C
4116: performs a search for an
4117: .Xr fnmatch 3
1.664 nicm 4118: pattern or regular expression in the pane content and evaluates to zero if not
4119: found, or a line number if found.
4120: Like
4121: .Ql m ,
1.665 jmc 4122: an
1.664 nicm 4123: .Ql r
4124: flag means search for a regular expression and
4125: .Ql i
4126: ignores case.
4127: For example:
4128: .Ql #{C/r:^Start}
1.453 nicm 4129: .Pp
1.367 nicm 4130: A limit may be placed on the length of the resultant string by prefixing it
4131: by an
4132: .Ql = ,
1.479 nicm 4133: a number and a colon.
4134: Positive numbers count from the start of the string and negative from the end,
4135: so
4136: .Ql #{=5:pane_title}
1.653 nicm 4137: will include at most the first five characters of the pane title, or
1.479 nicm 4138: .Ql #{=-5:pane_title}
1.653 nicm 4139: the last five characters.
4140: A suffix or prefix may be given as a second argument - if provided then it is
4141: appended or prepended to the string if the length has been trimmed, for example
4142: .Ql #{=/5/...:pane_title}
4143: will append
4144: .Ql ...
4145: if the pane title is more than five characters.
1.698 nicm 4146: Similarly,
4147: .Ql p
4148: pads the string to a given width, for example
4149: .Ql #{p10:pane_title}
4150: will result in a width of at least 10 characters.
4151: A positive width pads on the left, a negative on the right.
1.653 nicm 4152: .Pp
1.453 nicm 4153: Prefixing a time variable with
1.683 nicm 4154: .Ql t:\&
1.453 nicm 4155: will convert it to a string, so if
4156: .Ql #{window_activity}
4157: gives
1.454 jmc 4158: .Ql 1445765102 ,
1.453 nicm 4159: .Ql #{t:window_activity}
4160: gives
4161: .Ql Sun Oct 25 09:25:02 2015 .
4162: The
1.683 nicm 4163: .Ql b:\&
1.453 nicm 4164: and
1.683 nicm 4165: .Ql d:\&
1.453 nicm 4166: prefixes are
4167: .Xr basename 3
4168: and
4169: .Xr dirname 3
4170: of the variable respectively.
1.683 nicm 4171: .Ql q:\&
1.610 nicm 4172: will escape
4173: .Xr sh 1
4174: special characters.
1.683 nicm 4175: .Ql E:\&
1.617 nicm 4176: will expand the format twice, for example
4177: .Ql #{E:status-left}
4178: is the result of expanding the content of the
4179: .Ic status-left
1.671 nicm 4180: option rather than the option itself.
1.683 nicm 4181: .Ql T:\&
1.620 nicm 4182: is like
1.683 nicm 4183: .Ql E:\&
1.620 nicm 4184: but also expands
4185: .Xr strftime 3
4186: specifiers.
1.683 nicm 4187: .Ql S:\& ,
4188: .Ql W:\&
1.618 nicm 4189: or
1.683 nicm 4190: .Ql P:\&
1.618 nicm 4191: will loop over each session, window or pane and insert the format once
1.619 nicm 4192: for each.
4193: For windows and panes, two comma-separated formats may be given:
4194: the second is used for the current window or active pane.
4195: For example, to get a list of windows formatted like the status line:
1.618 nicm 4196: .Bd -literal -offset indent
4197: #{W:#{E:window-status-format} ,#{E:window-status-current-format} }
4198: .Ed
1.625 nicm 4199: .Pp
1.461 nicm 4200: A prefix of the form
1.683 nicm 4201: .Ql s/foo/bar/:\&
1.461 nicm 4202: will substitute
4203: .Ql foo
4204: with
4205: .Ql bar
4206: throughout.
1.664 nicm 4207: The first argument may be an extended regular expression and a final argument may be
4208: .Ql i
4209: to ignore case, for example
1.683 nicm 4210: .Ql s/a(.)/\e1x/i:\&
1.664 nicm 4211: would change
4212: .Ql abABab
4213: into
4214: .Ql bxBxbx .
1.431 nicm 4215: .Pp
1.671 nicm 4216: In addition, the last line of a shell command's output may be inserted using
1.431 nicm 4217: .Ql #() .
4218: For example,
4219: .Ql #(uptime)
4220: will insert the system's uptime.
4221: When constructing formats,
4222: .Nm
4223: does not wait for
4224: .Ql #()
4225: commands to finish; instead, the previous result from running the same command is used,
4226: or a placeholder if the command has not been run before.
1.543 nicm 4227: If the command hasn't exited, the most recent line of output will be used, but the status
4228: line will not be updated more than once a second.
1.431 nicm 4229: Commands are executed with the
4230: .Nm
4231: global environment set (see the
1.644 schwarze 4232: .Sx GLOBAL AND SESSION ENVIRONMENT
1.431 nicm 4233: section).
1.671 nicm 4234: .Pp
4235: An
4236: .Ql l
4237: specifies that a string should be interpreted literally and not expanded.
4238: For example
4239: .Ql #{l:#{?pane_in_mode,yes,no}}
4240: will be replaced by
4241: .Ql #{?pane_in_mode,yes,no} .
1.245 nicm 4242: .Pp
4243: The following variables are available, where appropriate:
1.359 nicm 4244: .Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX"
4245: .It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with"
1.678 nicm 4246: .It Li "alternate_on" Ta "" Ta "1 if pane is in alternate screen"
1.359 nicm 4247: .It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen"
4248: .It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen"
1.572 nicm 4249: .It Li "buffer_created" Ta "" Ta "Time buffer created"
1.490 nicm 4250: .It Li "buffer_name" Ta "" Ta "Name of buffer"
1.386 nicm 4251: .It Li "buffer_sample" Ta "" Ta "Sample of start of buffer"
1.359 nicm 4252: .It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes"
1.572 nicm 4253: .It Li "client_activity" Ta "" Ta "Time client last had activity"
1.699 nicm 4254: .It Li "client_cell_height" Ta "" Ta "Height of each client cell in pixels"
4255: .It Li "client_cell_width" Ta "" Ta "Width of each client cell in pixels"
1.646 nicm 4256: .It Li "client_control_mode" Ta "" Ta "1 if client is in control mode"
1.572 nicm 4257: .It Li "client_created" Ta "" Ta "Time client created"
1.542 nicm 4258: .It Li "client_discarded" Ta "" Ta "Bytes discarded when client behind"
1.359 nicm 4259: .It Li "client_height" Ta "" Ta "Height of client"
1.451 nicm 4260: .It Li "client_key_table" Ta "" Ta "Current key table"
1.359 nicm 4261: .It Li "client_last_session" Ta "" Ta "Name of the client's last session"
1.540 nicm 4262: .It Li "client_name" Ta "" Ta "Name of client"
1.437 nicm 4263: .It Li "client_pid" Ta "" Ta "PID of client process"
1.359 nicm 4264: .It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed"
4265: .It Li "client_readonly" Ta "" Ta "1 if client is readonly"
4266: .It Li "client_session" Ta "" Ta "Name of the client's session"
4267: .It Li "client_termname" Ta "" Ta "Terminal name of client"
4268: .It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
1.699 nicm 4269: .It Li "client_utf8" Ta "" Ta "1 if client supports UTF-8"
1.359 nicm 4270: .It Li "client_width" Ta "" Ta "Width of client"
1.541 nicm 4271: .It Li "client_written" Ta "" Ta "Bytes written to client"
1.509 nicm 4272: .It Li "command" Ta "" Ta "Name of command in use, if any"
1.646 nicm 4273: .It Li "command_list_alias" Ta "" Ta "Command alias if listing commands"
1.489 nicm 4274: .It Li "command_list_name" Ta "" Ta "Command name if listing commands"
4275: .It Li "command_list_usage" Ta "" Ta "Command usage if listing commands"
1.692 nicm 4276: .It Li "copy_cursor_line" Ta "" Ta "Line the cursor is on in copy mode"
4277: .It Li "copy_cursor_word" Ta "" Ta "Word under cursor in copy mode"
1.691 nicm 4278: .It Li "copy_cursor_x" Ta "" Ta "Cursor X position in copy mode"
4279: .It Li "copy_cursor_y" Ta "" Ta "Cursor Y position in copy mode"
1.646 nicm 4280: .It Li "cursor_character" Ta "" Ta "Character at cursor in pane"
1.359 nicm 4281: .It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
4282: .It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
4283: .It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"
4284: .It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
4285: .It Li "history_limit" Ta "" Ta "Maximum window history lines"
1.581 nicm 4286: .It Li "history_size" Ta "" Ta "Size of history in lines"
1.509 nicm 4287: .It Li "hook" Ta "" Ta "Name of running hook, if any"
1.511 nicm 4288: .It Li "hook_pane" Ta "" Ta "ID of pane where hook was run, if any"
1.510 nicm 4289: .It Li "hook_session" Ta "" Ta "ID of session where hook was run, if any"
4290: .It Li "hook_session_name" Ta "" Ta "Name of session where hook was run, if any"
4291: .It Li "hook_window" Ta "" Ta "ID of window where hook was run, if any"
4292: .It Li "hook_window_name" Ta "" Ta "Name of window where hook was run, if any"
1.359 nicm 4293: .It Li "host" Ta "#H" Ta "Hostname of local host"
4294: .It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)"
4295: .It Li "insert_flag" Ta "" Ta "Pane insert flag"
4296: .It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag"
4297: .It Li "keypad_flag" Ta "" Ta "Pane keypad flag"
4298: .It Li "line" Ta "" Ta "Line number in the list"
1.646 nicm 4299: .It Li "mouse_all_flag" Ta "" Ta "Pane mouse all flag"
1.359 nicm 4300: .It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag"
4301: .It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag"
1.676 nicm 4302: .It Li "mouse_line" Ta "" Ta "Line under mouse, if any"
4303: .It Li "mouse_sgr_flag" Ta "" Ta "Pane mouse SGR flag"
1.359 nicm 4304: .It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
1.676 nicm 4305: .It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
4306: .It Li "mouse_word" Ta "" Ta "Word under mouse, if any"
1.654 nicm 4307: .It Li "mouse_x" Ta "" Ta "Mouse X position, if any"
4308: .It Li "mouse_y" Ta "" Ta "Mouse Y position, if any"
1.676 nicm 4309: .It Li "origin_flag" Ta "" Ta "Pane origin flag"
1.359 nicm 4310: .It Li "pane_active" Ta "" Ta "1 if active pane"
1.570 nicm 4311: .It Li "pane_at_bottom" Ta "" Ta "1 if pane is at the bottom of window"
4312: .It Li "pane_at_left" Ta "" Ta "1 if pane is at the left of window"
4313: .It Li "pane_at_right" Ta "" Ta "1 if pane is at the right of window"
4314: .It Li "pane_at_top" Ta "" Ta "1 if pane is at the top of window"
1.396 nicm 4315: .It Li "pane_bottom" Ta "" Ta "Bottom of pane"
1.359 nicm 4316: .It Li "pane_current_command" Ta "" Ta "Current command if available"
4317: .It Li "pane_dead" Ta "" Ta "1 if pane is dead"
1.411 nicm 4318: .It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane"
1.696 nicm 4319: .It Li "pane_format" Ta "" Ta "1 if format is for a pane"
1.359 nicm 4320: .It Li "pane_height" Ta "" Ta "Height of pane"
4321: .It Li "pane_id" Ta "#D" Ta "Unique pane ID"
1.678 nicm 4322: .It Li "pane_in_mode" Ta "" Ta "1 if pane is in a mode"
1.646 nicm 4323: .It Li "pane_index" Ta "#P" Ta "Index of pane"
1.678 nicm 4324: .It Li "pane_input_off" Ta "" Ta "1 if input to pane is disabled"
1.396 nicm 4325: .It Li "pane_left" Ta "" Ta "Left of pane"
1.650 nicm 4326: .It Li "pane_marked" Ta "" Ta "1 if this is the marked pane"
4327: .It Li "pane_marked_set" Ta "" Ta "1 if a marked pane is set"
1.678 nicm 4328: .It Li "pane_mode" Ta "" Ta "Name of pane mode, if any"
1.696 nicm 4329: .It Li "pane_path" Ta "#T" Ta "Path of pane (can be set by application)"
1.359 nicm 4330: .It Li "pane_pid" Ta "" Ta "PID of first process in pane"
1.567 nicm 4331: .It Li "pane_pipe" Ta "" Ta "1 if pane is being piped"
1.396 nicm 4332: .It Li "pane_right" Ta "" Ta "Right of pane"
1.546 nicm 4333: .It Li "pane_search_string" Ta "" Ta "Last search string in copy mode"
1.359 nicm 4334: .It Li "pane_start_command" Ta "" Ta "Command pane started with"
1.678 nicm 4335: .It Li "pane_synchronized" Ta "" Ta "1 if pane is synchronized"
1.359 nicm 4336: .It Li "pane_tabs" Ta "" Ta "Pane tab positions"
1.696 nicm 4337: .It Li "pane_title" Ta "#T" Ta "Title of pane (can be set by application)"
1.396 nicm 4338: .It Li "pane_top" Ta "" Ta "Top of pane"
1.359 nicm 4339: .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
4340: .It Li "pane_width" Ta "" Ta "Width of pane"
1.437 nicm 4341: .It Li "pid" Ta "" Ta "Server PID"
1.606 nicm 4342: .It Li "rectangle_toggle" Ta "" Ta "1 if rectangle selection is activated"
1.646 nicm 4343: .It Li "scroll_position" Ta "" Ta "Scroll position in copy mode"
1.359 nicm 4344: .It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
4345: .It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
1.691 nicm 4346: .It Li "selection_end_x" Ta "" Ta "X position of the end of the selection"
4347: .It Li "selection_end_y" Ta "" Ta "Y position of the end of the selection"
1.571 nicm 4348: .It Li "selection_present" Ta "" Ta "1 if selection started in copy mode"
1.691 nicm 4349: .It Li "selection_start_x" Ta "" Ta "X position of the start of the selection"
4350: .It Li "selection_start_y" Ta "" Ta "Y position of the start of the selection"
1.646 nicm 4351: .It Li "session_activity" Ta "" Ta "Time of session last activity"
1.430 nicm 4352: .It Li "session_alerts" Ta "" Ta "List of window indexes with alerts"
1.382 nicm 4353: .It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
1.702 nicm 4354: .It Li "session_attached_list" Ta "" Ta "List of clients session is attached to"
1.572 nicm 4355: .It Li "session_created" Ta "" Ta "Time session created"
1.696 nicm 4356: .It Li "session_format" Ta "" Ta "1 if format is for a session"
1.536 nicm 4357: .It Li "session_group" Ta "" Ta "Name of session group"
1.702 nicm 4358: .It Li "session_group_attached" Ta "" Ta "Number of clients sessions in group are attached to"
4359: .It Li "session_group_attached_list" Ta "" Ta "List of clients sessions in group are attached to"
1.646 nicm 4360: .It Li "session_group_list" Ta "" Ta "List of sessions in group"
1.702 nicm 4361: .It Li "session_group_many_attached" Ta "" Ta "1 if multiple clients attached to sessions in group"
1.586 nicm 4362: .It Li "session_group_size" Ta "" Ta "Size of session group"
1.359 nicm 4363: .It Li "session_grouped" Ta "" Ta "1 if session in a group"
4364: .It Li "session_id" Ta "" Ta "Unique session ID"
1.646 nicm 4365: .It Li "session_last_attached" Ta "" Ta "Time session last attached"
1.382 nicm 4366: .It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached"
1.359 nicm 4367: .It Li "session_name" Ta "#S" Ta "Name of session"
1.548 nicm 4368: .It Li "session_stack" Ta "" Ta "Window indexes in most recent order"
1.359 nicm 4369: .It Li "session_windows" Ta "" Ta "Number of windows in session"
1.487 nicm 4370: .It Li "socket_path" Ta "" Ta "Server socket path"
1.465 nicm 4371: .It Li "start_time" Ta "" Ta "Server start time"
1.646 nicm 4372: .It Li "window_active" Ta "" Ta "1 if window active"
1.702 nicm 4373: .It Li "window_active_clients" Ta "" Ta "Number of clients viewing this window"
4374: .It Li "window_active_clients_list" Ta "" Ta "List of clients viewing this window"
4375: .It Li "window_active_sessions" Ta "" Ta "Number of sessions on which this window is active"
4376: .It Li "window_active_sessions_list" Ta "" Ta "List of sessions on which this window is active"
1.572 nicm 4377: .It Li "window_activity" Ta "" Ta "Time of window last activity"
1.487 nicm 4378: .It Li "window_activity_flag" Ta "" Ta "1 if window has activity"
1.366 nicm 4379: .It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
1.642 nicm 4380: .It Li "window_bigger" Ta "" Ta "1 if window is larger than client"
1.700 nicm 4381: .It Li "window_cell_height" Ta "" Ta "Height of each cell in pixels"
4382: .It Li "window_cell_width" Ta "" Ta "Width of each cell in pixels"
1.621 nicm 4383: .It Li "window_end_flag" Ta "" Ta "1 if window has the highest index"
1.359 nicm 4384: .It Li "window_flags" Ta "#F" Ta "Window flags"
1.696 nicm 4385: .It Li "window_format" Ta "" Ta "1 if format is for a window"
1.359 nicm 4386: .It Li "window_height" Ta "" Ta "Height of window"
4387: .It Li "window_id" Ta "" Ta "Unique window ID"
4388: .It Li "window_index" Ta "#I" Ta "Index of window"
1.400 nicm 4389: .It Li "window_last_flag" Ta "" Ta "1 if window is the last used"
1.460 nicm 4390: .It Li "window_layout" Ta "" Ta "Window layout description, ignoring zoomed window panes"
1.426 nicm 4391: .It Li "window_linked" Ta "" Ta "1 if window is linked across sessions"
1.702 nicm 4392: .It Li "window_linked_sessions" Ta "" Ta "Number of sessions this window is linked to"
4393: .It Li "window_linked_sessions_list" Ta "" Ta "List of sessions this window is linked to"
1.687 nicm 4394: .It Li "window_marked_flag" Ta "" Ta "1 if window contains the marked pane"
1.359 nicm 4395: .It Li "window_name" Ta "#W" Ta "Name of window"
1.642 nicm 4396: .It Li "window_offset_x" Ta "" Ta "X offset into window if larger than client"
4397: .It Li "window_offset_y" Ta "" Ta "Y offset into window if larger than client"
1.359 nicm 4398: .It Li "window_panes" Ta "" Ta "Number of panes in window"
1.366 nicm 4399: .It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
1.548 nicm 4400: .It Li "window_stack_index" Ta "" Ta "Index in session most recent stack"
1.621 nicm 4401: .It Li "window_start_flag" Ta "" Ta "1 if window has the lowest index"
1.460 nicm 4402: .It Li "window_visible_layout" Ta "" Ta "Window layout description, respecting zoomed window panes"
1.359 nicm 4403: .It Li "window_width" Ta "" Ta "Width of window"
1.400 nicm 4404: .It Li "window_zoomed_flag" Ta "" Ta "1 if window is zoomed"
1.359 nicm 4405: .It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
1.245 nicm 4406: .El
1.623 nicm 4407: .Sh STYLES
4408: .Nm
4409: offers various options to specify the colour and attributes of aspects of the
4410: interface, for example
4411: .Ic status-style
4412: for the status line.
4413: In addition, embedded styles may be specified in format options, such as
1.701 nicm 4414: .Ic status-left ,
1.623 nicm 4415: by enclosing them in
4416: .Ql #[
4417: and
1.639 nicm 4418: .Ql \&] .
1.623 nicm 4419: .Pp
4420: A style may be the single term
4421: .Ql default
1.688 nicm 4422: to specify the default style (which may come from an option, for example
4423: .Ic status-style
4424: in the status line) or a space
1.630 nicm 4425: or comma separated list of the following:
1.623 nicm 4426: .Bl -tag -width Ds
4427: .It Ic fg=colour
4428: Set the foreground colour.
4429: The colour is one of:
4430: .Ic black ,
4431: .Ic red ,
4432: .Ic green ,
4433: .Ic yellow ,
4434: .Ic blue ,
4435: .Ic magenta ,
4436: .Ic cyan ,
4437: .Ic white ;
4438: if supported the bright variants
4439: .Ic brightred ,
4440: .Ic brightgreen ,
4441: .Ic brightyellow ;
4442: .Ic colour0
4443: to
4444: .Ic colour255
4445: from the 256-colour set;
4446: .Ic default
4447: for the default colour;
4448: .Ic terminal
4449: for the terminal default colour; or a hexadecimal RGB string such as
4450: .Ql #ffffff .
4451: .It Ic bg=colour
4452: Set the background colour.
4453: .It Ic none
4454: Set no attributes (turn off any active attributes).
1.625 nicm 4455: .It Xo Ic bright
4456: (or
4457: .Ic bold ) ,
1.623 nicm 4458: .Ic dim ,
4459: .Ic underscore ,
4460: .Ic blink ,
4461: .Ic reverse ,
4462: .Ic hidden ,
4463: .Ic italics ,
1.649 nicm 4464: .Ic overline ,
1.623 nicm 4465: .Ic strikethrough ,
4466: .Ic double-underscore ,
4467: .Ic curly-underscore ,
4468: .Ic dotted-underscore ,
4469: .Ic dashed-underscore
4470: .Xc
4471: Set an attribute.
4472: Any of the attributes may be prefixed with
4473: .Ql no
4474: to unset.
1.625 nicm 4475: .It Xo Ic align=left
4476: (or
4477: .Ic noalign ) ,
4478: .Ic align=centre ,
4479: .Ic align=right
4480: .Xc
4481: Align text to the left, centre or right of the available space if appropriate.
1.675 nicm 4482: .It Ic fill=colour
1.674 nicm 4483: Fill the available space with a background colour if appropriate.
1.625 nicm 4484: .It Xo Ic list=on ,
4485: .Ic list=focus ,
4486: .Ic list=left-marker ,
1.661 nicm 4487: .Ic list=right-marker ,
1.625 nicm 4488: .Ic nolist
4489: .Xc
4490: Mark the position of the various window list components in the
4491: .Ic status-format
4492: option:
4493: .Ic list=on
4494: marks the start of the list;
4495: .Ic list=focus
4496: is the part of the list that should be kept in focus if the entire list won't fit
4497: in the available space (typically the current window);
4498: .Ic list=left-marker
4499: and
4500: .Ic list=right-marker
4501: mark the text to be used to mark that text has been trimmed from the left or
4502: right of the list if there is not enough space.
1.688 nicm 4503: .It Xo Ic push-default ,
4504: .Ic pop-default
4505: .Xc
4506: Store the current colours and attributes as the default or reset to the previous
4507: default.
4508: A
4509: .Ic push-default
4510: affects any subsequent use of the
4511: .Ic default
4512: term until a
4513: .Ic pop-default .
4514: Only one default may be pushed (each
4515: .Ic push-default
4516: replaces the previous saved default).
1.625 nicm 4517: .It Xo Ic range=left ,
4518: .Ic range=right ,
4519: .Ic range=window|X ,
4520: .Ic norange
4521: .Xc
4522: Mark a range in the
1.651 nicm 4523: .Ic status-format
1.625 nicm 4524: option.
4525: .Ic range=left
4526: and
4527: .Ic range=right
4528: are the text used for the
4529: .Ql StatusLeft
4530: and
4531: .Ql StatusRight
4532: mouse keys.
4533: .Ic range=window|X
4534: is the range for a window passed to the
4535: .Ql Status
4536: mouse key, where
4537: .Ql X
4538: is a window index.
1.623 nicm 4539: .El
4540: .Pp
4541: Examples are:
4542: .Bd -literal -offset indent
1.630 nicm 4543: fg=yellow bold underscore blink
1.623 nicm 4544: bg=black,fg=default,noreverse
4545: .Ed
1.261 nicm 4546: .Sh NAMES AND TITLES
4547: .Nm
4548: distinguishes between names and titles.
4549: Windows and sessions have names, which may be used to specify them in targets
4550: and are displayed in the status line and various lists: the name is the
4551: .Nm
4552: identifier for a window or session.
4553: Only panes have titles.
1.577 nicm 4554: A pane's title is typically set by the program running inside the pane using
4555: an escape sequence (like it would set the
1.261 nicm 4556: .Xr xterm 1
1.577 nicm 4557: window title in
1.578 nicm 4558: .Xr X 7 ) .
1.268 nicm 4559: Windows themselves do not have titles - a window's title is the title of its
1.261 nicm 4560: active pane.
4561: .Nm
4562: itself may set the title of the terminal in which the client is running, see
4563: the
4564: .Ic set-titles
4565: option.
4566: .Pp
4567: A session's name is set with the
4568: .Ic new-session
4569: and
4570: .Ic rename-session
4571: commands.
4572: A window's name is set with one of:
4573: .Bl -enum -width Ds
4574: .It
4575: A command argument (such as
4576: .Fl n
4577: for
4578: .Ic new-window
4579: or
4580: .Ic new-session ) .
4581: .It
1.597 nicm 4582: An escape sequence (if the
4583: .Ic allow-rename
4584: option is turned on):
1.261 nicm 4585: .Bd -literal -offset indent
4586: $ printf '\e033kWINDOW_NAME\e033\e\e'
4587: .Ed
4588: .It
4589: Automatic renaming, which sets the name to the active command in the window's
4590: active pane.
4591: See the
4592: .Ic automatic-rename
4593: option.
4594: .El
4595: .Pp
4596: When a pane is first created, its title is the hostname.
1.612 nicm 4597: A pane's title can be set via the title setting escape sequence, for example:
1.261 nicm 4598: .Bd -literal -offset indent
4599: $ printf '\e033]2;My Title\e033\e\e'
4600: .Ed
1.577 nicm 4601: .Pp
4602: It can also be modified with the
4603: .Ic select-pane
4604: .Fl T
4605: command.
1.644 schwarze 4606: .Sh GLOBAL AND SESSION ENVIRONMENT
1.63 nicm 4607: When the server is started,
4608: .Nm
4609: copies the environment into the
4610: .Em global environment ;
4611: in addition, each session has a
4612: .Em session environment .
1.193 nicm 4613: When a window is created, the session and global environments are merged.
4614: If a variable exists in both, the value from the session environment is used.
4615: The result is the initial environment passed to the new process.
1.63 nicm 4616: .Pp
4617: The
4618: .Ic update-environment
4619: session option may be used to update the session environment from the client
4620: when a new session is created or an old reattached.
4621: .Nm
4622: also initialises the
4623: .Ev TMUX
4624: variable with some internal information to allow commands to be executed
4625: from inside, and the
4626: .Ev TERM
4627: variable with the correct terminal setting of
4628: .Ql screen .
4629: .Pp
4630: Commands to alter and view the environment are:
4631: .Bl -tag -width Ds
4632: .It Xo Ic set-environment
4633: .Op Fl gru
4634: .Op Fl t Ar target-session
4635: .Ar name Op Ar value
4636: .Xc
1.115 nicm 4637: .D1 (alias: Ic setenv )
1.63 nicm 4638: Set or unset an environment variable.
4639: If
4640: .Fl g
4641: is used, the change is made in the global environment; otherwise, it is applied
4642: to the session environment for
4643: .Ar target-session .
4644: The
4645: .Fl u
4646: flag unsets a variable.
4647: .Fl r
4648: indicates the variable is to be removed from the environment before starting a
4649: new process.
4650: .It Xo Ic show-environment
1.442 nicm 4651: .Op Fl gs
1.63 nicm 4652: .Op Fl t Ar target-session
1.286 nicm 4653: .Op Ar variable
1.63 nicm 4654: .Xc
1.115 nicm 4655: .D1 (alias: Ic showenv )
1.63 nicm 4656: Display the environment for
4657: .Ar target-session
4658: or the global environment with
4659: .Fl g .
1.286 nicm 4660: If
4661: .Ar variable
4662: is omitted, all variables are shown.
1.63 nicm 4663: Variables removed from the environment are prefixed with
4664: .Ql - .
1.442 nicm 4665: If
4666: .Fl s
4667: is used, the output is formatted as a set of Bourne shell commands.
1.57 jmc 4668: .El
4669: .Sh STATUS LINE
4670: .Nm
4671: includes an optional status line which is displayed in the bottom line of each
4672: terminal.
1.626 nicm 4673: .Pp
4674: By default, the status line is enabled and one line in height (it may be
4675: disabled or made multiple lines with the
1.57 jmc 4676: .Ic status
4677: session option) and contains, from left-to-right: the name of the current
1.261 nicm 4678: session in square brackets; the window list; the title of the active pane
4679: in double quotes; and the time and date.
1.57 jmc 4680: .Pp
1.626 nicm 4681: Each line of the status line is configured with the
4682: .Ic status-format
4683: option.
4684: The default is made of three parts: configurable left and right sections (which
4685: may contain dynamic content such as the time or output from a shell command,
4686: see the
1.57 jmc 4687: .Ic status-left ,
4688: .Ic status-left-length ,
4689: .Ic status-right ,
4690: and
4691: .Ic status-right-length
4692: options below), and a central window list.
1.125 nicm 4693: By default, the window list shows the index, name and (if any) flag of the
4694: windows present in the current session in ascending numerical order.
4695: It may be customised with the
4696: .Ar window-status-format
4697: and
4698: .Ar window-status-current-format
4699: options.
1.57 jmc 4700: The flag is one of the following symbols appended to the window name:
4701: .Bl -column "Symbol" "Meaning" -offset indent
4702: .It Sy "Symbol" Ta Sy "Meaning"
4703: .It Li "*" Ta "Denotes the current window."
4704: .It Li "-" Ta "Marks the last window (previously selected)."
1.574 nicm 4705: .It Li "#" Ta "Window activity is monitored and activity has been detected."
4706: .It Li "\&!" Ta "Window bells are monitored and a bell has occurred in the window."
1.192 nicm 4707: .It Li "~" Ta "The window has been silent for the monitor-silence interval."
1.432 nicm 4708: .It Li "M" Ta "The window contains the marked pane."
1.349 nicm 4709: .It Li "Z" Ta "The window's active pane is zoomed."
1.57 jmc 4710: .El
4711: .Pp
4712: The # symbol relates to the
4713: .Ic monitor-activity
1.388 nicm 4714: window option.
1.57 jmc 4715: The window name is printed in inverted colours if an alert (bell, activity or
1.388 nicm 4716: silence) is present.
1.57 jmc 4717: .Pp
1.131 nicm 4718: The colour and attributes of the status line may be configured, the entire
4719: status line using the
1.378 nicm 4720: .Ic status-style
4721: session option and individual windows using the
4722: .Ic window-status-style
4723: window option.
1.57 jmc 4724: .Pp
1.131 nicm 4725: The status line is automatically refreshed at interval if it has changed, the
4726: interval may be controlled with the
1.57 jmc 4727: .Ic status-interval
4728: session option.
4729: .Pp
4730: Commands related to the status line are as follows:
4731: .Bl -tag -width Ds
4732: .It Xo Ic command-prompt
1.706 nicm 4733: .Op Fl 1ikN
1.235 nicm 4734: .Op Fl I Ar inputs
1.73 nicm 4735: .Op Fl p Ar prompts
1.57 jmc 4736: .Op Fl t Ar target-client
4737: .Op Ar template
4738: .Xc
4739: Open the command prompt in a client.
4740: This may be used from inside
4741: .Nm
4742: to execute commands interactively.
1.231 nicm 4743: .Pp
1.57 jmc 4744: If
4745: .Ar template
1.73 nicm 4746: is specified, it is used as the command.
1.235 nicm 4747: If present,
4748: .Fl I
4749: is a comma-separated list of the initial text for each prompt.
1.73 nicm 4750: If
4751: .Fl p
4752: is given,
4753: .Ar prompts
4754: is a comma-separated list of prompts which are displayed in order; otherwise
4755: a single prompt is displayed, constructed from
4756: .Ar template
4757: if it is present, or
4758: .Ql \&:
4759: if not.
1.231 nicm 4760: .Pp
1.73 nicm 4761: Before the command is executed, the first occurrence of the string
4762: .Ql %%
1.74 jmc 4763: and all occurrences of
1.73 nicm 4764: .Ql %1
1.492 nicm 4765: are replaced by the response to the first prompt, all
1.73 nicm 4766: .Ql %2
4767: are replaced with the response to the second prompt, and so on for further
1.74 jmc 4768: prompts.
4769: Up to nine prompt responses may be replaced
4770: .Po
4771: .Ql %1
1.73 nicm 4772: to
1.74 jmc 4773: .Ql %9
4774: .Pc .
1.513 nicm 4775: .Ql %%%
4776: is like
4777: .Ql %%
4778: but any quotation marks are escaped.
1.497 nicm 4779: .Pp
4780: .Fl 1
4781: makes the prompt only accept one key press, in this case the resulting input
4782: is a single character.
1.706 nicm 4783: .Fl k
4784: is like
4785: .Fl 1
4786: but the key press is translated to a key name.
1.678 nicm 4787: .Fl N
4788: makes the prompt only accept numeric key presses.
1.517 nicm 4789: .Fl i
4790: executes the command every time the prompt input changes instead of when the
4791: user exits the command prompt.
1.500 nicm 4792: .Pp
4793: The following keys have a special meaning in the command prompt, depending
4794: on the value of the
4795: .Ic status-keys
4796: option:
4797: .Bl -column "FunctionXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXX" "emacsX" -offset indent
4798: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
4799: .It Li "Cancel command prompt" Ta "Escape" Ta "Escape"
1.678 nicm 4800: .It Li "Delete from cursor to start of word" Ta "" Ta "C-w"
1.500 nicm 4801: .It Li "Delete entire command" Ta "d" Ta "C-u"
4802: .It Li "Delete from cursor to end" Ta "D" Ta "C-k"
4803: .It Li "Execute command" Ta "Enter" Ta "Enter"
4804: .It Li "Get next command from history" Ta "" Ta "Down"
4805: .It Li "Get previous command from history" Ta "" Ta "Up"
4806: .It Li "Insert top paste buffer" Ta "p" Ta "C-y"
4807: .It Li "Look for completions" Ta "Tab" Ta "Tab"
4808: .It Li "Move cursor left" Ta "h" Ta "Left"
4809: .It Li "Move cursor right" Ta "l" Ta "Right"
4810: .It Li "Move cursor to end" Ta "$" Ta "C-e"
4811: .It Li "Move cursor to next word" Ta "w" Ta "M-f"
4812: .It Li "Move cursor to previous word" Ta "b" Ta "M-b"
4813: .It Li "Move cursor to start" Ta "0" Ta "C-a"
4814: .It Li "Transpose characters" Ta "" Ta "C-t"
4815: .El
1.57 jmc 4816: .It Xo Ic confirm-before
1.238 nicm 4817: .Op Fl p Ar prompt
1.57 jmc 4818: .Op Fl t Ar target-client
4819: .Ar command
4820: .Xc
4821: .D1 (alias: Ic confirm )
4822: Ask for confirmation before executing
4823: .Ar command .
1.238 nicm 4824: If
4825: .Fl p
4826: is given,
4827: .Ar prompt
4828: is the prompt to display; otherwise a prompt is constructed from
4829: .Ar command .
4830: It may contain the special character sequences supported by the
4831: .Ic status-left
4832: option.
4833: .Pp
1.57 jmc 4834: This command works only from inside
4835: .Nm .
1.646 nicm 4836: .It Xo Ic display-menu
4837: .Op Fl c Ar target-client
4838: .Op Fl t Ar target-pane
4839: .Op Fl T Ar title
4840: .Op Fl x Ar position
4841: .Op Fl y Ar position
1.657 nicm 4842: .Ar name
4843: .Ar key
4844: .Ar command
4845: .Ar ...
1.646 nicm 4846: .Xc
1.651 nicm 4847: .D1 (alias: Ic menu )
1.646 nicm 4848: Display a menu on
4849: .Ar target-client .
4850: .Ar target-pane
4851: gives the target for any commands run from the menu.
4852: .Pp
1.657 nicm 4853: A menu is passed as a series of arguments: first the menu item name,
4854: second the key shortcut (or empty for none) and third the command
4855: to run when the menu item is chosen.
4856: The name and command are formats, see the
1.646 nicm 4857: .Sx FORMATS
4858: and
4859: .Sx STYLES
4860: sections.
1.658 nicm 4861: If the name begins with a hyphen (-), then the item is disabled (shown dim) and
4862: may not be chosen.
1.657 nicm 4863: The name may be empty for a separator line, in which case both the key and
4864: command should be omitted.
1.646 nicm 4865: .Pp
4866: .Fl T
4867: is a format for the menu title (see
4868: .Sx FORMATS ) .
4869: .Pp
4870: .Fl x
4871: and
4872: .Fl y
4873: give the position of the menu.
4874: Both may be a row or column number, or one of the following special values:
4875: .Bl -column "XXXXX" "XXXX" -offset indent
4876: .It Sy "Value" Ta Sy "Flag" Ta Sy "Meaning"
4877: .It Li "R" Ta Fl x Ta "The right side of the terminal"
4878: .It Li "P" Ta "Both" Ta "The bottom left of the pane"
4879: .It Li "M" Ta "Both" Ta "The mouse position"
4880: .It Li "W" Ta Fl x Ta "The window position on the status line"
4881: .It Li "S" Ta Fl y Ta "The line above or below the status line"
4882: .El
4883: .Pp
4884: Each menu consists of items followed by a key shortcut shown in brackets.
4885: If the menu is too large to fit on the terminal, it is not displayed.
4886: Pressing the key shortcut chooses the corresponding item.
4887: If the mouse is enabled and the menu is opened from a mouse key binding, releasing
4888: the mouse button with an item selected will choose that item.
4889: The following keys are also available:
4890: .Bl -column "Key" "Function" -offset indent
4891: .It Sy "Key" Ta Sy "Function"
4892: .It Li "Enter" Ta "Choose selected item"
4893: .It Li "Up" Ta "Select previous item"
4894: .It Li "Down" Ta "Select next item"
4895: .It Li "q" Ta "Exit menu"
4896: .El
1.57 jmc 4897: .It Xo Ic display-message
1.643 nicm 4898: .Op Fl aIpv
1.215 nicm 4899: .Op Fl c Ar target-client
4900: .Op Fl t Ar target-pane
1.57 jmc 4901: .Op Ar message
4902: .Xc
4903: .D1 (alias: Ic display )
1.127 nicm 4904: Display a message.
4905: If
4906: .Fl p
4907: is given, the output is printed to stdout, otherwise it is displayed in the
4908: .Ar target-client
4909: status line.
1.122 nicm 4910: The format of
1.124 jmc 4911: .Ar message
1.275 nicm 4912: is described in the
4913: .Sx FORMATS
4914: section; information is taken from
1.215 nicm 4915: .Ar target-pane
4916: if
4917: .Fl t
1.678 nicm 4918: is given, otherwise the active pane.
1.622 nicm 4919: .Pp
1.624 nicm 4920: .Fl v
4921: prints verbose logging as the format is parsed and
4922: .Fl a
4923: lists the format variables and their values.
1.643 nicm 4924: .Pp
4925: .Fl I
4926: forwards any input read from stdin to the empty pane given by
4927: .Ar target-pane .
1.57 jmc 4928: .El
4929: .Sh BUFFERS
4930: .Nm
1.392 nicm 4931: maintains a set of named
1.199 nicm 4932: .Em paste buffers .
1.392 nicm 4933: Each buffer may be either explicitly or automatically named.
4934: Explicitly named buffers are named when created with the
4935: .Ic set-buffer
4936: or
4937: .Ic load-buffer
4938: commands, or by renaming an automatically named buffer with
4939: .Ic set-buffer
4940: .Fl n .
4941: Automatically named buffers are given a name such as
4942: .Ql buffer0001 ,
4943: .Ql buffer0002
4944: and so on.
4945: When the
4946: .Ic buffer-limit
4947: option is reached, the oldest automatically named buffer is deleted.
1.493 nicm 4948: Explicitly named buffers are not subject to
1.57 jmc 4949: .Ic buffer-limit
1.392 nicm 4950: and may be deleted with
4951: .Ic delete-buffer
4952: command.
4953: .Pp
1.57 jmc 4954: Buffers may be added using
4955: .Ic copy-mode
4956: or the
4957: .Ic set-buffer
1.392 nicm 4958: and
4959: .Ic load-buffer
4960: commands, and pasted into a window using the
1.57 jmc 4961: .Ic paste-buffer
4962: command.
1.392 nicm 4963: If a buffer command is used and no buffer is specified, the most
4964: recently added automatically named buffer is assumed.
1.57 jmc 4965: .Pp
4966: A configurable history buffer is also maintained for each window.
4967: By default, up to 2000 lines are kept; this can be altered with the
4968: .Ic history-limit
4969: option (see the
4970: .Ic set-option
4971: command above).
4972: .Pp
4973: The buffer commands are as follows:
4974: .Bl -tag -width Ds
1.178 nicm 4975: .It Xo
4976: .Ic choose-buffer
1.682 nicm 4977: .Op Fl NZr
1.572 nicm 4978: .Op Fl F Ar format
1.562 nicm 4979: .Op Fl f Ar filter
1.561 nicm 4980: .Op Fl O Ar sort-order
1.555 nicm 4981: .Op Fl t Ar target-pane
1.178 nicm 4982: .Op Ar template
4983: .Xc
1.555 nicm 4984: Put a pane into buffer mode, where a buffer may be chosen interactively from
4985: a list.
1.593 nicm 4986: .Fl Z
4987: zooms the pane.
1.555 nicm 4988: The following keys may be used in buffer mode:
4989: .Bl -column "Key" "Function" -offset indent
4990: .It Sy "Key" Ta Sy "Function"
1.582 nicm 4991: .It Li "Enter" Ta "Paste selected buffer"
1.555 nicm 4992: .It Li "Up" Ta "Select previous buffer"
4993: .It Li "Down" Ta "Select next buffer"
1.559 nicm 4994: .It Li "C-s" Ta "Search by name or content"
4995: .It Li "n" Ta "Repeat last search"
1.555 nicm 4996: .It Li "t" Ta "Toggle if buffer is tagged"
4997: .It Li "T" Ta "Tag no buffers"
4998: .It Li "C-t" Ta "Tag all buffers"
1.582 nicm 4999: .It Li "p" Ta "Paste selected buffer"
5000: .It Li "P" Ta "Paste tagged buffers"
1.555 nicm 5001: .It Li "d" Ta "Delete selected buffer"
5002: .It Li "D" Ta "Delete tagged buffers"
1.562 nicm 5003: .It Li "f" Ta "Enter a format to filter items"
1.682 nicm 5004: .It Li "O" Ta "Change sort field"
5005: .It Li "r" Ta "Reverse sort order"
1.576 nicm 5006: .It Li "v" Ta "Toggle preview"
1.555 nicm 5007: .It Li "q" Ta "Exit mode"
5008: .El
5009: .Pp
5010: After a buffer is chosen,
1.178 nicm 5011: .Ql %%
1.392 nicm 5012: is replaced by the buffer name in
1.178 nicm 5013: .Ar template
5014: and the result executed as a command.
5015: If
5016: .Ar template
5017: is not given, "paste-buffer -b '%%'" is used.
1.555 nicm 5018: .Pp
1.561 nicm 5019: .Fl O
1.682 nicm 5020: specifies the initial sort field: one of
1.561 nicm 5021: .Ql time ,
5022: .Ql name
5023: or
5024: .Ql size .
1.682 nicm 5025: .Fl r
5026: reverses the sort order.
1.562 nicm 5027: .Fl f
1.579 nicm 5028: specifies an initial filter: the filter is a format - if it evaluates to zero,
5029: the item in the list is not shown, otherwise it is shown.
5030: If a filter would lead to an empty list, it is ignored.
1.572 nicm 5031: .Fl F
5032: specifies the format for each item in the list.
1.576 nicm 5033: .Fl N
5034: starts without the preview.
1.314 nicm 5035: This command works only if at least one client is attached.
1.57 jmc 5036: .It Ic clear-history Op Fl t Ar target-pane
5037: .D1 (alias: Ic clearhist )
5038: Remove and free the history for the specified pane.
1.392 nicm 5039: .It Ic delete-buffer Op Fl b Ar buffer-name
1.57 jmc 5040: .D1 (alias: Ic deleteb )
1.392 nicm 5041: Delete the buffer named
5042: .Ar buffer-name ,
5043: or the most recently added automatically named buffer if not specified.
1.294 nicm 5044: .It Xo Ic list-buffers
5045: .Op Fl F Ar format
5046: .Xc
1.57 jmc 5047: .D1 (alias: Ic lsb )
1.198 nicm 5048: List the global buffers.
1.294 nicm 5049: For the meaning of the
5050: .Fl F
5051: flag, see the
5052: .Sx FORMATS
5053: section.
1.200 jmc 5054: .It Xo Ic load-buffer
1.392 nicm 5055: .Op Fl b Ar buffer-name
1.57 jmc 5056: .Ar path
5057: .Xc
5058: .D1 (alias: Ic loadb )
5059: Load the contents of the specified paste buffer from
5060: .Ar path .
5061: .It Xo Ic paste-buffer
1.278 nicm 5062: .Op Fl dpr
1.392 nicm 5063: .Op Fl b Ar buffer-name
1.170 nicm 5064: .Op Fl s Ar separator
1.158 nicm 5065: .Op Fl t Ar target-pane
1.57 jmc 5066: .Xc
5067: .D1 (alias: Ic pasteb )
1.158 nicm 5068: Insert the contents of a paste buffer into the specified pane.
5069: If not specified, paste into the current one.
1.57 jmc 5070: With
5071: .Fl d ,
1.392 nicm 5072: also delete the paste buffer.
1.57 jmc 5073: When output, any linefeed (LF) characters in the paste buffer are replaced with
1.170 nicm 5074: a separator, by default carriage return (CR).
5075: A custom separator may be specified using the
5076: .Fl s
5077: flag.
5078: The
1.57 jmc 5079: .Fl r
1.170 nicm 5080: flag means to do no replacement (equivalent to a separator of LF).
1.278 nicm 5081: If
5082: .Fl p
5083: is specified, paste bracket control codes are inserted around the
5084: buffer if the application has requested bracketed paste mode.
1.57 jmc 5085: .It Xo Ic save-buffer
5086: .Op Fl a
1.392 nicm 5087: .Op Fl b Ar buffer-name
1.57 jmc 5088: .Ar path
5089: .Xc
5090: .D1 (alias: Ic saveb )
5091: Save the contents of the specified paste buffer to
5092: .Ar path .
5093: The
5094: .Fl a
5095: option appends to rather than overwriting the file.
5096: .It Xo Ic set-buffer
1.383 nicm 5097: .Op Fl a
1.392 nicm 5098: .Op Fl b Ar buffer-name
5099: .Op Fl n Ar new-buffer-name
1.57 jmc 5100: .Ar data
5101: .Xc
5102: .D1 (alias: Ic setb )
5103: Set the contents of the specified buffer to
5104: .Ar data .
1.383 nicm 5105: The
5106: .Fl a
5107: option appends to rather than overwriting the buffer.
1.392 nicm 5108: The
5109: .Fl n
5110: option renames the buffer to
5111: .Ar new-buffer-name .
1.1 nicm 5112: .It Xo Ic show-buffer
1.392 nicm 5113: .Op Fl b Ar buffer-name
1.1 nicm 5114: .Xc
5115: .D1 (alias: Ic showb )
5116: Display the contents of the specified buffer.
1.57 jmc 5117: .El
5118: .Sh MISCELLANEOUS
5119: Miscellaneous commands are as follows:
5120: .Bl -tag -width Ds
1.72 nicm 5121: .It Ic clock-mode Op Fl t Ar target-pane
1.57 jmc 5122: Display a large clock.
1.334 nicm 5123: .It Xo Ic if-shell
1.410 nicm 5124: .Op Fl bF
1.334 nicm 5125: .Op Fl t Ar target-pane
5126: .Ar shell-command command
5127: .Op Ar command
5128: .Xc
1.57 jmc 5129: .D1 (alias: Ic if )
1.251 nicm 5130: Execute the first
1.57 jmc 5131: .Ar command
5132: if
5133: .Ar shell-command
1.251 nicm 5134: returns success or the second
5135: .Ar command
5136: otherwise.
1.410 nicm 5137: Before being executed,
5138: .Ar shell-command
5139: is expanded using the rules specified in the
1.334 nicm 5140: .Sx FORMATS
5141: section, including those relevant to
5142: .Ar target-pane .
1.335 nicm 5143: With
5144: .Fl b ,
5145: .Ar shell-command
5146: is run in the background.
1.410 nicm 5147: .Pp
5148: If
5149: .Fl F
5150: is given,
5151: .Ar shell-command
5152: is not executed but considered success if neither empty nor zero (after formats
5153: are expanded).
1.57 jmc 5154: .It Ic lock-server
5155: .D1 (alias: Ic lock )
1.90 nicm 5156: Lock each client individually by running the command specified by the
5157: .Ic lock-command
5158: option.
1.308 nicm 5159: .It Xo Ic run-shell
1.357 nicm 5160: .Op Fl b
1.308 nicm 5161: .Op Fl t Ar target-pane
5162: .Ar shell-command
5163: .Xc
1.87 nicm 5164: .D1 (alias: Ic run )
5165: Execute
1.153 nicm 5166: .Ar shell-command
1.106 nicm 5167: in the background without creating a window.
1.334 nicm 5168: Before being executed, shell-command is expanded using the rules specified in
5169: the
5170: .Sx FORMATS
5171: section.
1.335 nicm 5172: With
5173: .Fl b ,
5174: the command is run in the background.
1.308 nicm 5175: After it finishes, any output to stdout is displayed in copy mode (in the pane
5176: specified by
5177: .Fl t
5178: or the current pane if omitted).
1.153 nicm 5179: If the command doesn't return success, the exit status is also displayed.
1.342 nicm 5180: .It Xo Ic wait-for
1.370 nicm 5181: .Op Fl L | S | U
1.342 nicm 5182: .Ar channel
5183: .Xc
5184: .D1 (alias: Ic wait )
1.343 nicm 5185: When used without options, prevents the client from exiting until woken using
1.342 nicm 5186: .Ic wait-for
5187: .Fl S
5188: with the same channel.
1.343 nicm 5189: When
5190: .Fl L
5191: is used, the channel is locked and any clients that try to lock the same
5192: channel are made to wait until the channel is unlocked with
5193: .Ic wait-for
5194: .Fl U .
1.703 nicm 5195: .El
5196: .Sh EXIT MESSAGES
5197: When a
5198: .Nm
5199: client detaches, it prints a message.
5200: This may be one of:
5201: .Bl -tag -width Ds
5202: .It [detached (from session ...)]
5203: The client was detached normally.
5204: .It [detached and SIGHUP]
5205: The client was detached and its parent sent the
5206: .Dv SIGHUP
5207: signal (for example with
5208: .Ic detach-client
5209: .Fl P ) .
5210: .It [lost tty]
5211: The client's
5212: .Xr tty 4
5213: or
5214: .Xr pty 4
5215: was unexpectedly destroyed.
5216: .It [terminated]
5217: The client was killed with
5218: .Dv SIGTERM .
5219: .It [exited]
5220: The server exited when it had no sessions.
5221: .It [server exited]
5222: The server exited when it received
5223: .Dv SIGTERM .
5224: .It [server exited unexpectedly]
5225: The server crashed or otherwise exited without telling the client the reason.
1.228 nicm 5226: .El
5227: .Sh TERMINFO EXTENSIONS
5228: .Nm
1.478 nicm 5229: understands some unofficial extensions to
1.228 nicm 5230: .Xr terminfo 5 :
5231: .Bl -tag -width Ds
1.360 nicm 5232: .It Em Cs , Cr
1.233 nicm 5233: Set the cursor colour.
1.232 jmc 5234: The first takes a single string argument and is used to set the colour;
5235: the second takes no arguments and restores the default cursor colour.
5236: If set, a sequence such as this may be used
5237: to change the cursor colour from inside
5238: .Nm :
5239: .Bd -literal -offset indent
5240: $ printf '\e033]12;red\e033\e\e'
5241: .Ed
1.649 nicm 5242: .It Em \&Smol
5243: Enable the overline attribute.
1.672 nicm 5244: The capability is usually SGR 53 and can be added to
5245: .Ic terminal-overrides
5246: as:
5247: .Bd -literal -offset indent
5248: Smol=\eE[53m
5249: .Ed
1.611 nicm 5250: .It Em \&Smulx
1.672 nicm 5251: Set a styled underscore.
5252: The single parameter is one of: 0 for no underscore, 1 for normal
5253: underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted
5254: underscore and 5 for dashed underscore.
5255: The capability can typically be added to
5256: .Ic terminal-overrides
5257: as:
5258: .Bd -literal -offset indent
5259: Smulx=\eE[4::%p1%dm
5260: .Ed
5261: .It Em \&Setulc
5262: Set the underscore colour.
5263: The argument is (red * 65536) + (green * 256) + blue where each is between 0
5264: and 255.
5265: The capability can typically be added to
5266: .Ic terminal-overrides
5267: as:
5268: .Bd -literal -offset indent
5269: Setulc=\eE[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m
5270: .Ed
1.361 jmc 5271: .It Em \&Ss , Se
1.403 nicm 5272: Set or reset the cursor style.
1.232 jmc 5273: If set, a sequence such as this may be used
5274: to change the cursor to an underline:
1.230 nicm 5275: .Bd -literal -offset indent
5276: $ printf '\e033[4 q'
5277: .Ed
5278: .Pp
5279: If
1.403 nicm 5280: .Em Se
5281: is not set, \&Ss with argument 0 will be used to reset the cursor style instead.
1.478 nicm 5282: .It Em \&Tc
5283: Indicate that the terminal supports the
5284: .Ql direct colour
5285: RGB escape sequence (for example, \ee[38;2;255;255;255m).
1.518 nicm 5286: .Pp
1.612 nicm 5287: If supported, this is used for the initialize colour escape sequence (which
1.518 nicm 5288: may be enabled by adding the
5289: .Ql initc
5290: and
5291: .Ql ccc
5292: capabilities to the
5293: .Nm
5294: .Xr terminfo 5
5295: entry).
1.232 jmc 5296: .It Em \&Ms
1.478 nicm 5297: Store the current buffer in the host terminal's selection (clipboard).
1.232 jmc 5298: See the
5299: .Em set-clipboard
5300: option above and the
5301: .Xr xterm 1
5302: man page.
1.345 nicm 5303: .El
5304: .Sh CONTROL MODE
5305: .Nm
5306: offers a textual interface called
5307: .Em control mode .
5308: This allows applications to communicate with
5309: .Nm
5310: using a simple text-only protocol.
5311: .Pp
5312: In control mode, a client sends
5313: .Nm
5314: commands or command sequences terminated by newlines on standard input.
5315: Each command will produce one block of output on standard output.
5316: An output block consists of a
5317: .Em %begin
5318: line followed by the output (which may be empty).
5319: The output block ends with a
5320: .Em %end
5321: or
5322: .Em %error .
5323: .Em %begin
5324: and matching
5325: .Em %end
5326: or
5327: .Em %error
5328: have two arguments: an integer time (as seconds from epoch) and command number.
5329: For example:
5330: .Bd -literal -offset indent
5331: %begin 1363006971 2
5332: 0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
5333: %end 1363006971 2
5334: .Ed
1.535 nicm 5335: .Pp
5336: The
5337: .Ic refresh-client
5338: .Fl C
5339: command may be used to set the size of a client in control mode.
1.345 nicm 5340: .Pp
5341: In control mode,
5342: .Nm
5343: outputs notifications.
5344: A notification will never occur inside an output block.
5345: .Pp
5346: The following notifications are defined:
5347: .Bl -tag -width Ds
1.547 nicm 5348: .It Ic %client-session-changed Ar client Ar session-id Ar name
5349: The client is now attached to the session with ID
5350: .Ar session-id ,
5351: which is named
5352: .Ar name .
1.345 nicm 5353: .It Ic %exit Op Ar reason
5354: The
5355: .Nm
5356: client is exiting immediately, either because it is not attached to any session
5357: or an error occurred.
5358: If present,
5359: .Ar reason
5360: describes why the client exited.
1.460 nicm 5361: .It Ic %layout-change Ar window-id Ar window-layout Ar window-visible-layout Ar window-flags
1.345 nicm 5362: The layout of a window with ID
5363: .Ar window-id
5364: changed.
5365: The new layout is
5366: .Ar window-layout .
1.460 nicm 5367: The window's visible layout is
5368: .Ar window-visible-layout
5369: and the window flags are
5370: .Ar window-flags .
1.347 nicm 5371: .It Ic %output Ar pane-id Ar value
5372: A window pane produced output.
1.345 nicm 5373: .Ar value
1.350 nicm 5374: escapes non-printable characters and backslash as octal \\xxx.
1.547 nicm 5375: .It Ic %pane-mode-changed Ar pane-id
5376: The pane with ID
5377: .Ar pane-id
5378: has changed mode.
1.345 nicm 5379: .It Ic %session-changed Ar session-id Ar name
5380: The client is now attached to the session with ID
5381: .Ar session-id ,
5382: which is named
5383: .Ar name .
5384: .It Ic %session-renamed Ar name
5385: The current session was renamed to
5386: .Ar name .
1.547 nicm 5387: .It Ic %session-window-changed Ar session-id Ar window-id
5388: The session with ID
5389: .Ar session-id
5390: changed its active window to the window with ID
5391: .Ar window-id .
1.345 nicm 5392: .It Ic %sessions-changed
5393: A session was created or destroyed.
5394: .It Ic %unlinked-window-add Ar window-id
5395: The window with ID
5396: .Ar window-id
5397: was created but is not linked to the current session.
5398: .It Ic %window-add Ar window-id
5399: The window with ID
5400: .Ar window-id
5401: was linked to the current session.
5402: .It Ic %window-close Ar window-id
5403: The window with ID
5404: .Ar window-id
5405: closed.
1.547 nicm 5406: .It Ic %window-pane-changed Ar window-id Ar pane-id
5407: The active pane in the window with ID
5408: .Ar window-id
5409: changed to the pane with ID
5410: .Ar pane-id .
1.345 nicm 5411: .It Ic %window-renamed Ar window-id Ar name
5412: The window with ID
5413: .Ar window-id
5414: was renamed to
5415: .Ar name .
1.644 schwarze 5416: .El
5417: .Sh ENVIRONMENT
5418: When
5419: .Nm
5420: is started, it inspects the following environment variables:
5421: .Bl -tag -width LC_CTYPE
5422: .It Ev EDITOR
5423: If the command specified in this variable contains the string
5424: .Ql vi
5425: and
5426: .Ev VISUAL
5427: is unset, use vi-style key bindings.
5428: Overridden by the
5429: .Ic mode-keys
5430: and
5431: .Ic status-keys
5432: options.
5433: .It Ev HOME
5434: The user's login directory.
5435: If unset, the
5436: .Xr passwd 5
5437: database is consulted.
5438: .It Ev LC_CTYPE
5439: The character encoding
5440: .Xr locale 1 .
5441: It is used for two separate purposes.
5442: For output to the terminal, UTF-8 is used if the
5443: .Fl u
5444: option is given or if
5445: .Ev LC_CTYPE
5446: contains
5447: .Qq UTF-8
5448: or
5449: .Qq UTF8 .
5450: Otherwise, only ASCII characters are written and non-ASCII characters
5451: are replaced with underscores
5452: .Pq Ql _ .
5453: For input,
5454: .Nm
5455: always runs with a UTF-8 locale.
5456: If en_US.UTF-8 is provided by the operating system it is used and
5457: .Ev LC_CTYPE
5458: is ignored for input.
5459: Otherwise,
5460: .Ev LC_CTYPE
5461: tells
5462: .Nm
5463: what the UTF-8 locale is called on the current system.
5464: If the locale specified by
5465: .Ev LC_CTYPE
5466: is not available or is not a UTF-8 locale,
5467: .Nm
5468: exits with an error message.
5469: .It Ev LC_TIME
5470: The date and time format
5471: .Xr locale 1 .
5472: It is used for locale-dependent
5473: .Xr strftime 3
5474: format specifiers.
5475: .It Ev PWD
5476: The current working directory to be set in the global environment.
5477: This may be useful if it contains symbolic links.
5478: If the value of the variable does not match the current working
5479: directory, the variable is ignored and the result of
5480: .Xr getcwd 3
5481: is used instead.
5482: .It Ev SHELL
5483: The absolute path to the default shell for new windows.
5484: See the
5485: .Ic default-shell
5486: option for details.
5487: .It Ev TMUX_TMPDIR
5488: The parent directory of the directory containing the server sockets.
5489: See the
5490: .Fl L
5491: option for details.
5492: .It Ev VISUAL
5493: If the command specified in this variable contains the string
5494: .Ql vi ,
5495: use vi-style key bindings.
5496: Overridden by the
5497: .Ic mode-keys
5498: and
5499: .Ic status-keys
5500: options.
1.1 nicm 5501: .El
5502: .Sh FILES
1.26 nicm 5503: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1 nicm 5504: .It Pa ~/.tmux.conf
1.6 jmc 5505: Default
1.1 nicm 5506: .Nm
1.6 jmc 5507: configuration file.
1.26 nicm 5508: .It Pa /etc/tmux.conf
5509: System-wide configuration file.
1.1 nicm 5510: .El
1.57 jmc 5511: .Sh EXAMPLES
5512: To create a new
5513: .Nm
5514: session running
5515: .Xr vi 1 :
5516: .Pp
5517: .Dl $ tmux new-session vi
5518: .Pp
5519: Most commands have a shorter form, known as an alias.
5520: For new-session, this is
5521: .Ic new :
5522: .Pp
5523: .Dl $ tmux new vi
5524: .Pp
5525: Alternatively, the shortest unambiguous form of a command is accepted.
5526: If there are several options, they are listed:
5527: .Bd -literal -offset indent
5528: $ tmux n
5529: ambiguous command: n, could be: new-session, new-window, next-window
5530: .Ed
5531: .Pp
5532: Within an active session, a new window may be created by typing
5533: .Ql C-b c
5534: (Ctrl
5535: followed by the
5536: .Ql b
5537: key
5538: followed by the
5539: .Ql c
5540: key).
5541: .Pp
5542: Windows may be navigated with:
5543: .Ql C-b 0
5544: (to select window 0),
5545: .Ql C-b 1
5546: (to select window 1), and so on;
5547: .Ql C-b n
5548: to select the next window; and
5549: .Ql C-b p
5550: to select the previous window.
5551: .Pp
5552: A session may be detached using
5553: .Ql C-b d
1.64 nicm 5554: (or by an external event such as
5555: .Xr ssh 1
5556: disconnection) and reattached with:
1.57 jmc 5557: .Pp
5558: .Dl $ tmux attach-session
5559: .Pp
5560: Typing
5561: .Ql C-b \&?
5562: lists the current key bindings in the current window; up and down may be used
5563: to navigate the list or
5564: .Ql q
5565: to exit from it.
5566: .Pp
5567: Commands to be run when the
5568: .Nm
5569: server is started may be placed in the
5570: .Pa ~/.tmux.conf
5571: configuration file.
5572: Common examples include:
5573: .Pp
5574: Changing the default prefix key:
5575: .Bd -literal -offset indent
5576: set-option -g prefix C-a
5577: unbind-key C-b
5578: bind-key C-a send-prefix
5579: .Ed
5580: .Pp
5581: Turning the status line off, or changing its colour:
5582: .Bd -literal -offset indent
5583: set-option -g status off
1.378 nicm 5584: set-option -g status-style bg=blue
1.57 jmc 5585: .Ed
5586: .Pp
5587: Setting other options, such as the default command,
5588: or locking after 30 minutes of inactivity:
5589: .Bd -literal -offset indent
5590: set-option -g default-command "exec /bin/ksh"
5591: set-option -g lock-after-time 1800
5592: .Ed
5593: .Pp
5594: Creating new key bindings:
5595: .Bd -literal -offset indent
5596: bind-key b set-option status
5597: bind-key / command-prompt "split-window 'exec man %%'"
1.73 nicm 5598: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57 jmc 5599: .Ed
1.1 nicm 5600: .Sh SEE ALSO
5601: .Xr pty 4
5602: .Sh AUTHORS
1.477 nicm 5603: .An Nicholas Marriott Aq Mt nicholas.marriott@gmail.com