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