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