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