Mintty's terminal emulation is aimed at compatibility with xterm. Most of the xterm control sequences documented at http://invisible-island.net/xterm/ctlseqs/ctlseqs.html are supported. Please report as bugs any incompatibilities or unimplemented sequences that would be useful.
Some sequences that were introduced by other terminals such as the Linux console, and that aren't available in xterm, are also supported.
This page only lists control sequences that are specific to mintty. Caret notation is used to show control characters. The full details of all supported control sequences are only available in the source code.
These escape sequences cause mintty to report its identification.
request | response | comment |
---|---|---|
^[[>0c |
^[[>77; version; unicodec |
secondary devices attributes (DEC); version like 30105, unicode version when using built-in data |
^[[>0q |
`^[P> | mintty _version_ ^[` |
There are two settings controlling the keycode sent by the Esc key.
The first controls application escape key mode, where the escape key sends a keycode that allows applications such as vim to tell it apart from the escape character appearing at the start of many other keycodes, without resorting to a timeout mechanism.
sequence | mode | keycode |
---|---|---|
^[[?7727l |
normal | ^[ or ^\ |
^[[?7727h |
application | ^[O[ |
When application escape key mode is off, the escape key can be be configured to send ^\
instead of the standard ^[
. This allows the escape key to be used as one of the special keys in the terminal line settings (as set with the stty utility).
sequence | keycode |
---|---|
^[[?7728l |
^[ |
^[[?7728h |
^\ |
Application control key mode can be configured per control key. It facilitates more distinction between different keys, as well as usage of Ctrl+[ in various applications that would normally handle the ESC character as a generic key code prefix. Possible distinctions:
- Esc key and Ctrl+[ key
- Tab character and Ctrl+I key
- NUL character sent by Ctrl+space and NUL key code sent by Ctrl+@
As a generic feature, this configuration is accepted for all control
characters. Generated key codes are similar to those sent in the xterm
modifyOtherKeys mode, but normalized to a contiguous range of codes using
capital ASCII character codes, and indicating the control modifier only.
Settings can be combined in a common sequence like ^[[?77009;77027h
.
The respective setting is cleared with a corresponding sequence ending with l
.
sequence | input | key code |
---|---|---|
^[[?77000h |
Ctrl+@ | ^[[64;5u |
... | ||
^[[?77009h |
Ctrl+I | ^[[73;5u |
... | ||
^[[?77027h |
Ctrl+[ | ^[[91;5u |
... | ||
^[[?77031h |
Ctrl+_ | ^[[95;5u |
Mintty allows to set, save or restore the IME status explicitly, to support applications like text editors to adapt it to the current input target.
sequence | IME status |
---|---|
^[[< ont |
Open (1) or Close (0, default) IME status |
^[[<s |
Save (push) IME status |
^[[<r |
Restore (pop) IME status |
When shortcut override mode is on, all shortcut key combinations are sent to the application instead of triggering window commands.
sequence | override |
---|---|
^[[?7783l |
off |
^[[?7783h |
on |
With the VT520 sequence DECARR the keyboard auto-repeat speed can be limited to the given value in characters per second. Unlike original DECARR, a value of 0 disables repeat rate limitation. Keyboard auto-repeat can also be disabled with DECSET 8 (DECARM).
sequence | comment |
---|---|
^[[ cps-p |
max 30 |
^[[-p |
unlimited |
^[[?8l |
disable auto-repeat |
^[[?8h |
enable auto-repeat |
Mintty supports bidi rendering by default. However, some applications may prefer to control bidi appearance themselves. There is one option (Bidi) and some control sequences to adjust the behaviour.
option | bidi |
---|---|
Bidi=0 |
disabled |
Bidi=1 |
disabled on alternate screen |
Bidi=2 |
(default) enabled |
sequence | bidi |
---|---|
^[[?77096h |
disabled |
^[[?77096l |
enabled |
^[[?7796h |
disabled on current line |
^[[?7796l |
not disabled on current line |
^[[8h |
BDSM (ECMA-48): implicit bidi mode (bidi-enabled lines) |
^[[8l |
BDSM (ECMA-48): explicit bidi mode (bidi-disabled lines) |
^[[?2501h |
enable bidi autodetection (default) |
^[[?2501l |
disable bidi autodetection |
^[[1 k |
SCP (ECMA-48): set lines to LTR paragraph embedding level |
^[[2 k |
SCP (ECMA-48): set lines to RTL paragraph embedding level |
^[[0 k |
SCP (ECMA-48): default direction handling: autodetection with LTR fallback |
^[[?2500h |
enable box mirroring (*) |
^[[?2500l |
disable box mirroring (*) |
^[[0 S |
SPD (ECMA-48): LTR presentation direction |
^[[3 S |
SPD (ECMA-48): RTL presentation direction |
Note: ECMA-48 bidi modes and private bidi modes are experimental. They follow the current status of the bidi mode model of the «BiDi in Terminal Emulators» recommendation.
Note: Box mirroring means a number of graphic characters are added to the set of bidi-mirrored characters as specified by Unicode. These are the unsymmetric characters from ranges Box Drawing (U+2500-U+257F) and Block Elements (U+2580-U+259F). Others may be added in future versions.
Note: SPD is a deprecated fun feature.
These sequences can be used to hide or show the scrollbar, whereby the window size remains the same but the number of character columns is changed to account for the width of the scrollbar. If the scrollbar is disabled in the options, it will always remain hidden.
sequence | scrollbar |
---|---|
^[[?7766l |
hide |
^[[?7766h |
show |
Note: Mintty also supports the xterm-compatible sequences to hide or show the scrollbar, which handle the scrollbar as "outer" to the terminal, adding to the window width but keeping the terminal width unchanged (except in full-screen mode).
— EXPERIMENTAL —
In application scrollbar mode, an application can make use of the window scrollbar; it can set up the scrollbar to reflect the application idea of a scroll position, and receive scrollbar events as control sequences.
This mode is up to future revision. It is currently enabled or disabled implicitly, there is no explicit mode setting sequence.
The application scrollbar indicates a scrollbar view ("scroll offset") within an assumed span of a virtual document ("document height", as maintained by the application). The height of the view ("viewport height") defaults to the actual terminal size (rows); its difference to the terminal size is kept when resizing the terminal. Control sequences can set up the current view position ("scroll offset" from 1 to total size) as well as the total virtual document size ("document height" in assumed lines) and optionally the "viewport height".
sequence | scrollbar |
---|---|
^[[ pos; size; height#t |
set scrollbar view position, virtual size and height |
^[[ pos; size#t |
set scrollbar view position and virtual size |
^[[ pos#t |
set scrollbar view position |
^[[0#t |
disable application scrollbar |
Relative scrollbar movement and absolute positioning are reported with special sequences; for details see Keycodes – Application scrollbar events.
Mintty includes support for sending mousewheel events to an application without having to enable full xterm mouse tracking, which takes over all mouse events and isn't supported by every application.
Mousewheel reporting only happens on the alternate screen, whereas on the primary screen, the mousewheel scrolls the scrollback buffer. The following two sequences enable or disable mousewheel reporting. It is enabled by default.
sequence | reporting |
---|---|
^[[?1007l |
disabled |
^[[?1007h |
enabled |
^[[?7786l |
disabled |
^[[?7786h |
enabled |
The xterm-style sequence mode (1007) is disabled by default but the mintty feature (7786) is enabled by default. The mintty mode can be formatted to private sequences (see below). To support these subtle differences, both can be switched independently.
By default, mousewheel events are reported as cursor key presses, which enables mousewheel scrolling in applications such as less without requiring any configuration. Alternatively, mousewheel reporting can be switched to application mousewheel mode, where the mousewheel sends its own separate keycodes that allow an application to treat the mousewheel differently from cursor keys:
event | code |
---|---|
line up | ^[Oa |
line down | ^[Ob |
page up | ^[[1;2a |
page down | ^[[1;2b |
Application mousewheel mode is controlled by these sequences:
sequence | mode |
---|---|
^[[?7787l |
cursor |
^[[?7787h |
application |
Applications can ask to be notified when the width of the so-called ambiguous width character category changes due to the user changing font.
sequence | reporting |
---|---|
^[[?7700l |
disabled |
^[[?7700h |
enabled |
When enabled, ^[[1W
is sent when changing to an "ambiguous narrow" font and ^[[2W
is sent when changing to an "ambiguous wide" font.
Applications can ask to be notified when the font has been changed.
sequence | reporting |
---|---|
^[[?7767l |
disabled |
^[[?7767h |
enabled |
When enabled, ^[[0W
is sent when the font has changed,
unless ambiguous width reporting is enabled too, in which case
either ^[[1W
or ^[[2W
is sent as described above;
so if both reporting modes are enabled, only one report is sent.
Fonts vary widely in their Unicode coverage, i.e. they usually miss glyphs for many characters. The following sequence can be used to enquire about support for a specified list of characters.
^[]7771;?;
char0;
char1...^G
Characters shall be specified with their decimal Unicode codepoint. Any number of characters can be given. Mintty replies with the same sequence, except that the question mark is replaced with an exclamation mark and that codes for characters that the current font does not have a glyph for are omitted.
The following OSC ("operating system command") sequences can be used to change wide display modes for Indic and a range of long Unicode characters:
sequence | wide characters |
---|---|
^[]77119;1^G |
Indic |
^[]77119;2^G |
Long Unicode chars |
^[]77119;0^G |
none |
Setting wide Indic mode, Indic characters with glyphs wider than a single character cell will be displayed in double-width (like CJK characters). Note: This is a switchable option only as there is no authoritative source of information about which Indic characters should be considered wide; most screen applications will not cooperate with this feature as their assumption of character widths is mostly based on the system locale (with the notable exception of the Unicode editor MinEd which supports Indic wide display in its forthcoming release).
Setting wide long Unicode characters mode, a number of Unicode characters that are supposed to be "wide" or "long" will be displayed in double-width (like CJK characters). See comment above about cooperating applications. The list of long Unicode characters considered "wide" is U+2001, U+2003, U+2014, U+27DD..U+27DE, U+27F5..U+27FF, U+2910, U+296A..U+296D, U+2B33, U+2E0E..U+2E11, U+2E3A..U+2E3B; this list is subject to change in future versions.
— EXPERIMENTAL —
Mintty provides explicit width override as a character attribute,
so an application can enforce single-width characters to be rendered wide
or double-width ("wide") characters to be rendered narrow.
Experimentally, for this purpose the ECMA-48 escape sequences
"Presentation Expand Or Contract" (PEC) CSI
num SP Z
are used,
with one extension:
sequence | effect |
---|---|
^[[0 Z |
default: normal single or double width |
^[[1 Z |
expand: enforce double-cell display |
^[[2 Z |
contract: enforce single-cell display |
^[[22 Z |
zoom down to single-cell display (like setting Charwidth=single ) |
^[[2;2 Z |
like ^[[22 Z |
The following OSC ("operating system command") sequences can be used to change and query font size:
sequence | font size |
---|---|
^[]7770;?^G |
query |
^[]7770; num^G |
set to num |
^[]7770;+ num^G |
increase by num |
^[]7770;- num^G |
decrease by num |
^[]7770;^G |
default |
As usual, OSC sequences can also be terminated with ^[\
(ST, the string terminator) instead of ^G
.
When the font size is queried, a sequence that would restore the current size is sent, terminated with ST: ^[]7770;
num^[\
.
The following OSC ("operating system command") sequences can be used to change and query font size:
sequence | font size |
---|---|
^[]7777;?^G |
query |
^[]7777; num^G |
set to num |
^[]7777;+ num^G |
increase by num |
^[]7777;- num^G |
decrease by num |
^[]7777;^G |
default |
The window size is adapted to zoom with the font size, so the terminal character geometry is kept if possible.
As usual, OSC sequences can also be terminated with ^[\
(ST, the string terminator) instead of ^G
.
When the font size is queried, a sequence that would restore the current size is sent, terminated with ST: ^[]7777;
num^[\
.
The locale and charset used by the terminal can be queried or changed using these OSC sequences introduced by rxvt-unicode:
sequence | locale |
---|---|
^[]701;?^G |
query |
^[]701; loc^G |
set to loc |
^[]701;^G |
set to default |
The locale string used here should take the same format as in the locale environment variables such as LANG. When the locale is queried, a sequence that would set the current locale is sent, e.g. ^[]701;C.UTF-8^G
. An empty loc string selects the locale configured in the options or the environment.
Note: While the terminal character set defines how the terminal interprets
and handles keys and characters, application handling of characters is
usually determined by the locale environment, and they cannot automatically
be tied to each other. If they do not match, character handling will be chaotic.
Consistent changing could be achieved with a shell script like
changecs,
to be declared in your shell profile (e.g. $HOME/.bashrc
).
The following OSC ("operating system command") sequence can be used to copy the window title to the Windows clipboard (like menu function "Copy Title"):
^[]7721;1^G
The following OSC ("operating system command") sequence can be used to set the window title (alternatively to OSC 2):
^[]l;1^G
The following OSC ("operating system command") sequence can be used to set the window icon from the given file and optional icon index:
^[]I;icon_file,index^G
The following OSC ("operating system command") sequence can be used to inform mintty about the current working directory (as used in the Mac terminal), in order to spawn a new (cloned) terminal window in that directory (e.g. Alt+F2):
^[]7;
file-URL^G
The file-URL liberally follows a file:
URL scheme; examples are
file:///home/tmp
//localhost/home/tmp
/home/tmp
- (empty) to restore the default behaviour
The following OSC ("operating system command") sequence can be used to set a hyperlink attribute which is opened on Ctrl-click.
link control | function |
---|---|
^[]8;; URL^G |
underlay text with the hyperlink |
^[]8;;^G |
clear hyperlink attribute (terminate hyperlink) |
^[]8;id= ID; URL^G |
associate instances of hyperlink |
A typical hyperlinked text would be written like
^[]8;;
URL^G
text^[]8;;^G
Using the id=
option, multiple parts of hyperlinked text can be
associated to a single hyperlink, so a partially visible or wrapped
hyperlinked text can be produced on the screen.
See Hyperlinks (a.k.a. HTML-like anchors) in terminal emulators
for an example and a discussion.
The following sequence can be used to mark prompt lines in support of two features:
- Shift+cursor-left/right navigates to the previous/next prompt line and scrolls in the scrollback buffer accordingly
- user-defined commands can refer to environment variable MINED_OUTPUT which contains terminal output as limited by previous marker
| ^[[?7711h
| mark prompt line (last line in case of multi-line prompt) |
| ^[[?7711l
| mark secondary prompt line (upper lines) |
In addition to the legacy Sixel feature, mintty supports graphic image display via iTerm2 controls:
^[]1337;File=
par=
arg [;
par=
arg ]*:
image^G
par | arg | comment |
---|---|---|
name= | base64-encoded ID | currently not used |
width= | size (*) | cell/pixel/percentage |
height= | size (*) | cell/pixel/percentage |
preserveAspectRatio= | 1 (default) or 0 | only used if width and height are given |
image | base64-encoded image data |
The width or height size arguments use cell units by default. Optionally, an appended "px" or "%" refers to the number of pixels or the percentage of screen size at the time of image output. Image size persists when resizing the terminal but scales when zooming the cell size.
If both width and height are given, the preserveAspectRatio parameter can select whether to fit the image in the denoted area or stretch it to fill it. If only one of width or height are given, the other dimension is scaled so that the aspect ratio is preserved. If none of width or height are given, the image pixel size is used.
Image formats supported comprise PNG, JPEG, GIF, TIFF, BMP, Exif.
After output of a Sixel image in Sixel scrolling mode, or other image, the final cursor position can be next to the right bottom of the image, below the left bottom of the image (default), or at the line beginning below the image (like xterm). The mintty private sequence 7730 chooses between the latter two options and is overridden by the xterm control sequence 8452.
sequence | exit position |
---|---|
^[[?7730h |
line beginning below |
^[[?7730l |
below left bottom |
^[[?8452h |
next to right bottom |
^[[?8452l |
below image |
The VT510 DECSCUSR sequence can be used to control cursor type (shape) and blinking. It takes an optional second parameter (proprietary extension) to set the blinking interval in milliseconds.
^[[
arg SPq
^[[
arg;
blink SPq
arg | shape | blink |
---|---|---|
0 | default | default |
1 | block | yes |
2 | block | no |
3 | underscore | yes |
4 | underscore | no |
5 | line | yes |
6 | line | no |
Furthermore, the following Linux console sequence can be used to set the size of the active underscore cursor. (Note that the second and third parameters from the Linux sequence are not supported; cursor colour can be set with the OSC 12 sequence.)
^[[?
argc
arg | size |
---|---|
0 | default |
1 | invisible |
2 | underscore |
3 | lower_third |
4 | lower_half |
5 | two_thirds |
6 | full block |