Annotation of src/usr.bin/tmux/tmux.1, Revision 1.236
1.236 ! nicm 1: .\" $OpenBSD: tmux.1,v 1.235 2011/07/02 21:05:44 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.236 ! nicm 17: .Dd $Mdocdate: July 2 2011 $
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.114 nicm 26: .Op Fl 28lquv
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.
101: .It Fl 8
102: Like
103: .Fl 2 ,
1.6 jmc 104: but indicates that the terminal supports 88 colours.
1.91 nicm 105: .It Fl c Ar shell-command
106: Execute
107: .Ar shell-command
108: using the default shell.
109: If necessary, the
110: .Nm
111: server will be started to retrieve the
112: .Ic default-shell
113: option.
1.153 nicm 114: This option is for compatibility with
115: .Xr sh 1
116: when
117: .Nm
118: is used as a login shell.
1.1 nicm 119: .It Fl f Ar file
120: Specify an alternative configuration file.
121: By default,
122: .Nm
1.26 nicm 123: loads the system configuration file from
124: .Pa /etc/tmux.conf ,
125: if present, then looks for a user configuration file at
1.1 nicm 126: .Pa ~/.tmux.conf .
127: The configuration file is a set of
128: .Nm
129: commands which are executed in sequence when the server is first started.
1.61 nicm 130: .Pp
131: If a command in the configuration file fails,
132: .Nm
133: will report an error and exit without executing further commands.
1.1 nicm 134: .It Fl L Ar socket-name
135: .Nm
136: stores the server socket in a directory under
1.208 nicm 137: .Pa /tmp
138: (or
139: .Ev TMPDIR
140: if set);
1.1 nicm 141: the default socket is named
142: .Em default .
143: This option allows a different socket name to be specified, allowing several
144: independent
145: .Nm
146: servers to be run.
147: Unlike
148: .Fl S
149: a full path is not necessary: the sockets are all created in the same
150: directory.
1.2 nicm 151: .Pp
152: If the socket is accidentally removed, the
1.6 jmc 153: .Dv SIGUSR1
1.2 nicm 154: signal may be sent to the
155: .Nm
156: server process to recreate it.
1.166 sobrado 157: .It Fl l
158: Behave as a login shell.
159: This flag currently has no effect and is for compatibility with other shells
160: when using tmux as a login shell.
1.4 sobrado 161: .It Fl q
1.133 nicm 162: Set the
163: .Ic quiet
164: server option to prevent the server sending various informational messages.
1.1 nicm 165: .It Fl S Ar socket-path
166: Specify a full alternative path to the server socket.
167: If
168: .Fl S
169: is specified, the default socket directory is not used and any
170: .Fl L
171: flag is ignored.
172: .It Fl u
173: .Nm
1.14 nicm 174: attempts to guess if the terminal is likely to support UTF-8 by checking the
175: first of the
176: .Ev LC_ALL ,
177: .Ev LC_CTYPE
178: and
1.2 nicm 179: .Ev LANG
1.14 nicm 180: environment variables to be set for the string "UTF-8".
1.5 nicm 181: This is not always correct: the
1.2 nicm 182: .Fl u
183: flag explicitly informs
184: .Nm
1.6 jmc 185: that UTF-8 is supported.
1.33 nicm 186: .Pp
187: If the server is started from a client passed
188: .Fl u
189: or where UTF-8 is detected, the
190: .Ic utf8
191: and
192: .Ic status-utf8
193: options are enabled in the global window and session options respectively.
1.1 nicm 194: .It Fl v
195: Request verbose logging.
196: This option may be specified multiple times for increasing verbosity.
197: Log messages will be saved into
198: .Pa tmux-client-PID.log
199: and
200: .Pa tmux-server-PID.log
201: files in the current directory, where
202: .Em PID
1.6 jmc 203: is the PID of the server or client process.
1.1 nicm 204: .It Ar command Op Ar flags
205: This specifies one of a set of commands used to control
206: .Nm ,
1.6 jmc 207: as described in the following sections.
1.59 jmc 208: If no commands are specified, the
1.1 nicm 209: .Ic new-session
210: command is assumed.
1.57 jmc 211: .El
1.64 nicm 212: .Sh KEY BINDINGS
213: .Nm
214: may be controlled from an attached client by using a key combination of a
215: prefix key,
216: .Ql C-b
217: (Ctrl-b) by default, followed by a command key.
218: .Pp
1.172 nicm 219: The default command key bindings are:
1.64 nicm 220: .Pp
1.171 nicm 221: .Bl -tag -width "XXXXXXXXXX" -offset indent -compact
222: .It C-b
223: Send the prefix key (C-b) through to the application.
224: .It C-o
225: Rotate the panes in the current window forwards.
226: .It C-z
227: Suspend the
228: .Nm
229: client.
230: .It !
231: Break the current pane out of the window.
232: .It \&"
233: Split the current pane into two, top and bottom.
234: .It #
235: List all paste buffers.
1.236 ! nicm 236: .It $
! 237: Rename the current session.
1.171 nicm 238: .It %
239: Split the current pane into two, left and right.
240: .It &
241: Kill the current window.
242: .It '
243: Prompt for a window index to select.
244: .It ,
245: Rename the current window.
246: .It -
247: Delete the most recently copied buffer of text.
248: .It .
249: Prompt for an index to move the current window.
250: .It 0 to 9
251: Select windows 0 to 9.
252: .It :
253: Enter the
254: .Nm
255: command prompt.
1.187 nicm 256: .It ;
257: Move to the previously active pane.
1.178 nicm 258: .It =
259: Choose which buffer to paste interactively from a list.
1.171 nicm 260: .It \&?
261: List all key bindings.
262: .It D
263: Choose a client to detach.
1.182 jmc 264: .It \&[
1.171 nicm 265: Enter copy mode to copy text or view the history.
1.182 jmc 266: .It \&]
1.171 nicm 267: Paste the most recently copied buffer of text.
1.64 nicm 268: .It c
1.65 nicm 269: Create a new window.
1.64 nicm 270: .It d
1.65 nicm 271: Detach the current client.
1.171 nicm 272: .It f
273: Prompt to search for text in open windows.
274: .It i
275: Display some information about the current window.
1.64 nicm 276: .It l
1.65 nicm 277: Move to the previously selected window.
1.64 nicm 278: .It n
1.65 nicm 279: Change to the next window.
1.171 nicm 280: .It o
281: Select the next pane in the current window.
1.64 nicm 282: .It p
1.65 nicm 283: Change to the previous window.
1.171 nicm 284: .It q
285: Briefly display pane indexes.
286: .It r
287: Force redraw of the attached client.
288: .It s
289: Select a new session for the attached client interactively.
1.194 nicm 290: .It L
291: Switch the attached client back to the last session.
1.171 nicm 292: .It t
293: Show the time.
294: .It w
295: Choose the current window interactively.
296: .It x
297: Kill the current pane.
298: .It {
299: Swap the current pane with the previous pane.
300: .It }
301: Swap the current pane with the next pane.
302: .It ~
303: Show previous messages from
304: .Nm ,
305: if any.
306: .It Page Up
307: Enter copy mode and scroll one page up.
308: .It Up, Down
309: .It Left, Right
310: Change to the pane above, below, to the left, or to the right of the current
311: pane.
312: .It M-1 to M-5
313: Arrange panes in one of the five preset layouts: even-horizontal,
314: even-vertical, main-horizontal, main-vertical, or tiled.
315: .It M-n
316: Move to the next window with a bell or activity marker.
317: .It M-o
318: Rotate the panes in the current window backwards.
319: .It M-p
320: Move to the previous window with a bell or activity marker.
321: .It C-Up, C-Down
322: .It C-Left, C-Right
323: Resize the current pane in steps of one cell.
324: .It M-Up, M-Down
325: .It M-Left, M-Right
326: Resize the current pane in steps of five cells.
1.64 nicm 327: .El
328: .Pp
329: Key bindings may be changed with the
330: .Ic bind-key
331: and
332: .Ic unbind-key
333: commands.
1.57 jmc 334: .Sh COMMANDS
335: This section contains a list of the commands supported by
336: .Nm .
337: Most commands accept the optional
338: .Fl t
339: argument with one of
340: .Ar target-client ,
341: .Ar target-session
342: .Ar target-window ,
343: or
344: .Ar target-pane .
345: These specify the client, session, window or pane which a command should affect.
346: .Ar target-client
347: is the name of the
348: .Xr pty 4
349: file to which the client is connected, for example either of
350: .Pa /dev/ttyp1
351: or
352: .Pa ttyp1
353: for the client attached to
354: .Pa /dev/ttyp1 .
355: If no client is specified, the current client is chosen, if possible, or an
356: error is reported.
357: Clients may be listed with the
358: .Ic list-clients
359: command.
1.1 nicm 360: .Pp
1.57 jmc 361: .Ar target-session
362: is either the name of a session (as listed by the
363: .Ic list-sessions
364: command) or the name of a client with the same syntax as
365: .Ar target-client ,
366: in which case the session attached to the client is used.
367: When looking for the session name,
368: .Nm
369: initially searches for an exact match; if none is found, the session names
370: are checked for any for which
371: .Ar target-session
372: is a prefix or for which it matches as an
373: .Xr fnmatch 3
374: pattern.
375: If a single match is found, it is used as the target session; multiple matches
376: produce an error.
377: If a session is omitted, the current session is used if available; if no
1.117 nicm 378: current session is available, the most recently used is chosen.
1.1 nicm 379: .Pp
1.57 jmc 380: .Ar target-window
381: specifies a window in the form
382: .Em session Ns \&: Ns Em window .
383: .Em session
384: follows the same rules as for
385: .Ar target-session ,
386: and
387: .Em window
388: is looked for in order: as a window index, for example mysession:1; as an exact
389: window name, such as mysession:mywindow; then as an
390: .Xr fnmatch 3
391: pattern or the start of a window name, such as mysession:mywin* or
392: mysession:mywin.
393: An empty window name specifies the next unused index if appropriate (for
394: example the
395: .Ic new-window
396: and
397: .Ic link-window
398: commands)
399: otherwise the current window in
400: .Em session
401: is chosen.
1.140 nicm 402: The special character
403: .Ql \&!
404: uses the last (previously current) window, or
405: .Ql +
406: and
407: .Ql -
408: are the next window or the previous window by number.
1.57 jmc 409: When the argument does not contain a colon,
410: .Nm
411: first attempts to parse it as window; if that fails, an attempt is made to
412: match a session.
1.1 nicm 413: .Pp
1.57 jmc 414: .Ar target-pane
415: takes a similar form to
416: .Ar target-window
417: but with the optional addition of a period followed by a pane index, for
418: example: mysession:mywindow.1.
419: If the pane index is omitted, the currently active pane in the specified
420: window is used.
421: If neither a colon nor period appears,
1.13 nicm 422: .Nm
1.57 jmc 423: first attempts to use the argument as a pane index; if that fails, it is looked
424: up as for
425: .Ar target-window .
1.156 nicm 426: A
427: .Ql +
428: or
429: .Ql -
430: indicate the next or previous pane index, respectively.
1.132 nicm 431: One of the strings
432: .Em top ,
433: .Em bottom ,
434: .Em left ,
435: .Em right ,
436: .Em top-left ,
437: .Em top-right ,
1.216 nicm 438: .Em bottom-left
439: or
1.132 nicm 440: .Em bottom-right
441: may be used instead of a pane index.
1.177 nicm 442: .Pp
443: The special characters
444: .Ql +
445: and
446: .Ql -
447: may be followed by an offset, for example:
448: .Bd -literal -offset indent
449: select-window -t:+2
450: .Ed
451: .Pp
452: When dealing with a session that doesn't contain sequential window indexes,
453: they will be correctly skipped.
1.212 nicm 454: .Pp
455: .Nm
456: also gives each pane created in a server an identifier consisting of a
457: .Ql %
458: and a number, starting from zero.
459: A pane's identifier is unique for the life of the
460: .Nm
461: server and is passed to the child process of the pane in the
462: .Ev TMUX_PANE
463: environment variable.
464: It may be used alone to target a pane or the window containing it.
1.15 jmc 465: .Pp
1.153 nicm 466: .Ar shell-command
467: arguments are
468: .Xr sh 1
469: commands.
470: These must be passed as a single item, which typically means quoting them, for
471: example:
472: .Bd -literal -offset indent
473: new-window 'vi /etc/passwd'
474: .Ed
475: .Pp
476: .Ar command
477: .Op Ar arguments
478: refers to a
479: .Nm
480: command, passed with the command and arguments separately, for example:
481: .Bd -literal -offset indent
482: bind-key F1 set-window-option force-width 81
483: .Ed
484: .Pp
485: Or if using
486: .Xr sh 1 :
487: .Bd -literal -offset indent
488: $ tmux bind-key F1 set-window-option force-width 81
489: .Ed
490: .Pp
1.57 jmc 491: Multiple commands may be specified together as part of a
492: .Em command sequence .
493: Each command should be separated by spaces and a semicolon;
494: commands are executed sequentially from left to right.
495: A literal semicolon may be included by escaping it with a backslash (for
496: example, when specifying a command sequence to
497: .Ic bind-key ) .
1.13 nicm 498: .Pp
1.153 nicm 499: Example
500: .Nm
501: commands include:
1.13 nicm 502: .Bd -literal -offset indent
1.57 jmc 503: refresh-client -t/dev/ttyp2
504:
505: rename-session -tfirst newname
506:
507: set-window-option -t:0 monitor-activity on
508:
509: new-window ; split-window -d
1.13 nicm 510: .Ed
1.153 nicm 511: .Pp
512: Or from
513: .Xr sh 1 :
514: .Bd -literal -offset indent
515: $ tmux kill-window -t :1
516:
1.159 jmc 517: $ tmux new-window \e; split-window -d
1.153 nicm 518:
1.159 jmc 519: $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
1.153 nicm 520: .Ed
1.57 jmc 521: .Sh CLIENTS AND SESSIONS
1.153 nicm 522: The
523: .Nm
524: server manages clients, sessions, windows and panes.
525: Clients are attached to sessions to interact with them, either
526: when they are created with the
527: .Ic new-session
528: command, or later with the
529: .Ic attach-session
530: command.
1.188 nicm 531: Each session has one or more windows
1.153 nicm 532: .Em linked
533: into it.
534: Windows may be linked to multiple sessions and are made up of one or
535: more panes,
536: each of which contains a pseudo terminal.
537: Commands for creating, linking and otherwise manipulating windows
538: are covered
539: in the
540: .Sx WINDOWS AND PANES
541: section.
542: .Pp
543: The following commands are available to manage clients and sessions:
1.57 jmc 544: .Bl -tag -width Ds
545: .It Xo Ic attach-session
1.148 nicm 546: .Op Fl dr
1.57 jmc 547: .Op Fl t Ar target-session
548: .Xc
549: .D1 (alias: Ic attach )
550: If run from outside
551: .Nm ,
552: create a new client in the current terminal and attach it to
553: .Ar target-session .
554: If used from inside, switch the current client.
555: If
556: .Fl d
557: is specified, any other clients attached to the session are detached.
1.148 nicm 558: .Fl r
559: signifies the client is read-only (only keys bound to the
560: .Ic detach-client
561: command have any effect)
1.13 nicm 562: .Pp
1.57 jmc 563: If no server is started,
564: .Ic attach-session
565: will attempt to start it; this will fail unless sessions are created in the
566: configuration file.
1.217 nicm 567: .Pp
568: The
569: .Ar target-session
570: rules for
571: .Ic attach-session
572: are slightly adjusted: if
573: .Nm
574: needs to select the most recently used session, it will prefer the most
575: recently used
576: .Em unattached
577: session.
1.211 nicm 578: .It Xo Ic detach-client
579: .Op Fl P
1.219 nicm 580: .Op Fl s Ar target-session
1.211 nicm 581: .Op Fl t Ar target-client
582: .Xc
1.57 jmc 583: .D1 (alias: Ic detach )
1.218 nicm 584: Detach the current client if bound to a key, the client specified with
585: .Fl t ,
586: or all clients currently attached to to the session specified by
587: .Fl s .
1.211 nicm 588: If
589: .Fl P
590: is given, send SIGHUP to the parent process of the client, typically causing it
591: to exit.
1.57 jmc 592: .It Ic has-session Op Fl t Ar target-session
593: .D1 (alias: Ic has )
594: Report an error and exit with 1 if the specified session does not exist.
595: If it does exist, exit with 0.
596: .It Ic kill-server
597: Kill the
1.1 nicm 598: .Nm
1.57 jmc 599: server and clients and destroy all sessions.
600: .It Ic kill-session Op Fl t Ar target-session
601: Destroy the given session, closing any windows linked to it and no other
602: sessions, and detaching all clients attached to it.
1.220 nicm 603: .It Ic list-clients Op Fl t Ar target-session
1.57 jmc 604: .D1 (alias: Ic lsc )
1.221 jmc 605: List all clients attached to the server.
606: If
1.220 nicm 607: .Ar target-session
608: is specified, list only clients connected to that session.
1.57 jmc 609: .It Ic list-commands
610: .D1 (alias: Ic lscm )
611: List the syntax of all commands supported by
612: .Nm .
613: .It Ic list-sessions
614: .D1 (alias: Ic ls )
615: List all sessions managed by the server.
1.175 nicm 616: .It Ic lock-client Op Fl t Ar target-client
617: .D1 (alias: Ic lockc )
1.92 nicm 618: Lock
619: .Ar target-client ,
620: see the
621: .Ic lock-server
622: command.
1.175 nicm 623: .It Ic lock-session Op Fl t Ar target-session
624: .D1 (alias: Ic locks )
1.92 nicm 625: Lock all clients attached to
626: .Ar target-session .
1.57 jmc 627: .It Xo Ic new-session
628: .Op Fl d
629: .Op Fl n Ar window-name
630: .Op Fl s Ar session-name
1.101 nicm 631: .Op Fl t Ar target-session
1.210 nicm 632: .Op Fl x Ar width
633: .Op Fl y Ar height
1.153 nicm 634: .Op Ar shell-command
1.57 jmc 635: .Xc
636: .D1 (alias: Ic new )
637: Create a new session with name
638: .Ar session-name .
1.153 nicm 639: .Pp
1.57 jmc 640: The new session is attached to the current terminal unless
641: .Fl d
642: is given.
643: .Ar window-name
1.1 nicm 644: and
1.153 nicm 645: .Ar shell-command
646: are the name of and shell command to execute in the initial window.
1.210 nicm 647: If
648: .Fl d
649: is used,
650: .Fl x
651: and
652: .Fl y
653: specify the size of the initial window (80 by 24 if not given).
1.68 nicm 654: .Pp
655: If run from a terminal, any
656: .Xr termios 4
657: special characters are saved and used for new windows in the new session.
1.101 nicm 658: .Pp
659: If
660: .Fl t
661: is given, the new session is
662: .Em grouped
663: with
664: .Ar target-session .
665: This means they share the same set of windows - all windows from
666: .Ar target-session
667: are linked to the new session and any subsequent new windows or windows being
668: closed are applied to both sessions.
669: The current and previous window and any session options remain independent and
670: either session may be killed without affecting the other.
671: Giving
672: .Fl n
673: or
1.153 nicm 674: .Ar shell-command
1.101 nicm 675: are invalid if
676: .Fl t
677: is used.
1.57 jmc 678: .It Ic refresh-client Op Fl t Ar target-client
679: .D1 (alias: Ic refresh )
680: Refresh the current client if bound to a key, or a single client if one is given
681: with
682: .Fl t .
683: .It Xo Ic rename-session
684: .Op Fl t Ar target-session
685: .Ar new-name
686: .Xc
687: .D1 (alias: Ic rename )
688: Rename the session to
689: .Ar new-name .
1.121 nicm 690: .It Xo Ic show-messages
1.120 nicm 691: .Op Fl t Ar target-client
692: .Xc
693: .D1 (alias: Ic showmsgs )
694: Any messages displayed on the status line are saved in a per-client message
695: log, up to a maximum of the limit set by the
696: .Ar message-limit
697: session option for the session attached to that client.
698: This command displays the log for
699: .Ar target-client .
1.57 jmc 700: .It Ic source-file Ar path
701: .D1 (alias: Ic source )
702: Execute commands from
703: .Ar path .
704: .It Ic start-server
705: .D1 (alias: Ic start )
706: Start the
1.1 nicm 707: .Nm
1.57 jmc 708: server, if not already running, without creating any sessions.
709: .It Xo Ic suspend-client
1.202 nicm 710: .Op Fl t Ar target-client
1.57 jmc 711: .Xc
712: .D1 (alias: Ic suspendc )
713: Suspend a client by sending
714: .Dv SIGTSTP
715: (tty stop).
716: .It Xo Ic switch-client
1.194 nicm 717: .Op Fl lnp
1.57 jmc 718: .Op Fl c Ar target-client
719: .Op Fl t Ar target-session
720: .Xc
721: .D1 (alias: Ic switchc )
722: Switch the current session for client
723: .Ar target-client
724: to
725: .Ar target-session .
1.183 nicm 726: If
1.197 jmc 727: .Fl l ,
1.183 nicm 728: .Fl n
729: or
730: .Fl p
1.194 nicm 731: is used, the client is moved to the last, next or previous session
732: respectively.
1.57 jmc 733: .El
734: .Sh WINDOWS AND PANES
1.1 nicm 735: A
736: .Nm
737: window may be in one of several modes.
738: The default permits direct access to the terminal attached to the window.
1.164 nicm 739: The other is copy mode, which permits a section of a window or its
740: history to be copied to a
1.1 nicm 741: .Em paste buffer
742: for later insertion into another window.
743: This mode is entered with the
744: .Ic copy-mode
745: command, bound to
1.113 nicm 746: .Ql \&[
1.1 nicm 747: by default.
1.164 nicm 748: It is also entered when a command that produces output, such as
749: .Ic list-keys ,
750: is executed from a key binding.
1.1 nicm 751: .Pp
1.6 jmc 752: The keys available depend on whether emacs or vi mode is selected
753: (see the
1.1 nicm 754: .Ic mode-keys
755: option).
756: The following keys are supported as appropriate for the mode:
1.157 nicm 757: .Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
1.1 nicm 758: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
1.27 nicm 759: .It Li "Back to indentation" Ta "^" Ta "M-m"
1.142 nicm 760: .It Li "Bottom of history" Ta "G" Ta "M-<"
1.1 nicm 761: .It Li "Clear selection" Ta "Escape" Ta "C-g"
762: .It Li "Copy selection" Ta "Enter" Ta "M-w"
763: .It Li "Cursor down" Ta "j" Ta "Down"
1.70 nicm 764: .It Li "Cursor left" Ta "h" Ta "Left"
765: .It Li "Cursor right" Ta "l" Ta "Right"
1.116 nicm 766: .It Li "Cursor to bottom line" Ta "L" Ta ""
767: .It Li "Cursor to middle line" Ta "M" Ta "M-r"
768: .It Li "Cursor to top line" Ta "H" Ta "M-R"
1.70 nicm 769: .It Li "Cursor up" Ta "k" Ta "Up"
1.71 nicm 770: .It Li "Delete entire line" Ta "d" Ta "C-u"
1.227 nicm 771: .It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
1.1 nicm 772: .It Li "End of line" Ta "$" Ta "C-e"
1.142 nicm 773: .It Li "Go to line" Ta ":" Ta "g"
1.116 nicm 774: .It Li "Half page down" Ta "C-d" Ta "M-Down"
775: .It Li "Half page up" Ta "C-u" Ta "M-Up"
1.157 nicm 776: .It Li "Jump forward" Ta "f" Ta "f"
777: .It Li "Jump backward" Ta "F" Ta "F"
778: .It Li "Jump again" Ta ";" Ta ";"
779: .It Li "Jump again in reverse" Ta "," Ta ","
1.1 nicm 780: .It Li "Next page" Ta "C-f" Ta "Page down"
1.146 nicm 781: .It Li "Next space" Ta "W" Ta ""
782: .It Li "Next space, end of word" Ta "E" Ta ""
1.143 nicm 783: .It Li "Next word" Ta "w" Ta ""
784: .It Li "Next word end" Ta "e" Ta "M-f"
1.70 nicm 785: .It Li "Paste buffer" Ta "p" Ta "C-y"
1.116 nicm 786: .It Li "Previous page" Ta "C-b" Ta "Page up"
1.1 nicm 787: .It Li "Previous word" Ta "b" Ta "M-b"
1.146 nicm 788: .It Li "Previous space" Ta "B" Ta ""
1.1 nicm 789: .It Li "Quit mode" Ta "q" Ta "Escape"
1.147 nicm 790: .It Li "Rectangle toggle" Ta "v" Ta "R"
1.141 nicm 791: .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
792: .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
1.70 nicm 793: .It Li "Search again" Ta "n" Ta "n"
1.152 nicm 794: .It Li "Search again in reverse" Ta "N" Ta "N"
1.70 nicm 795: .It Li "Search backward" Ta "?" Ta "C-r"
796: .It Li "Search forward" Ta "/" Ta "C-s"
797: .It Li "Start of line" Ta "0" Ta "C-a"
1.1 nicm 798: .It Li "Start selection" Ta "Space" Ta "C-Space"
1.142 nicm 799: .It Li "Top of history" Ta "g" Ta "M->"
1.80 nicm 800: .It Li "Transpose chars" Ta "" Ta "C-t"
1.1 nicm 801: .El
1.146 nicm 802: .Pp
803: The next and previous word keys use space and the
804: .Ql - ,
1.154 nicm 805: .Ql _
1.146 nicm 806: and
807: .Ql @
1.154 nicm 808: characters as word delimiters by default, but this can be adjusted by
809: setting the
810: .Em word-separators
811: window option.
1.146 nicm 812: Next word moves to the start of the next word, next word end to the end of the
813: next word and previous word to the start of the previous word.
814: The three next and previous space keys work similarly but use a space alone as
815: the word separator.
1.157 nicm 816: .Pp
817: The jump commands enable quick movement within a line.
818: For instance, typing
819: .Ql f
820: followed by
821: .Ql /
822: will move the cursor to the next
823: .Ql /
824: character on the current line.
825: A
826: .Ql \&;
827: will then jump to the next occurrence.
1.1 nicm 828: .Pp
1.155 nicm 829: Commands in copy mode may be prefaced by an optional repeat count.
830: With vi key bindings, a prefix is entered using the number keys; with
831: emacs, the Alt (meta) key and a number begins prefix entry.
832: For example, to move the cursor forward by ten words, use
833: .Ql M-1 0 M-f
834: in emacs mode, and
835: .Ql 10w
836: in vi.
837: .Pp
838: Mode key bindings are defined in a set of named tables:
1.48 nicm 839: .Em vi-edit
840: and
841: .Em emacs-edit
842: for keys used when line editing at the command prompt;
843: .Em vi-choice
844: and
845: .Em emacs-choice
846: for keys used when choosing from lists (such as produced by the
1.144 nicm 847: .Ic choose-window
1.164 nicm 848: command); and
1.48 nicm 849: .Em vi-copy
850: and
851: .Em emacs-copy
1.97 nicm 852: used in copy mode.
1.48 nicm 853: The tables may be viewed with the
854: .Ic list-keys
1.49 nicm 855: command and keys modified or removed with
856: .Ic bind-key
857: and
858: .Ic unbind-key .
1.48 nicm 859: .Pp
1.2 nicm 860: The paste buffer key pastes the first line from the top paste buffer on the
861: stack.
1.57 jmc 862: .Pp
1.164 nicm 863: The synopsis for the
864: .Ic copy-mode
865: command is:
1.57 jmc 866: .Bl -tag -width Ds
867: .It Xo Ic copy-mode
868: .Op Fl u
1.72 nicm 869: .Op Fl t Ar target-pane
1.57 jmc 870: .Xc
871: Enter copy mode.
872: The
873: .Fl u
874: option scrolls one page up.
875: .El
1.18 nicm 876: .Pp
1.1 nicm 877: Each window displayed by
878: .Nm
879: may be split into one or more
880: .Em panes ;
881: each pane takes up a certain area of the display and is a separate terminal.
882: A window may be split into panes using the
883: .Ic split-window
884: command.
1.38 nicm 885: Windows may be split horizontally (with the
886: .Fl h
887: flag) or vertically.
888: Panes may be resized with the
889: .Ic resize-pane
1.1 nicm 890: command (bound to
1.38 nicm 891: .Ql C-up ,
892: .Ql C-down
893: .Ql C-left
894: and
895: .Ql C-right
1.1 nicm 896: by default), the current pane may be changed with the
1.156 nicm 897: .Ic select-pane
898: command and the
1.1 nicm 899: .Ic rotate-window
900: and
901: .Ic swap-pane
1.38 nicm 902: commands may be used to swap panes without changing their position.
903: Panes are numbered beginning from zero in the order they are created.
904: .Pp
905: A number of preset
906: .Em layouts
907: are available.
908: These may be selected with the
909: .Ic select-layout
910: command or cycled with
911: .Ic next-layout
912: (bound to
1.149 nicm 913: .Ql Space
1.131 nicm 914: by default); once a layout is chosen, panes within it may be moved and resized
915: as normal.
1.1 nicm 916: .Pp
917: The following layouts are supported:
918: .Bl -tag -width Ds
919: .It Ic even-horizontal
920: Panes are spread out evenly from left to right across the window.
921: .It Ic even-vertical
922: Panes are spread evenly from top to bottom.
1.2 nicm 923: .It Ic main-horizontal
1.131 nicm 924: A large (main) pane is shown at the top of the window and the remaining panes
925: are spread from left to right in the leftover space at the bottom.
1.2 nicm 926: Use the
927: .Em main-pane-height
928: window option to specify the height of the top pane.
1.1 nicm 929: .It Ic main-vertical
1.2 nicm 930: Similar to
931: .Ic main-horizontal
932: but the large pane is placed on the left and the others spread from top to
933: bottom along the right.
934: See the
935: .Em main-pane-width
936: window option.
1.165 nicm 937: .It Ic tiled
938: Panes are spread out as evenly as possible over the window in both rows and
939: columns.
1.1 nicm 940: .El
1.8 nicm 941: .Pp
1.181 nicm 942: In addition,
943: .Ic select-layout
944: may be used to apply a previously used layout - the
945: .Ic list-windows
946: command displays the layout of each window in a form suitable for use with
947: .Ic select-layout .
948: For example:
949: .Bd -literal -offset indent
950: $ tmux list-windows
951: 0: ksh [159x48]
952: layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
953: $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
954: .Ed
1.196 nicm 955: .Pp
1.181 nicm 956: .Nm
957: automatically adjusts the size of the layout for the current window size.
958: Note that a layout cannot be applied to a window with more panes than that
959: from which the layout was originally defined.
960: .Pp
1.57 jmc 961: Commands related to windows and panes are as follows:
962: .Bl -tag -width Ds
963: .It Xo Ic break-pane
964: .Op Fl d
965: .Op Fl t Ar target-pane
966: .Xc
967: .D1 (alias: Ic breakp )
968: Break
969: .Ar target-pane
970: off from its containing window to make it the only pane in a new window.
971: If
972: .Fl d
973: is given, the new window does not become the current window.
1.128 nicm 974: .It Xo Ic capture-pane
975: .Op Fl b Ar buffer-index
1.213 nicm 976: .Op Fl E Ar end-line
977: .Op Fl S Ar start-line
1.128 nicm 978: .Op Fl t Ar target-pane
979: .Xc
980: .D1 (alias: Ic capturep )
981: Capture the contents of a pane to the specified buffer, or a new buffer if none
982: is specified.
1.213 nicm 983: .Pp
984: .Fl S
985: and
986: .Fl E
987: specify the starting and ending line numbers, zero is the first line of the
988: visible pane and negative numbers are lines in the history.
989: The default is to capture only the visible contents of the pane.
1.76 nicm 990: .It Xo
991: .Ic choose-client
992: .Op Fl t Ar target-window
993: .Op Ar template
994: .Xc
995: Put a window into client choice mode, allowing a client to be selected
996: interactively from a list.
997: After a client is chosen,
998: .Ql %%
999: is replaced by the client
1000: .Xr pty 4
1001: path in
1002: .Ar template
1003: and the result executed as a command.
1004: If
1005: .Ar template
1006: is not given, "detach-client -t '%%'" is used.
1.57 jmc 1007: This command works only from inside
1008: .Nm .
1.76 nicm 1009: .It Xo
1010: .Ic choose-session
1011: .Op Fl t Ar target-window
1012: .Op Ar template
1013: .Xc
1014: Put a window into session choice mode, where a session may be selected
1015: interactively from a list.
1016: When one is chosen,
1017: .Ql %%
1018: is replaced by the session name in
1019: .Ar template
1020: and the result executed as a command.
1021: If
1022: .Ar template
1023: is not given, "switch-client -t '%%'" is used.
1024: This command works only from inside
1025: .Nm .
1026: .It Xo
1027: .Ic choose-window
1028: .Op Fl t Ar target-window
1029: .Op Ar template
1030: .Xc
1031: Put a window into window choice mode, where a window may be chosen
1032: interactively from a list.
1033: After a window is selected,
1034: .Ql %%
1035: is replaced by the session name and window index in
1036: .Ar template
1037: and the result executed as a command.
1038: If
1039: .Ar template
1040: is not given, "select-window -t '%%'" is used.
1.57 jmc 1041: This command works only from inside
1042: .Nm .
1.78 nicm 1043: .It Ic display-panes Op Fl t Ar target-client
1044: .D1 (alias: Ic displayp)
1045: Display a visible indicator of each pane shown by
1046: .Ar target-client .
1047: See the
1.145 nicm 1048: .Ic display-panes-time ,
1049: .Ic display-panes-colour ,
1.78 nicm 1050: and
1.145 nicm 1051: .Ic display-panes-active-colour
1.78 nicm 1052: session options.
1.84 nicm 1053: While the indicator is on screen, a pane may be selected with the
1054: .Ql 0
1055: to
1056: .Ql 9
1057: keys.
1.57 jmc 1058: .It Xo Ic find-window
1059: .Op Fl t Ar target-window
1060: .Ar match-string
1061: .Xc
1062: .D1 (alias: Ic findw )
1063: Search for the
1064: .Xr fnmatch 3
1065: pattern
1066: .Ar match-string
1067: in window names, titles, and visible content (but not history).
1068: If only one window is matched, it'll be automatically selected, otherwise a
1069: choice list is shown.
1070: This command only works from inside
1.1 nicm 1071: .Nm .
1.137 nicm 1072: .It Xo Ic join-pane
1073: .Op Fl dhv
1074: .Oo Fl l
1075: .Ar size |
1076: .Fl p Ar percentage Oc
1077: .Op Fl s Ar src-pane
1078: .Op Fl t Ar dst-pane
1079: .Xc
1080: .D1 (alias: Ic joinp )
1081: Like
1082: .Ic split-window ,
1083: but instead of splitting
1084: .Ar dst-pane
1085: and creating a new pane, split it and move
1086: .Ar src-pane
1087: into the space.
1088: This can be used to reverse
1089: .Ic break-pane .
1.112 nicm 1090: .It Xo Ic kill-pane
1091: .Op Fl a
1092: .Op Fl t Ar target-pane
1093: .Xc
1.57 jmc 1094: .D1 (alias: Ic killp )
1095: Destroy the given pane.
1096: If no panes remain in the containing window, it is also destroyed.
1.112 nicm 1097: The
1098: .Fl a
1099: option kills all but the pane given with
1100: .Fl t .
1.57 jmc 1101: .It Ic kill-window Op Fl t Ar target-window
1102: .D1 (alias: Ic killw )
1103: Kill the current window or the window at
1104: .Ar target-window ,
1.1 nicm 1105: removing it from any sessions to which it is linked.
1.187 nicm 1106: .It Ic last-pane Op Fl t Ar target-window
1107: .D1 (alias: Ic lastp )
1108: Select the last (previously selected) pane.
1.56 jmc 1109: .It Ic last-window Op Fl t Ar target-session
1.1 nicm 1110: .D1 (alias: Ic last )
1111: Select the last (previously selected) window.
1112: If no
1113: .Ar target-session
1114: is specified, select the last window of the current session.
1115: .It Xo Ic link-window
1116: .Op Fl dk
1117: .Op Fl s Ar src-window
1118: .Op Fl t Ar dst-window
1119: .Xc
1120: .D1 (alias: Ic linkw )
1121: Link the window at
1122: .Ar src-window
1123: to the specified
1124: .Ar dst-window .
1125: If
1126: .Ar dst-window
1127: is specified and no such window exists, the
1128: .Ar src-window
1129: is linked there.
1130: If
1131: .Fl k
1132: is given and
1133: .Ar dst-window
1134: exists, it is killed, otherwise an error is generated.
1135: If
1136: .Fl d
1137: is given, the newly linked window is not selected.
1.214 nicm 1138: .It Xo Ic list-panes
1139: .Op Fl as
1140: .Op Fl t Ar target
1141: .Xc
1.104 nicm 1142: .D1 (alias: Ic lsp )
1.214 nicm 1143: If
1144: .Fl a
1145: is given,
1146: .Ar target
1147: is ignored and all panes on the server are listed.
1148: If
1149: .Fl s
1150: is given,
1151: .Ar target
1152: is a session (or the current session).
1153: If neither is given,
1154: .Ar target
1155: is a window (or the current window).
1156: .It Xo Ic list-windows
1157: .Op Fl a
1158: .Op Fl t Ar target-session
1159: .Xc
1.1 nicm 1160: .D1 (alias: Ic lsw )
1.214 nicm 1161: If
1162: .Fl a
1163: is given, list all windows on the server.
1164: Otherwise, list windows in the current session or in
1.1 nicm 1165: .Ar target-session .
1166: .It Xo Ic move-window
1.175 nicm 1167: .Op Fl dk
1.1 nicm 1168: .Op Fl s Ar src-window
1169: .Op Fl t Ar dst-window
1170: .Xc
1171: .D1 (alias: Ic movew )
1172: This is similar to
1173: .Ic link-window ,
1174: except the window at
1175: .Ar src-window
1176: is moved to
1177: .Ar dst-window .
1178: .It Xo Ic new-window
1.201 nicm 1179: .Op Fl adkP
1.1 nicm 1180: .Op Fl n Ar window-name
1181: .Op Fl t Ar target-window
1.153 nicm 1182: .Op Ar shell-command
1.1 nicm 1183: .Xc
1184: .D1 (alias: Ic neww )
1185: Create a new window.
1.160 nicm 1186: With
1187: .Fl a ,
1188: the new window is inserted at the next index up from the specified
1189: .Ar target-window ,
1190: moving windows up if necessary,
1191: otherwise
1192: .Ar target-window
1193: is the new window location.
1194: .Pp
1.1 nicm 1195: If
1196: .Fl d
1197: is given, the session does not make the new window the current window.
1198: .Ar target-window
1.28 nicm 1199: represents the window to be created; if the target already exists an error is
1200: shown, unless the
1201: .Fl k
1202: flag is used, in which case it is destroyed.
1.153 nicm 1203: .Ar shell-command
1.1 nicm 1204: is the command to execute.
1205: If
1.153 nicm 1206: .Ar shell-command
1207: is not specified, the value of the
1208: .Ic default-command
1209: option is used.
1210: .Pp
1211: When the shell command completes, the window closes.
1212: See the
1213: .Ic remain-on-exit
1214: option to change this behaviour.
1.1 nicm 1215: .Pp
1216: The
1217: .Ev TERM
1218: environment variable must be set to
1219: .Dq screen
1220: for all programs running
1221: .Em inside
1222: .Nm .
1223: New windows will automatically have
1224: .Dq TERM=screen
1225: added to their environment, but care must be taken not to reset this in shell
1226: start-up files.
1.201 nicm 1227: .Pp
1228: The
1229: .Fl P
1230: option prints the location of the new window after it has been created.
1.56 jmc 1231: .It Ic next-layout Op Fl t Ar target-window
1.1 nicm 1232: .D1 (alias: Ic nextl )
1233: Move a window to the next layout and rearrange the panes to fit.
1234: .It Xo Ic next-window
1.9 nicm 1235: .Op Fl a
1.1 nicm 1236: .Op Fl t Ar target-session
1237: .Xc
1238: .D1 (alias: Ic next )
1239: Move to the next window in the session.
1.9 nicm 1240: If
1.12 jmc 1241: .Fl a
1.9 nicm 1242: is used, move to the next window with a bell, activity or content alert.
1.107 nicm 1243: .It Xo Ic pipe-pane
1244: .Op Fl o
1245: .Op Fl t Ar target-pane
1.153 nicm 1246: .Op Ar shell-command
1.107 nicm 1247: .Xc
1248: .D1 (alias: Ic pipep )
1249: Pipe any output sent by the program in
1250: .Ar target-pane
1251: to a shell command.
1252: A pane may only be piped to one command at a time, any existing pipe is
1253: closed before
1.153 nicm 1254: .Ar shell-command
1.107 nicm 1255: is executed.
1.174 nicm 1256: The
1257: .Ar shell-command
1258: string may contain the special character sequences supported by the
1259: .Ic status-left
1.231 nicm 1260: option.
1.107 nicm 1261: If no
1.153 nicm 1262: .Ar shell-command
1.107 nicm 1263: is given, the current pipe (if any) is closed.
1264: .Pp
1265: The
1266: .Fl o
1267: option only opens a new pipe if no previous pipe exists, allowing a pipe to
1268: be toggled with a single key, for example:
1269: .Bd -literal -offset indent
1.174 nicm 1270: bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1.107 nicm 1271: .Ed
1.176 nicm 1272: .It Xo Ic previous-layout
1273: .Op Fl t Ar target-window
1274: .Xc
1275: .D1 (alias: Ic prevl )
1276: Move to the previous layout in the session.
1.1 nicm 1277: .It Xo Ic previous-window
1.9 nicm 1278: .Op Fl a
1.1 nicm 1279: .Op Fl t Ar target-session
1280: .Xc
1281: .D1 (alias: Ic prev )
1282: Move to the previous window in the session.
1.9 nicm 1283: With
1284: .Fl a ,
1285: move to the previous window with a bell, activity or content alert.
1.1 nicm 1286: .It Xo Ic rename-window
1287: .Op Fl t Ar target-window
1288: .Ar new-name
1289: .Xc
1290: .D1 (alias: Ic renamew )
1291: Rename the current window, or the window at
1292: .Ar target-window
1293: if specified, to
1294: .Ar new-name .
1295: .It Xo Ic resize-pane
1.39 jmc 1296: .Op Fl DLRU
1.52 nicm 1297: .Op Fl t Ar target-pane
1.1 nicm 1298: .Op Ar adjustment
1299: .Xc
1300: .D1 (alias: Ic resizep )
1.57 jmc 1301: Resize a pane, upward with
1302: .Fl U
1303: (the default), downward with
1304: .Fl D ,
1305: to the left with
1306: .Fl L
1307: and to the right with
1308: .Fl R .
1309: The
1310: .Ar adjustment
1311: is given in lines or cells (the default is 1).
1.234 nicm 1312: .It Xo Ic respawn-pane
1313: .Op Fl k
1314: .Op Fl t Ar target-pane
1315: .Op Ar shell-command
1316: .Xc
1317: .D1 (alias: Ic respawnp )
1318: Reactivate a pane in which the command has exited (see the
1319: .Ic remain-on-exit
1320: window option).
1321: If
1322: .Ar shell-command
1323: is not given, the command used when the pane was created is executed.
1324: The pane must be already inactive, unless
1325: .Fl k
1326: is given, in which case any existing command is killed.
1.57 jmc 1327: .It Xo Ic respawn-window
1328: .Op Fl k
1329: .Op Fl t Ar target-window
1.153 nicm 1330: .Op Ar shell-command
1.57 jmc 1331: .Xc
1332: .D1 (alias: Ic respawnw )
1.153 nicm 1333: Reactivate a window in which the command has exited (see the
1.57 jmc 1334: .Ic remain-on-exit
1335: window option).
1336: If
1.153 nicm 1337: .Ar shell-command
1.57 jmc 1338: is not given, the command used when the window was created is executed.
1339: The window must be already inactive, unless
1340: .Fl k
1341: is given, in which case any existing command is killed.
1342: .It Xo Ic rotate-window
1343: .Op Fl DU
1344: .Op Fl t Ar target-window
1345: .Xc
1346: .D1 (alias: Ic rotatew )
1347: Rotate the positions of the panes within a window, either upward (numerically
1348: lower) with
1349: .Fl U
1350: or downward (numerically higher).
1351: .It Xo Ic select-layout
1.204 nicm 1352: .Op Fl np
1.57 jmc 1353: .Op Fl t Ar target-window
1354: .Op Ar layout-name
1355: .Xc
1.176 nicm 1356: .D1 (alias: Ic selectl )
1.57 jmc 1357: Choose a specific layout for a window.
1358: If
1359: .Ar layout-name
1.181 nicm 1360: is not given, the last preset layout used (if any) is reapplied.
1.204 nicm 1361: .Fl n
1362: and
1363: .Fl p
1364: are equivalent to the
1365: .Ic next-layout
1366: and
1367: .Ic previous-layout
1368: commands.
1.156 nicm 1369: .It Xo Ic select-pane
1.204 nicm 1370: .Op Fl lDLRU
1.156 nicm 1371: .Op Fl t Ar target-pane
1372: .Xc
1.57 jmc 1373: .D1 (alias: Ic selectp )
1374: Make pane
1375: .Ar target-pane
1376: the active pane in window
1377: .Ar target-window .
1.156 nicm 1378: If one of
1379: .Fl D ,
1380: .Fl L ,
1381: .Fl R ,
1382: or
1383: .Fl U
1384: is used, respectively the pane below, to the left, to the right, or above the
1385: target pane is used.
1.204 nicm 1386: .Fl l
1387: is the same as using the
1388: .Ic last-pane
1389: command.
1390: .It Xo Ic select-window
1391: .Op Fl lnp
1392: .Op Fl t Ar target-window
1393: .Xc
1.57 jmc 1394: .D1 (alias: Ic selectw )
1395: Select the window at
1396: .Ar target-window .
1.204 nicm 1397: .Fl l ,
1398: .Fl n
1399: and
1400: .Fl p
1401: are equivalent to the
1402: .Ic last-window ,
1403: .Ic next-window
1404: and
1405: .Ic previous-window
1406: commands.
1.57 jmc 1407: .It Xo Ic split-window
1.201 nicm 1408: .Op Fl dhvP
1.57 jmc 1409: .Oo Fl l
1410: .Ar size |
1411: .Fl p Ar percentage Oc
1.136 nicm 1412: .Op Fl t Ar target-pane
1.153 nicm 1413: .Op Ar shell-command
1.57 jmc 1414: .Xc
1.176 nicm 1415: .D1 (alias: Ic splitw )
1.136 nicm 1416: Create a new pane by splitting
1417: .Ar target-pane :
1.57 jmc 1418: .Fl h
1419: does a horizontal split and
1420: .Fl v
1421: a vertical split; if neither is specified,
1422: .Fl v
1423: is assumed.
1424: The
1425: .Fl l
1426: and
1427: .Fl p
1.136 nicm 1428: options specify the size of the new pane in lines (for vertical split) or in
1.57 jmc 1429: cells (for horizontal split), or as a percentage, respectively.
1.136 nicm 1430: All other options have the same meaning as for the
1.57 jmc 1431: .Ic new-window
1432: command.
1433: .It Xo Ic swap-pane
1434: .Op Fl dDU
1435: .Op Fl s Ar src-pane
1436: .Op Fl t Ar dst-pane
1437: .Xc
1438: .D1 (alias: Ic swapp )
1439: Swap two panes.
1440: If
1441: .Fl U
1442: is used and no source pane is specified with
1443: .Fl s ,
1444: .Ar dst-pane
1445: is swapped with the previous pane (before it numerically);
1446: .Fl D
1447: swaps with the next pane (after it numerically).
1.138 nicm 1448: .Fl d
1449: instructs
1450: .Nm
1451: not to change the active pane.
1.57 jmc 1452: .It Xo Ic swap-window
1453: .Op Fl d
1454: .Op Fl s Ar src-window
1455: .Op Fl t Ar dst-window
1456: .Xc
1457: .D1 (alias: Ic swapw )
1458: This is similar to
1459: .Ic link-window ,
1460: except the source and destination windows are swapped.
1461: It is an error if no window exists at
1462: .Ar src-window .
1463: .It Xo Ic unlink-window
1.1 nicm 1464: .Op Fl k
1465: .Op Fl t Ar target-window
1466: .Xc
1.57 jmc 1467: .D1 (alias: Ic unlinkw )
1468: Unlink
1469: .Ar target-window .
1470: Unless
1471: .Fl k
1472: is given, a window may be unlinked only if it is linked to multiple sessions -
1473: windows may not be linked to no sessions;
1474: if
1.1 nicm 1475: .Fl k
1.57 jmc 1476: is specified and the window is linked to only one session, it is unlinked and
1477: destroyed.
1478: .El
1479: .Sh KEY BINDINGS
1.93 nicm 1480: .Nm
1481: allows a command to be bound to most keys, with or without a prefix key.
1482: When specifying keys, most represent themselves (for example
1483: .Ql A
1484: to
1.95 jmc 1485: .Ql Z ) .
1.93 nicm 1486: Ctrl keys may be prefixed with
1487: .Ql C-
1488: or
1.95 jmc 1489: .Ql ^ ,
1490: and Alt (meta) with
1.93 nicm 1491: .Ql M- .
1492: In addition, the following special key names are accepted:
1.126 nicm 1493: .Em Up ,
1494: .Em Down ,
1495: .Em Left ,
1496: .Em Right ,
1.93 nicm 1497: .Em BSpace ,
1498: .Em BTab ,
1499: .Em DC
1500: (Delete),
1501: .Em End ,
1502: .Em Enter ,
1503: .Em Escape ,
1504: .Em F1
1505: to
1506: .Em F20 ,
1507: .Em Home ,
1508: .Em IC
1509: (Insert),
1510: .Em NPage
1511: (Page Up),
1512: .Em PPage
1513: (Page Down),
1514: .Em Space ,
1515: and
1516: .Em Tab .
1517: Note that to bind the
1518: .Ql \&"
1519: or
1520: .Ql '
1521: keys, quotation marks are necessary, for example:
1522: .Bd -literal -offset indent
1523: bind-key '"' split-window
1.167 nicm 1524: bind-key "'" new-window
1.93 nicm 1525: .Ed
1526: .Pp
1.57 jmc 1527: Commands related to key bindings are as follows:
1528: .Bl -tag -width Ds
1529: .It Xo Ic bind-key
1530: .Op Fl cnr
1531: .Op Fl t Ar key-table
1532: .Ar key Ar command Op Ar arguments
1.1 nicm 1533: .Xc
1.57 jmc 1534: .D1 (alias: Ic bind )
1535: Bind key
1536: .Ar key
1537: to
1538: .Ar command .
1539: By default (without
1540: .Fl t )
1541: the primary key bindings are modified (those normally activated with the prefix
1542: key); in this case, if
1543: .Fl n
1544: is specified, it is not necessary to use the prefix key,
1545: .Ar command
1546: is bound to
1547: .Ar key
1548: alone.
1.1 nicm 1549: The
1.57 jmc 1550: .Fl r
1551: flag indicates this key may repeat, see the
1552: .Ic repeat-time
1553: option.
1554: .Pp
1555: If
1556: .Fl t
1557: is present,
1558: .Ar key
1559: is bound in
1560: .Ar key-table :
1561: the binding for command mode with
1562: .Fl c
1563: or for normal mode without.
1564: To view the default bindings and possible commands, see the
1565: .Ic list-keys
1566: command.
1567: .It Ic list-keys Op Fl t Ar key-table
1568: .D1 (alias: Ic lsk )
1569: List all key bindings.
1570: Without
1571: .Fl t
1572: the primary key bindings - those executed when preceded by the prefix key -
1573: are printed.
1574: Keys bound without the prefix key (see
1575: .Ic bind-key
1576: .Fl n )
1.119 nicm 1577: are marked with
1578: .Ql (no prefix) .
1.57 jmc 1579: .Pp
1580: With
1581: .Fl t ,
1582: the key bindings in
1583: .Ar key-table
1584: are listed; this may be one of:
1585: .Em vi-edit ,
1586: .Em emacs-edit ,
1587: .Em vi-choice ,
1588: .Em emacs-choice ,
1589: .Em vi-copy
1590: or
1591: .Em emacs-copy .
1592: .It Xo Ic send-keys
1.72 nicm 1593: .Op Fl t Ar target-pane
1.57 jmc 1594: .Ar key Ar ...
1.1 nicm 1595: .Xc
1.57 jmc 1596: .D1 (alias: Ic send )
1597: Send a key or keys to a window.
1598: Each argument
1599: .Ar key
1600: is the name of the key (such as
1601: .Ql C-a
1602: or
1603: .Ql npage
1604: ) to send; if the string is not recognised as a key, it is sent as a series of
1605: characters.
1606: All arguments are sent sequentially from first to last.
1.72 nicm 1607: .It Ic send-prefix Op Fl t Ar target-pane
1.57 jmc 1608: Send the prefix key to a window as if it was pressed.
1.89 nicm 1609: If multiple prefix keys are configured, only the first is sent.
1.57 jmc 1610: .It Xo Ic unbind-key
1.189 nicm 1611: .Op Fl acn
1.57 jmc 1612: .Op Fl t Ar key-table
1613: .Ar key
1.2 nicm 1614: .Xc
1.57 jmc 1615: .D1 (alias: Ic unbind )
1616: Unbind the command bound to
1617: .Ar key .
1618: Without
1619: .Fl t
1620: the primary key bindings are modified; in this case, if
1621: .Fl n
1622: is specified, the command bound to
1623: .Ar key
1624: without a prefix (if any) is removed.
1.189 nicm 1625: If
1626: .Fl a
1627: is present, all key bindings are removed.
1.57 jmc 1628: .Pp
1.47 nicm 1629: If
1.57 jmc 1630: .Fl t
1631: is present,
1632: .Ar key
1633: in
1634: .Ar key-table
1635: is unbound: the binding for command mode with
1636: .Fl c
1637: or for normal mode without.
1638: .El
1639: .Sh OPTIONS
1640: The appearance and behaviour of
1641: .Nm
1642: may be modified by changing the value of various options.
1.133 nicm 1643: There are three types of option:
1644: .Em server options ,
1.57 jmc 1645: .Em session options
1646: and
1647: .Em window options .
1648: .Pp
1.133 nicm 1649: The
1650: .Nm
1651: server has a set of global options which do not apply to any particular
1652: window or session.
1653: These are altered with the
1654: .Ic set-option
1655: .Fl s
1656: command, or displayed with the
1657: .Ic show-options
1658: .Fl s
1659: command.
1660: .Pp
1661: In addition, each individual session may have a set of session options, and
1662: there is a separate set of global session options.
1.57 jmc 1663: Sessions which do not have a particular option configured inherit the value
1664: from the global session options.
1665: Session options are set or unset with the
1666: .Ic set-option
1667: command and may be listed with the
1668: .Ic show-options
1669: command.
1.133 nicm 1670: The available server and session options are listed under the
1.57 jmc 1671: .Ic set-option
1672: command.
1673: .Pp
1674: Similarly, a set of window options is attached to each window, and there is
1675: a set of global window options from which any unset options are inherited.
1676: Window options are altered with the
1677: .Ic set-window-option
1678: command and can be listed with the
1679: .Ic show-window-options
1680: command.
1681: All window options are documented with the
1682: .Ic set-window-option
1683: command.
1684: .Pp
1685: Commands which set options are as follows:
1686: .Bl -tag -width Ds
1.1 nicm 1687: .It Xo Ic set-option
1.133 nicm 1688: .Op Fl agsuw
1.129 nicm 1689: .Op Fl t Ar target-session | Ar target-window
1.1 nicm 1690: .Ar option Ar value
1691: .Xc
1692: .D1 (alias: Ic set )
1.133 nicm 1693: Set a window option with
1694: .Fl w
1695: (equivalent to the
1696: .Ic set-window-option
1697: command),
1698: a server option with
1699: .Fl s ,
1700: otherwise a session option.
1701: .Pp
1702: If
1703: .Fl g
1704: is specified, the global session or window option is set.
1.58 nicm 1705: With
1706: .Fl a ,
1707: and if the option expects a string,
1708: .Ar value
1709: is appended to the existing setting.
1.1 nicm 1710: The
1711: .Fl u
1712: flag unsets an option, so a session inherits the option from the global
1.133 nicm 1713: options.
1714: It is not possible to unset a global option.
1.1 nicm 1715: .Pp
1.133 nicm 1716: Available window options are listed under
1717: .Ic set-window-option .
1718: .Pp
1719: Available server options are:
1720: .Bl -tag -width Ds
1.198 nicm 1721: .It Ic buffer-limit Ar number
1722: Set the number of buffers; as new buffers are added to the top of the stack,
1723: old ones are removed from the bottom if necessary to maintain this maximum
1724: length.
1.228 nicm 1725: .It Xo Ic set-clipboard
1726: .Op Ic on | off
1727: .Xc
1728: Attempt to set the terminal clipboard content using the
1729: \ee]52;...\e007
1730: .Xr xterm 1
1731: escape sequences.
1732: This option is on by default if there is an
1733: .Em \&Ms
1734: entry in the
1735: .Xr terminfo 5
1736: description for the client terminal.
1737: Note that this feature needs to be enabled in
1738: .Xr xterm 1
1739: by setting the resource:
1740: .Bd -literal -offset indent
1741: disallowedWindowOps: 20,21,SetXprop
1742: .Ed
1743: .Pp
1744: Or changing this property from the
1745: .Xr xterm 1
1746: interactive menu when required.
1.206 nicm 1747: .It Ic escape-time Ar time
1.134 nicm 1748: Set the time in milliseconds for which
1749: .Nm
1750: waits after an escape is input to determine if it is part of a function or meta
1751: key sequences.
1752: The default is 500 milliseconds.
1.206 nicm 1753: .It Xo Ic exit-unattached
1754: .Op Ic on | off
1755: .Xc
1.207 nicm 1756: If enabled, the server will exit when there are no attached clients.
1.206 nicm 1757: .It Xo Ic quiet
1758: .Op Ic on | off
1759: .Xc
1.134 nicm 1760: Enable or disable the display of various informational messages (see also the
1.133 nicm 1761: .Fl q
1762: command line flag).
1763: .El
1.129 nicm 1764: .Pp
1.18 nicm 1765: Available session options are:
1.1 nicm 1766: .Bl -tag -width Ds
1.69 nicm 1767: .It Ic base-index Ar index
1768: Set the base index from which an unused index should be searched when a new
1769: window is created.
1770: The default is zero.
1.1 nicm 1771: .It Xo Ic bell-action
1.56 jmc 1772: .Op Ic any | none | current
1.1 nicm 1773: .Xc
1774: Set action on window bell.
1775: .Ic any
1776: means a bell in any window linked to a session causes a bell in the current
1777: window of that session,
1778: .Ic none
1779: means all bells are ignored and
1780: .Ic current
1781: means only bell in windows other than the current window are ignored.
1.153 nicm 1782: .It Ic default-command Ar shell-command
1.1 nicm 1783: Set the command used for new windows (if not specified when the window is
1784: created) to
1.153 nicm 1785: .Ar shell-command ,
1.79 nicm 1786: which may be any
1787: .Xr sh 1
1788: command.
1.19 nicm 1789: The default is an empty string, which instructs
1790: .Nm
1.79 nicm 1791: to create a login shell using the value of the
1792: .Ic default-shell
1793: option.
1.196 nicm 1794: .It Ic default-path Ar path
1795: Set the default working directory for processes created from keys, or
1796: interactively from the prompt.
1797: The default is empty, which means to use the working directory of the shell
1798: from which the server was started if it is available or the user's home if not.
1.79 nicm 1799: .It Ic default-shell Ar path
1800: Specify the default shell.
1801: This is used as the login shell for new windows when the
1802: .Ic default-command
1803: option is set to empty, and must be the full path of the executable.
1804: When started
1805: .Nm
1806: tries to set a default value from the first suitable of the
1.19 nicm 1807: .Ev SHELL
1.79 nicm 1808: environment variable, the shell returned by
1809: .Xr getpwuid 3 ,
1810: or
1811: .Pa /bin/sh .
1812: This option should be configured when
1813: .Nm
1814: is used as a login shell.
1.22 nicm 1815: .It Ic default-terminal Ar terminal
1816: Set the default terminal for new windows created in this session - the
1817: default value of the
1818: .Ev TERM
1819: environment variable.
1820: For
1821: .Nm
1822: to work correctly, this
1823: .Em must
1824: be set to
1825: .Ql screen
1826: or a derivative of it.
1.206 nicm 1827: .It Xo Ic destroy-unattached
1828: .Op Ic on | off
1829: .Xc
1.185 nicm 1830: If enabled and the session is no longer attached to any clients, it is
1831: destroyed.
1.206 nicm 1832: .It Xo Ic detach-on-destroy
1833: .Op Ic on | off
1834: .Xc
1.184 nicm 1835: If on (the default), the client is detached when the session it is attached to
1836: is destroyed.
1837: If off, the client is switched to the most recently active of the remaining
1838: sessions.
1.145 nicm 1839: .It Ic display-panes-active-colour Ar colour
1840: Set the colour used by the
1841: .Ic display-panes
1842: command to show the indicator for the active pane.
1.78 nicm 1843: .It Ic display-panes-colour Ar colour
1.145 nicm 1844: Set the colour used by the
1.78 nicm 1845: .Ic display-panes
1.145 nicm 1846: command to show the indicators for inactive panes.
1.78 nicm 1847: .It Ic display-panes-time Ar time
1848: Set the time in milliseconds for which the indicators shown by the
1849: .Ic display-panes
1850: command appear.
1.21 nicm 1851: .It Ic display-time Ar time
1.78 nicm 1852: Set the amount of time for which status line messages and other on-screen
1853: indicators are displayed.
1.21 nicm 1854: .Ar time
1855: is in milliseconds.
1.1 nicm 1856: .It Ic history-limit Ar lines
1857: Set the maximum number of lines held in window history.
1858: This setting applies only to new windows - existing window histories are not
1859: resized and retain the limit at the point they were created.
1860: .It Ic lock-after-time Ar number
1.100 nicm 1861: Lock the session (like the
1862: .Ic lock-session
1.90 nicm 1863: command) after
1.1 nicm 1864: .Ar number
1.100 nicm 1865: seconds of inactivity, or the entire server (all sessions) if the
1866: .Ic lock-server
1867: option is set.
1868: The default is not to lock (set to 0).
1.153 nicm 1869: .It Ic lock-command Ar shell-command
1.90 nicm 1870: Command to run when locking each client.
1871: The default is to run
1872: .Xr lock 1
1873: with
1874: .Fl np .
1.100 nicm 1875: .It Xo Ic lock-server
1876: .Op Ic on | off
1877: .Xc
1878: If this option is
1.102 nicm 1879: .Ic on
1.100 nicm 1880: (the default),
1881: instead of each session locking individually as each has been
1882: idle for
1.108 jmc 1883: .Ic lock-after-time ,
1884: the entire server will lock after
1.100 nicm 1885: .Em all
1886: sessions would have locked.
1887: This has no effect as a session option; it must be set as a global option.
1.1 nicm 1888: .It Ic message-attr Ar attributes
1889: Set status line message attributes, where
1890: .Ar attributes
1891: is either
1.168 nicm 1892: .Ic none
1.1 nicm 1893: or a comma-delimited list of one or more of:
1894: .Ic bright
1895: (or
1896: .Ic bold ) ,
1897: .Ic dim ,
1898: .Ic underscore ,
1899: .Ic blink ,
1900: .Ic reverse ,
1901: .Ic hidden ,
1902: or
1903: .Ic italics .
1904: .It Ic message-bg Ar colour
1905: Set status line message background colour, where
1906: .Ar colour
1907: is one of:
1908: .Ic black ,
1909: .Ic red ,
1910: .Ic green ,
1911: .Ic yellow ,
1912: .Ic blue ,
1913: .Ic magenta ,
1914: .Ic cyan ,
1.85 nicm 1915: .Ic white ,
1916: .Ic colour0
1917: to
1918: .Ic colour255
1.205 nicm 1919: from the 256-colour set,
1920: .Ic default ,
1921: or a hexadecimal RGB string such as
1922: .Ql #ffffff ,
1923: which chooses the closest match from the default 256-colour set.
1.1 nicm 1924: .It Ic message-fg Ar colour
1925: Set status line message foreground colour.
1.120 nicm 1926: .It Ic message-limit Ar number
1927: Set the number of error or information messages to save in the message log for
1928: each client.
1929: The default is 20.
1.226 nicm 1930: .It Xo Ic mouse-resize-pane
1931: .Op Ic on | off
1932: .Xc
1933: If on,
1934: .Nm
1935: captures the mouse and allows panes to be resized by dragging on their borders.
1.102 nicm 1936: .It Xo Ic mouse-select-pane
1937: .Op Ic on | off
1938: .Xc
1939: If on,
1940: .Nm
1941: captures the mouse and when a window is split into multiple panes the mouse may
1942: be used to select the current pane.
1943: The mouse click is also passed through to the application as normal.
1.222 nicm 1944: .It Xo Ic mouse-select-window
1945: .Op Ic on | off
1946: .Xc
1947: If on, clicking the mouse on a window name in the status line will select that
1948: window.
1.196 nicm 1949: .It Ic pane-active-border-bg Ar colour
1950: .It Ic pane-active-border-fg Ar colour
1951: Set the pane border colour for the currently active pane.
1952: .It Ic pane-border-bg Ar colour
1.135 nicm 1953: .It Ic pane-border-fg Ar colour
1954: Set the pane border colour for panes aside from the active pane.
1.89 nicm 1955: .It Ic prefix Ar keys
1956: Set the keys accepted as a prefix key.
1957: .Ar keys
1958: is a comma-separated list of key names, each of which individually behave as
1959: the prefix key.
1.21 nicm 1960: .It Ic repeat-time Ar time
1.1 nicm 1961: Allow multiple commands to be entered without pressing the prefix-key again
1962: in the specified
1.21 nicm 1963: .Ar time
1.1 nicm 1964: milliseconds (the default is 500).
1965: Whether a key repeats may be set when it is bound using the
1966: .Fl r
1967: flag to
1968: .Ic bind-key .
1.52 nicm 1969: Repeat is enabled for the default keys bound to the
1970: .Ic resize-pane
1971: command.
1.203 nicm 1972: .It Xo Ic mouse-utf8
1973: .Op Ic on | off
1974: .Xc
1975: If enabled, request mouse input as UTF-8 on UTF-8 terminals.
1.1 nicm 1976: .It Xo Ic set-remain-on-exit
1.56 jmc 1977: .Op Ic on | off
1.1 nicm 1978: .Xc
1979: Set the
1980: .Ic remain-on-exit
1981: window option for any windows first created in this session.
1.153 nicm 1982: When this option is true, windows in which the running program has
1983: exited do not close, instead remaining open but inactivate.
1984: Use the
1985: .Ic respawn-window
1986: command to reactivate such a window, or the
1987: .Ic kill-window
1988: command to destroy it.
1.1 nicm 1989: .It Xo Ic set-titles
1.56 jmc 1990: .Op Ic on | off
1.1 nicm 1991: .Xc
1.77 stsp 1992: Attempt to set the window title using the \ee]2;...\e007 xterm code if
1.1 nicm 1993: the terminal appears to be an xterm.
1.11 nicm 1994: This option is off by default.
1.6 jmc 1995: Note that elinks
1.1 nicm 1996: will only attempt to set the window title if the STY environment
1997: variable is set.
1.86 nicm 1998: .It Ic set-titles-string Ar string
1999: String used to set the window title if
2000: .Ic set-titles
2001: is on.
2002: Character sequences are replaced as for the
2003: .Ic status-left
2004: option.
1.1 nicm 2005: .It Xo Ic status
1.56 jmc 2006: .Op Ic on | off
1.1 nicm 2007: .Xc
2008: Show or hide the status line.
2009: .It Ic status-attr Ar attributes
2010: Set status line attributes.
2011: .It Ic status-bg Ar colour
2012: Set status line background colour.
2013: .It Ic status-fg Ar colour
2014: Set status line foreground colour.
2015: .It Ic status-interval Ar interval
2016: Update the status bar every
2017: .Ar interval
2018: seconds.
2019: By default, updates will occur every 15 seconds.
2020: A setting of zero disables redrawing at interval.
1.41 nicm 2021: .It Xo Ic status-justify
1.56 jmc 2022: .Op Ic left | centre | right
1.41 nicm 2023: .Xc
2024: Set the position of the window list component of the status line: left, centre
2025: or right justified.
1.1 nicm 2026: .It Xo Ic status-keys
1.56 jmc 2027: .Op Ic vi | emacs
1.1 nicm 2028: .Xc
1.6 jmc 2029: Use vi or emacs-style
1.1 nicm 2030: key bindings in the status line, for example at the command prompt.
1.191 nicm 2031: The default is emacs, unless the
2032: .Ev VISUAL
2033: or
2034: .Ev EDITOR
2035: environment variables are set and contain the string
2036: .Ql vi .
1.1 nicm 2037: .It Ic status-left Ar string
2038: Display
2039: .Ar string
2040: to the left of the status bar.
2041: .Ar string
2042: will be passed through
2043: .Xr strftime 3
2044: before being used.
2045: By default, the session name is shown.
2046: .Ar string
1.83 nicm 2047: may contain any of the following special character sequences:
1.1 nicm 2048: .Bl -column "Character pair" "Replaced with" -offset indent
2049: .It Sy "Character pair" Ta Sy "Replaced with"
1.153 nicm 2050: .It Li "#(shell-command)" Ta "First line of the command's output"
1.83 nicm 2051: .It Li "#[attributes]" Ta "Colour or attribute change"
1.1 nicm 2052: .It Li "#H" Ta "Hostname of local host"
1.224 nicm 2053: .It Li "#h" Ta "Hostname of local host without the domain name"
1.125 nicm 2054: .It Li "#F" Ta "Current window flag"
1.35 nicm 2055: .It Li "#I" Ta "Current window index"
2056: .It Li "#P" Ta "Current pane index"
1.1 nicm 2057: .It Li "#S" Ta "Session name"
2058: .It Li "#T" Ta "Current window title"
1.35 nicm 2059: .It Li "#W" Ta "Current window name"
1.1 nicm 2060: .It Li "##" Ta "A literal" Ql #
2061: .El
1.83 nicm 2062: .Pp
1.153 nicm 2063: The #(shell-command) form executes
2064: .Ql shell-command
2065: and inserts the first line of its output.
1.103 nicm 2066: Note that shell commands are only executed once at the interval specified by
2067: the
2068: .Ic status-interval
2069: option: if the status line is redrawn in the meantime, the previous result is
2070: used.
1.161 nicm 2071: Shell commands are executed with the
2072: .Nm
2073: global environment set (see the
1.162 jmc 2074: .Sx ENVIRONMENT
2075: section).
1.163 nicm 2076: .Pp
2077: The window title (#T) is the title set by the program running within the window
2078: using the OSC title setting sequence, for example:
2079: .Bd -literal -offset indent
2080: $ printf '\e033]2;My Title\e033\e\e'
2081: .Ed
2082: .Pp
2083: When a window is first created, its title is the hostname.
1.109 nicm 2084: .Pp
1.83 nicm 2085: #[attributes] allows a comma-separated list of attributes to be specified,
2086: these may be
2087: .Ql fg=colour
2088: to set the foreground colour,
2089: .Ql bg=colour
1.131 nicm 2090: to set the background colour, the name of one of the attributes (listed under
2091: the
1.83 nicm 2092: .Ic message-attr
1.109 nicm 2093: option) to turn an attribute on, or an attribute prefixed with
2094: .Ql no
2095: to turn one off, for example
2096: .Ic nobright .
1.83 nicm 2097: Examples are:
2098: .Bd -literal -offset indent
2099: #(sysctl vm.loadavg)
2100: #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
2101: .Ed
1.1 nicm 2102: .Pp
1.109 nicm 2103: Where appropriate, special character sequences may be prefixed with a number to
2104: specify the maximum length, for example
1.1 nicm 2105: .Ql #24T .
1.10 nicm 2106: .Pp
1.12 jmc 2107: By default, UTF-8 in
1.10 nicm 2108: .Ar string
2109: is not interpreted, to enable UTF-8, use the
2110: .Ic status-utf8
2111: option.
1.62 nicm 2112: .It Ic status-left-attr Ar attributes
1.66 jmc 2113: Set the attribute of the left part of the status line.
1.196 nicm 2114: .It Ic status-left-bg Ar colour
2115: Set the background colour of the left part of the status line.
1.62 nicm 2116: .It Ic status-left-fg Ar colour
2117: Set the foreground colour of the left part of the status line.
1.1 nicm 2118: .It Ic status-left-length Ar length
2119: Set the maximum
2120: .Ar length
2121: of the left component of the status bar.
2122: The default is 10.
2123: .It Ic status-right Ar string
2124: Display
2125: .Ar string
2126: to the right of the status bar.
1.151 nicm 2127: By default, the current window title in double quotes, the date and the time
2128: are shown.
1.1 nicm 2129: As with
2130: .Ic status-left ,
2131: .Ar string
2132: will be passed to
1.10 nicm 2133: .Xr strftime 3 ,
2134: character pairs are replaced, and UTF-8 is dependent on the
2135: .Ic status-utf8
2136: option.
1.62 nicm 2137: .It Ic status-right-attr Ar attributes
1.66 jmc 2138: Set the attribute of the right part of the status line.
1.196 nicm 2139: .It Ic status-right-bg Ar colour
2140: Set the background colour of the right part of the status line.
1.62 nicm 2141: .It Ic status-right-fg Ar colour
2142: Set the foreground colour of the right part of the status line.
1.1 nicm 2143: .It Ic status-right-length Ar length
2144: Set the maximum
2145: .Ar length
2146: of the right component of the status bar.
2147: The default is 40.
1.10 nicm 2148: .It Xo Ic status-utf8
1.56 jmc 2149: .Op Ic on | off
1.10 nicm 2150: .Xc
2151: Instruct
2152: .Nm
2153: to treat top-bit-set characters in the
2154: .Ic status-left
2155: and
2156: .Ic status-right
2157: strings as UTF-8; notably, this is important for wide characters.
2158: This option defaults to off.
1.55 jmc 2159: .It Ic terminal-overrides Ar string
1.54 nicm 2160: Contains a list of entries which override terminal descriptions read using
2161: .Xr terminfo 5 .
2162: .Ar string
2163: is a comma-separated list of items each a colon-separated string made up of a
2164: terminal type pattern (matched using
2165: .Xr fnmatch 3 )
2166: and a set of
2167: .Em name=value
2168: entries.
2169: .Pp
2170: For example, to set the
2171: .Ql clear
2172: .Xr terminfo 5
2173: entry to
2174: .Ql \ee[H\ee[2J
2175: for all terminal types and the
2176: .Ql dch1
2177: entry to
2178: .Ql \ee[P
1.55 jmc 2179: for the
1.54 nicm 2180: .Ql rxvt
2181: terminal type, the option could be set to the string:
2182: .Bd -literal -offset indent
2183: "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
2184: .Ed
2185: .Pp
2186: The terminal entry value is passed through
2187: .Xr strunvis 3
2188: before interpretation.
2189: The default value forcibly corrects the
2190: .Ql colors
2191: entry for terminals which support 88 or 256 colours:
2192: .Bd -literal -offset indent
1.225 nicm 2193: "*88col*:colors=88,*256col*:colors=256,xterm*:XT"
1.54 nicm 2194: .Ed
1.63 nicm 2195: .It Ic update-environment Ar variables
2196: Set a space-separated string containing a list of environment variables to be
2197: copied into the session environment when a new session is created or an
2198: existing session is attached.
2199: Any variables that do not exist in the source environment are set to be
2200: removed from the session environment (as if
2201: .Fl r
2202: was given to the
2203: .Ic set-environment
2204: command).
2205: The default is
1.190 nicm 2206: "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
2207: XAUTHORITY".
1.37 nicm 2208: .It Xo Ic visual-activity
1.56 jmc 2209: .Op Ic on | off
1.37 nicm 2210: .Xc
2211: If on, display a status line message when activity occurs in a window
1.39 jmc 2212: for which the
1.37 nicm 2213: .Ic monitor-activity
2214: window option is enabled.
2215: .It Xo Ic visual-bell
1.56 jmc 2216: .Op Ic on | off
1.37 nicm 2217: .Xc
2218: If this option is on, a message is shown on a bell instead of it being passed
2219: through to the terminal (which normally makes a sound).
2220: Also see the
2221: .Ic bell-action
2222: option.
2223: .It Xo Ic visual-content
1.56 jmc 2224: .Op Ic on | off
1.37 nicm 2225: .Xc
2226: Like
2227: .Ic visual-activity ,
2228: display a message when content is present in a window
1.39 jmc 2229: for which the
1.37 nicm 2230: .Ic monitor-content
2231: window option is enabled.
1.192 nicm 2232: .It Xo Ic visual-silence
2233: .Op Ic on | off
2234: .Xc
2235: If
2236: .Ic monitor-silence
2237: is enabled, prints a message after the interval has expired on a given window.
1.1 nicm 2238: .El
2239: .It Xo Ic set-window-option
1.58 nicm 2240: .Op Fl agu
1.1 nicm 2241: .Op Fl t Ar target-window
2242: .Ar option Ar value
2243: .Xc
2244: .D1 (alias: Ic setw )
1.18 nicm 2245: Set a window option.
1.1 nicm 2246: The
1.58 nicm 2247: .Fl a ,
1.1 nicm 2248: .Fl g
2249: and
2250: .Fl u
2251: flags work similarly to the
2252: .Ic set-option
2253: command.
2254: .Pp
1.18 nicm 2255: Supported window options are:
1.56 jmc 2256: .Pp
2257: .Bl -tag -width Ds -compact
1.1 nicm 2258: .It Xo Ic aggressive-resize
1.56 jmc 2259: .Op Ic on | off
1.1 nicm 2260: .Xc
2261: Aggressively resize the chosen window.
2262: This means that
2263: .Nm
2264: will resize the window to the size of the smallest session for which it is the
2265: current window, rather than the smallest session to which it is attached.
2266: The window may resize when the current window is changed on another sessions;
1.6 jmc 2267: this option is good for full-screen programs which support
2268: .Dv SIGWINCH
2269: and poor for interactive programs such as shells.
1.56 jmc 2270: .Pp
1.196 nicm 2271: .It Xo Ic alternate-screen
2272: .Op Ic on | off
2273: .Xc
2274: This option configures whether programs running inside
2275: .Nm
2276: may use the terminal alternate screen feature, which allows the
2277: .Em smcup
2278: and
2279: .Em rmcup
2280: .Xr terminfo 5
1.209 nicm 2281: capabilities.
2282: The alternate screen feature preserves the contents of the window when an
2283: interactive application starts and restores it on exit, so that any output
2284: visible before the application starts reappears unchanged after it exits.
2285: The default is on.
1.196 nicm 2286: .Pp
1.1 nicm 2287: .It Xo Ic automatic-rename
1.56 jmc 2288: .Op Ic on | off
1.1 nicm 2289: .Xc
2290: Control automatic window renaming.
2291: When this setting is enabled,
2292: .Nm
2293: will attempt - on supported platforms - to rename the window to reflect the
2294: command currently running in it.
2295: This flag is automatically disabled for an individual window when a name
2296: is specified at creation with
1.186 nicm 2297: .Ic new-window
2298: or
1.1 nicm 2299: .Ic new-session ,
2300: or later with
2301: .Ic rename-window .
2302: It may be switched off globally with:
2303: .Bd -literal -offset indent
2304: set-window-option -g automatic-rename off
2305: .Ed
1.56 jmc 2306: .Pp
1.1 nicm 2307: .It Ic clock-mode-colour Ar colour
2308: Set clock colour.
1.56 jmc 2309: .Pp
1.1 nicm 2310: .It Xo Ic clock-mode-style
1.56 jmc 2311: .Op Ic 12 | 24
1.1 nicm 2312: .Xc
2313: Set clock hour format.
1.56 jmc 2314: .Pp
1.1 nicm 2315: .It Ic force-height Ar height
2316: .It Ic force-width Ar width
2317: Prevent
2318: .Nm
2319: from resizing a window to greater than
2320: .Ar width
2321: or
2322: .Ar height .
2323: A value of zero restores the default unlimited setting.
1.56 jmc 2324: .Pp
1.196 nicm 2325: .It Ic main-pane-height Ar height
1.2 nicm 2326: .It Ic main-pane-width Ar width
2327: Set the width or height of the main (left or top) pane in the
2328: .Ic main-horizontal
2329: or
2330: .Ic main-vertical
2331: layouts.
1.56 jmc 2332: .Pp
1.1 nicm 2333: .It Ic mode-attr Ar attributes
2334: Set window modes attributes.
1.56 jmc 2335: .Pp
1.1 nicm 2336: .It Ic mode-bg Ar colour
2337: Set window modes background colour.
1.56 jmc 2338: .Pp
1.1 nicm 2339: .It Ic mode-fg Ar colour
2340: Set window modes foreground colour.
1.56 jmc 2341: .Pp
1.1 nicm 2342: .It Xo Ic mode-keys
1.56 jmc 2343: .Op Ic vi | emacs
1.1 nicm 2344: .Xc
1.105 nicm 2345: Use vi or emacs-style key bindings in copy and choice modes.
1.191 nicm 2346: As with the
2347: .Ic status-keys
2348: option, the default is emacs, unless
2349: .Ev VISUAL
2350: or
2351: .Ev EDITOR
2352: contains
2353: .Ql vi .
1.56 jmc 2354: .Pp
1.50 nicm 2355: .It Xo Ic mode-mouse
1.56 jmc 2356: .Op Ic on | off
1.50 nicm 2357: .Xc
1.51 jmc 2358: Mouse state in modes.
1.223 nicm 2359: If on, the mouse may be used to enter copy mode and copy a selection by
2360: dragging, to enter copy mode and scroll with the mouse wheel, or to select an
2361: option in choice mode.
1.56 jmc 2362: .Pp
1.1 nicm 2363: .It Xo Ic monitor-activity
1.56 jmc 2364: .Op Ic on | off
1.1 nicm 2365: .Xc
2366: Monitor for activity in the window.
2367: Windows with activity are highlighted in the status line.
1.56 jmc 2368: .Pp
2369: .It Ic monitor-content Ar match-string
1.6 jmc 2370: Monitor content in the window.
2371: When
1.16 nicm 2372: .Xr fnmatch 3
2373: pattern
1.1 nicm 2374: .Ar match-string
2375: appears in the window, it is highlighted in the status line.
1.56 jmc 2376: .Pp
1.192 nicm 2377: .It Xo Ic monitor-silence
2378: .Op Ic interval
2379: .Xc
2380: Monitor for silence (no activity) in the window within
2381: .Ic interval
2382: seconds.
2383: Windows that have been silent for the interval are highlighted in the
2384: status line.
2385: An interval of zero disables the monitoring.
1.195 nicm 2386: .Pp
2387: .It Ic other-pane-height Ar height
2388: Set the height of the other panes (not the main pane) in the
2389: .Ic main-horizontal
2390: layout.
2391: If this option is set to 0 (the default), it will have no effect.
2392: If both the
2393: .Ic main-pane-height
2394: and
2395: .Ic other-pane-height
2396: options are set, the main pane will grow taller to make the other panes the
2397: specified height, but will never shrink to do so.
2398: .Pp
2399: .It Ic other-pane-width Ar width
2400: Like
2401: .Ic other-pane-height ,
2402: but set the width of other panes in the
2403: .Ic main-vertical
2404: layout.
1.192 nicm 2405: .Pp
1.1 nicm 2406: .It Xo Ic remain-on-exit
1.56 jmc 2407: .Op Ic on | off
1.1 nicm 2408: .Xc
2409: A window with this flag set is not destroyed when the program running in it
2410: exits.
2411: The window may be reactivated with the
2412: .Ic respawn-window
2413: command.
1.56 jmc 2414: .Pp
1.99 nicm 2415: .It Xo Ic synchronize-panes
2416: .Op Ic on | off
2417: .Xc
1.164 nicm 2418: Duplicate input to any pane to all other panes in the same window (only
2419: for panes that are not in any special mode).
1.139 nicm 2420: .Pp
1.1 nicm 2421: .It Xo Ic utf8
1.56 jmc 2422: .Op Ic on | off
1.1 nicm 2423: .Xc
2424: Instructs
2425: .Nm
2426: to expect UTF-8 sequences to appear in this window.
1.56 jmc 2427: .Pp
1.1 nicm 2428: .It Ic window-status-attr Ar attributes
2429: Set status line attributes for a single window.
1.56 jmc 2430: .Pp
1.1 nicm 2431: .It Ic window-status-bg Ar colour
2432: Set status line background colour for a single window.
1.56 jmc 2433: .Pp
1.1 nicm 2434: .It Ic window-status-fg Ar colour
2435: Set status line foreground colour for a single window.
1.56 jmc 2436: .Pp
1.125 nicm 2437: .It Ic window-status-format Ar string
2438: Set the format in which the window is displayed in the status line window list.
2439: See the
2440: .Ar status-left
2441: option for details of special character sequences available.
2442: The default is
2443: .Ql #I:#W#F .
1.169 nicm 2444: .Pp
2445: .It Ic window-status-alert-attr Ar attributes
2446: Set status line attributes for windows which have an alert (bell, activity
2447: or content).
2448: .Pp
2449: .It Ic window-status-alert-bg Ar colour
2450: Set status line background colour for windows with an alert.
2451: .Pp
2452: .It Ic window-status-alert-fg Ar colour
2453: Set status line foreground colour for windows with an alert.
1.125 nicm 2454: .Pp
1.40 nicm 2455: .It Ic window-status-current-attr Ar attributes
2456: Set status line attributes for the currently active window.
1.56 jmc 2457: .Pp
1.40 nicm 2458: .It Ic window-status-current-bg Ar colour
2459: Set status line background colour for the currently active window.
1.56 jmc 2460: .Pp
1.40 nicm 2461: .It Ic window-status-current-fg Ar colour
2462: Set status line foreground colour for the currently active window.
1.56 jmc 2463: .Pp
1.125 nicm 2464: .It Ic window-status-current-format Ar string
2465: Like
2466: .Ar window-status-format ,
2467: but is the format used when the window is the current window.
1.154 nicm 2468: .Pp
2469: .It Ic word-separators Ar string
2470: Sets the window's conception of what characters are considered word
2471: separators, for the purposes of the next and previous word commands in
2472: copy mode.
2473: The default is
2474: .Ql \ -_@ .
1.125 nicm 2475: .Pp
1.1 nicm 2476: .It Xo Ic xterm-keys
1.56 jmc 2477: .Op Ic on | off
1.1 nicm 2478: .Xc
2479: If this option is set,
2480: .Nm
2481: will generate
1.57 jmc 2482: .Xr xterm 1 -style
2483: function key sequences; these have a number included to indicate modifiers such
2484: as Shift, Alt or Ctrl.
1.123 nicm 2485: The default is off.
1.57 jmc 2486: .El
2487: .It Xo Ic show-options
1.133 nicm 2488: .Op Fl gsw
1.129 nicm 2489: .Op Fl t Ar target-session | Ar target-window
1.57 jmc 2490: .Xc
2491: .D1 (alias: Ic show )
1.133 nicm 2492: Show the window options with
1.129 nicm 2493: .Fl w
1.133 nicm 2494: (equivalent to
1.134 nicm 2495: .Ic show-window-options ) ,
1.133 nicm 2496: the server options with
2497: .Fl s ,
2498: otherwise the session options for
2499: .Ar target session .
2500: Global session or window options are listed if
2501: .Fl g
2502: is used.
1.57 jmc 2503: .It Xo Ic show-window-options
2504: .Op Fl g
2505: .Op Fl t Ar target-window
2506: .Xc
2507: .D1 (alias: Ic showw )
2508: List the window options for
2509: .Ar target-window ,
2510: or the global window options if
2511: .Fl g
2512: is used.
1.63 nicm 2513: .El
2514: .Sh ENVIRONMENT
2515: When the server is started,
2516: .Nm
2517: copies the environment into the
2518: .Em global environment ;
2519: in addition, each session has a
2520: .Em session environment .
1.193 nicm 2521: When a window is created, the session and global environments are merged.
2522: If a variable exists in both, the value from the session environment is used.
2523: The result is the initial environment passed to the new process.
1.63 nicm 2524: .Pp
2525: The
2526: .Ic update-environment
2527: session option may be used to update the session environment from the client
2528: when a new session is created or an old reattached.
2529: .Nm
2530: also initialises the
2531: .Ev TMUX
2532: variable with some internal information to allow commands to be executed
2533: from inside, and the
2534: .Ev TERM
2535: variable with the correct terminal setting of
2536: .Ql screen .
2537: .Pp
2538: Commands to alter and view the environment are:
2539: .Bl -tag -width Ds
2540: .It Xo Ic set-environment
2541: .Op Fl gru
2542: .Op Fl t Ar target-session
2543: .Ar name Op Ar value
2544: .Xc
1.115 nicm 2545: .D1 (alias: Ic setenv )
1.63 nicm 2546: Set or unset an environment variable.
2547: If
2548: .Fl g
2549: is used, the change is made in the global environment; otherwise, it is applied
2550: to the session environment for
2551: .Ar target-session .
2552: The
2553: .Fl u
2554: flag unsets a variable.
2555: .Fl r
2556: indicates the variable is to be removed from the environment before starting a
2557: new process.
2558: .It Xo Ic show-environment
2559: .Op Fl g
2560: .Op Fl t Ar target-session
2561: .Xc
1.115 nicm 2562: .D1 (alias: Ic showenv )
1.63 nicm 2563: Display the environment for
2564: .Ar target-session
2565: or the global environment with
2566: .Fl g .
2567: Variables removed from the environment are prefixed with
2568: .Ql - .
1.57 jmc 2569: .El
2570: .Sh STATUS LINE
2571: .Nm
2572: includes an optional status line which is displayed in the bottom line of each
2573: terminal.
2574: By default, the status line is enabled (it may be disabled with the
2575: .Ic status
2576: session option) and contains, from left-to-right: the name of the current
2577: session in square brackets; the window list; the current window title in double
2578: quotes; and the time and date.
2579: .Pp
2580: The status line is made of three parts: configurable left and right sections
2581: (which may contain dynamic content such as the time or output from a shell
2582: command, see the
2583: .Ic status-left ,
2584: .Ic status-left-length ,
2585: .Ic status-right ,
2586: and
2587: .Ic status-right-length
2588: options below), and a central window list.
1.125 nicm 2589: By default, the window list shows the index, name and (if any) flag of the
2590: windows present in the current session in ascending numerical order.
2591: It may be customised with the
2592: .Ar window-status-format
2593: and
2594: .Ar window-status-current-format
2595: options.
1.57 jmc 2596: The flag is one of the following symbols appended to the window name:
2597: .Bl -column "Symbol" "Meaning" -offset indent
2598: .It Sy "Symbol" Ta Sy "Meaning"
2599: .It Li "*" Ta "Denotes the current window."
2600: .It Li "-" Ta "Marks the last window (previously selected)."
2601: .It Li "#" Ta "Window is monitored and activity has been detected."
2602: .It Li "!" Ta "A bell has occurred in the window."
2603: .It Li "+" Ta "Window is monitored for content and it has appeared."
1.192 nicm 2604: .It Li "~" Ta "The window has been silent for the monitor-silence interval."
1.57 jmc 2605: .El
2606: .Pp
2607: The # symbol relates to the
2608: .Ic monitor-activity
2609: and + to the
2610: .Ic monitor-content
2611: window options.
2612: The window name is printed in inverted colours if an alert (bell, activity or
2613: content) is present.
2614: .Pp
1.131 nicm 2615: The colour and attributes of the status line may be configured, the entire
2616: status line using the
1.57 jmc 2617: .Ic status-attr ,
2618: .Ic status-fg
2619: and
2620: .Ic status-bg
2621: session options and individual windows using the
2622: .Ic window-status-attr ,
2623: .Ic window-status-fg
2624: and
2625: .Ic window-status-bg
2626: window options.
2627: .Pp
1.131 nicm 2628: The status line is automatically refreshed at interval if it has changed, the
2629: interval may be controlled with the
1.57 jmc 2630: .Ic status-interval
2631: session option.
2632: .Pp
2633: Commands related to the status line are as follows:
2634: .Bl -tag -width Ds
2635: .It Xo Ic command-prompt
1.235 nicm 2636: .Op Fl I Ar inputs
1.73 nicm 2637: .Op Fl p Ar prompts
1.57 jmc 2638: .Op Fl t Ar target-client
2639: .Op Ar template
2640: .Xc
2641: Open the command prompt in a client.
2642: This may be used from inside
2643: .Nm
2644: to execute commands interactively.
1.231 nicm 2645: .Pp
1.57 jmc 2646: If
2647: .Ar template
1.73 nicm 2648: is specified, it is used as the command.
1.235 nicm 2649: If present,
2650: .Fl I
2651: is a comma-separated list of the initial text for each prompt.
1.73 nicm 2652: If
2653: .Fl p
2654: is given,
2655: .Ar prompts
2656: is a comma-separated list of prompts which are displayed in order; otherwise
2657: a single prompt is displayed, constructed from
2658: .Ar template
2659: if it is present, or
2660: .Ql \&:
2661: if not.
1.235 nicm 2662: .Pp
2663: Both
2664: .Ar inputs
2665: and
1.231 nicm 2666: .Ar prompts
2667: may contain the special character sequences supported by the
2668: .Ic status-left
2669: option.
2670: .Pp
1.73 nicm 2671: Before the command is executed, the first occurrence of the string
2672: .Ql %%
1.74 jmc 2673: and all occurrences of
1.73 nicm 2674: .Ql %1
2675: are replaced by the response to the first prompt, the second
2676: .Ql %%
2677: and all
2678: .Ql %2
2679: are replaced with the response to the second prompt, and so on for further
1.74 jmc 2680: prompts.
2681: Up to nine prompt responses may be replaced
2682: .Po
2683: .Ql %1
1.73 nicm 2684: to
1.74 jmc 2685: .Ql %9
2686: .Pc .
1.57 jmc 2687: .It Xo Ic confirm-before
2688: .Op Fl t Ar target-client
2689: .Ar command
2690: .Xc
2691: .D1 (alias: Ic confirm )
2692: Ask for confirmation before executing
2693: .Ar command .
2694: This command works only from inside
2695: .Nm .
2696: .It Xo Ic display-message
1.127 nicm 2697: .Op Fl p
1.215 nicm 2698: .Op Fl c Ar target-client
2699: .Op Fl t Ar target-pane
1.57 jmc 2700: .Op Ar message
2701: .Xc
2702: .D1 (alias: Ic display )
1.127 nicm 2703: Display a message.
2704: If
2705: .Fl p
2706: is given, the output is printed to stdout, otherwise it is displayed in the
2707: .Ar target-client
2708: status line.
1.122 nicm 2709: The format of
1.124 jmc 2710: .Ar message
2711: is as for
1.122 nicm 2712: .Ic status-left ,
1.215 nicm 2713: with the exception that #() are not handled; information is taken from
2714: .Ar target-pane
2715: if
2716: .Fl t
2717: is given, otherwise the active pane for the session attached to
2718: .Ar target-client .
1.57 jmc 2719: .El
2720: .Sh BUFFERS
2721: .Nm
2722: maintains a stack of
1.199 nicm 2723: .Em paste buffers .
1.57 jmc 2724: Up to the value of the
2725: .Ic buffer-limit
2726: option are kept; when a new buffer is added, the buffer at the bottom of the
2727: stack is removed.
2728: Buffers may be added using
2729: .Ic copy-mode
2730: or the
2731: .Ic set-buffer
2732: command, and pasted into a window using the
2733: .Ic paste-buffer
2734: command.
2735: .Pp
2736: A configurable history buffer is also maintained for each window.
2737: By default, up to 2000 lines are kept; this can be altered with the
2738: .Ic history-limit
2739: option (see the
2740: .Ic set-option
2741: command above).
2742: .Pp
2743: The buffer commands are as follows:
2744: .Bl -tag -width Ds
1.178 nicm 2745: .It Xo
2746: .Ic choose-buffer
2747: .Op Fl t Ar target-window
2748: .Op Ar template
2749: .Xc
2750: Put a window into buffer choice mode, where a buffer may be chosen
2751: interactively from a list.
2752: After a buffer is selected,
2753: .Ql %%
2754: is replaced by the buffer index in
2755: .Ar template
2756: and the result executed as a command.
2757: If
2758: .Ar template
2759: is not given, "paste-buffer -b '%%'" is used.
2760: This command works only from inside
2761: .Nm .
1.57 jmc 2762: .It Ic clear-history Op Fl t Ar target-pane
2763: .D1 (alias: Ic clearhist )
2764: Remove and free the history for the specified pane.
1.198 nicm 2765: .It Ic delete-buffer Op Fl b Ar buffer-index
1.57 jmc 2766: .D1 (alias: Ic deleteb )
2767: Delete the buffer at
2768: .Ar buffer-index ,
2769: or the top buffer if not specified.
1.198 nicm 2770: .It Ic list-buffers
1.57 jmc 2771: .D1 (alias: Ic lsb )
1.198 nicm 2772: List the global buffers.
1.200 jmc 2773: .It Xo Ic load-buffer
1.57 jmc 2774: .Op Fl b Ar buffer-index
2775: .Ar path
2776: .Xc
2777: .D1 (alias: Ic loadb )
2778: Load the contents of the specified paste buffer from
2779: .Ar path .
2780: .It Xo Ic paste-buffer
2781: .Op Fl dr
2782: .Op Fl b Ar buffer-index
1.170 nicm 2783: .Op Fl s Ar separator
1.158 nicm 2784: .Op Fl t Ar target-pane
1.57 jmc 2785: .Xc
2786: .D1 (alias: Ic pasteb )
1.158 nicm 2787: Insert the contents of a paste buffer into the specified pane.
2788: If not specified, paste into the current one.
1.57 jmc 2789: With
2790: .Fl d ,
2791: also delete the paste buffer from the stack.
2792: When output, any linefeed (LF) characters in the paste buffer are replaced with
1.170 nicm 2793: a separator, by default carriage return (CR).
2794: A custom separator may be specified using the
2795: .Fl s
2796: flag.
2797: The
1.57 jmc 2798: .Fl r
1.170 nicm 2799: flag means to do no replacement (equivalent to a separator of LF).
1.57 jmc 2800: .It Xo Ic save-buffer
2801: .Op Fl a
2802: .Op Fl b Ar buffer-index
2803: .Ar path
2804: .Xc
2805: .D1 (alias: Ic saveb )
2806: Save the contents of the specified paste buffer to
2807: .Ar path .
2808: The
2809: .Fl a
2810: option appends to rather than overwriting the file.
2811: .It Xo Ic set-buffer
2812: .Op Fl b Ar buffer-index
2813: .Ar data
2814: .Xc
2815: .D1 (alias: Ic setb )
2816: Set the contents of the specified buffer to
2817: .Ar data .
1.1 nicm 2818: .It Xo Ic show-buffer
2819: .Op Fl b Ar buffer-index
2820: .Xc
2821: .D1 (alias: Ic showb )
2822: Display the contents of the specified buffer.
1.57 jmc 2823: .El
2824: .Sh MISCELLANEOUS
2825: Miscellaneous commands are as follows:
2826: .Bl -tag -width Ds
1.72 nicm 2827: .It Ic clock-mode Op Fl t Ar target-pane
1.57 jmc 2828: Display a large clock.
2829: .It Ic if-shell Ar shell-command command
2830: .D1 (alias: Ic if )
2831: Execute
2832: .Ar command
2833: if
2834: .Ar shell-command
2835: returns success.
2836: .It Ic lock-server
2837: .D1 (alias: Ic lock )
1.90 nicm 2838: Lock each client individually by running the command specified by the
2839: .Ic lock-command
2840: option.
1.153 nicm 2841: .It Ic run-shell Ar shell-command
1.87 nicm 2842: .D1 (alias: Ic run )
2843: Execute
1.153 nicm 2844: .Ar shell-command
1.106 nicm 2845: in the background without creating a window.
1.164 nicm 2846: After it finishes, any output to stdout is displayed in copy mode.
1.153 nicm 2847: If the command doesn't return success, the exit status is also displayed.
1.57 jmc 2848: .It Ic server-info
2849: .D1 (alias: Ic info )
2850: Show server information and terminal details.
1.228 nicm 2851: .El
2852: .Sh TERMINFO EXTENSIONS
2853: .Nm
2854: understands some extensions to
2855: .Xr terminfo 5 :
2856: .Bl -tag -width Ds
1.232 jmc 2857: .It Em Cc , Cr
1.233 nicm 2858: Set the cursor colour.
1.232 jmc 2859: The first takes a single string argument and is used to set the colour;
2860: the second takes no arguments and restores the default cursor colour.
2861: If set, a sequence such as this may be used
2862: to change the cursor colour from inside
2863: .Nm :
2864: .Bd -literal -offset indent
2865: $ printf '\e033]12;red\e033\e\e'
2866: .Ed
2867: .It Em Cs , Csr
1.230 nicm 2868: Change the cursor style.
1.232 jmc 2869: If set, a sequence such as this may be used
2870: to change the cursor to an underline:
1.230 nicm 2871: .Bd -literal -offset indent
2872: $ printf '\e033[4 q'
2873: .Ed
2874: .Pp
2875: If
2876: .Em Csr
2877: is set, it will be used to reset the cursor style instead
2878: of
2879: .Em Cs .
1.232 jmc 2880: .It Em \&Ms
2881: This sequence can be used by
2882: .Nm
2883: to store the current buffer in the host terminal's selection (clipboard).
2884: See the
2885: .Em set-clipboard
2886: option above and the
2887: .Xr xterm 1
2888: man page.
1.1 nicm 2889: .El
2890: .Sh FILES
1.26 nicm 2891: .Bl -tag -width "/etc/tmux.confXXX" -compact
1.1 nicm 2892: .It Pa ~/.tmux.conf
1.6 jmc 2893: Default
1.1 nicm 2894: .Nm
1.6 jmc 2895: configuration file.
1.26 nicm 2896: .It Pa /etc/tmux.conf
2897: System-wide configuration file.
1.1 nicm 2898: .El
1.57 jmc 2899: .Sh EXAMPLES
2900: To create a new
2901: .Nm
2902: session running
2903: .Xr vi 1 :
2904: .Pp
2905: .Dl $ tmux new-session vi
2906: .Pp
2907: Most commands have a shorter form, known as an alias.
2908: For new-session, this is
2909: .Ic new :
2910: .Pp
2911: .Dl $ tmux new vi
2912: .Pp
2913: Alternatively, the shortest unambiguous form of a command is accepted.
2914: If there are several options, they are listed:
2915: .Bd -literal -offset indent
2916: $ tmux n
2917: ambiguous command: n, could be: new-session, new-window, next-window
2918: .Ed
2919: .Pp
2920: Within an active session, a new window may be created by typing
2921: .Ql C-b c
2922: (Ctrl
2923: followed by the
2924: .Ql b
2925: key
2926: followed by the
2927: .Ql c
2928: key).
2929: .Pp
2930: Windows may be navigated with:
2931: .Ql C-b 0
2932: (to select window 0),
2933: .Ql C-b 1
2934: (to select window 1), and so on;
2935: .Ql C-b n
2936: to select the next window; and
2937: .Ql C-b p
2938: to select the previous window.
2939: .Pp
2940: A session may be detached using
2941: .Ql C-b d
1.64 nicm 2942: (or by an external event such as
2943: .Xr ssh 1
2944: disconnection) and reattached with:
1.57 jmc 2945: .Pp
2946: .Dl $ tmux attach-session
2947: .Pp
2948: Typing
2949: .Ql C-b \&?
2950: lists the current key bindings in the current window; up and down may be used
2951: to navigate the list or
2952: .Ql q
2953: to exit from it.
2954: .Pp
2955: Commands to be run when the
2956: .Nm
2957: server is started may be placed in the
2958: .Pa ~/.tmux.conf
2959: configuration file.
2960: Common examples include:
2961: .Pp
2962: Changing the default prefix key:
2963: .Bd -literal -offset indent
2964: set-option -g prefix C-a
2965: unbind-key C-b
2966: bind-key C-a send-prefix
2967: .Ed
2968: .Pp
2969: Turning the status line off, or changing its colour:
2970: .Bd -literal -offset indent
2971: set-option -g status off
2972: set-option -g status-bg blue
2973: .Ed
2974: .Pp
2975: Setting other options, such as the default command,
2976: or locking after 30 minutes of inactivity:
2977: .Bd -literal -offset indent
2978: set-option -g default-command "exec /bin/ksh"
2979: set-option -g lock-after-time 1800
2980: .Ed
2981: .Pp
2982: Creating new key bindings:
2983: .Bd -literal -offset indent
2984: bind-key b set-option status
2985: bind-key / command-prompt "split-window 'exec man %%'"
1.73 nicm 2986: bind-key S command-prompt "new-window -n %1 'ssh %1'"
1.57 jmc 2987: .Ed
1.1 nicm 2988: .Sh SEE ALSO
2989: .Xr pty 4
2990: .Sh AUTHORS
2991: .An Nicholas Marriott Aq nicm@users.sourceforge.net