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