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