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