DECCKM
AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard
DECCKM (Mode 1) is a DECSET/DECRST mode that controls whether the cursor keys send normal (ANSI) sequences or application (SS3) sequences.
Syntax
CSI ? 1 h DECSET — Enable application cursor keys
CSI ? 1 l DECRST — Disable application cursor keys (normal mode)
Formal syntax
DECSET-mode1 = 0x1b, "[", "?", "1", "h" ; DECRST-mode1 = 0x1b, "[", "?", "1", "l" ;
Description
Per the VT100 User Guide and VT510 Programmer Reference, DECCKM controls the sequences generated by the four cursor (arrow) keys.
- Set (application mode) — The cursor keys send SS3 sequences:
ESC O A(Up),ESC O B(Down),ESC O C(Right),ESC O D(Left). - Reset (normal mode) — The cursor keys send CSI sequences:
CSI A(Up),CSI B(Down),CSI C(Right),CSI D(Left). This is the default.
Cursor key output
| Key | Normal (DECRST) | Application (DECSET) |
|---|---|---|
| Up | ESC [ A | ESC O A |
| Down | ESC [ B | ESC O B |
| Right | ESC [ C | ESC O C |
| Left | ESC [ D | ESC O D |
Application cursor key mode is typically enabled by full-screen terminal applications (such as vi, less, or top) via the smkx/rmkx terminfo capabilities, so that the application can distinguish arrow keys from other input that happens to include CSI sequences.
note
DECCKM only affects the four arrow keys. The numeric keypad has its own mode controlled by DECKPAM/DECKPNM (ESC = / ESC >).
Examples
printf '\e[?1h' # Enable application cursor keys
printf '\e[?1l' # Disable application cursor keys (normal mode)
# In application mode, pressing Up sends: ESC O A
# In normal mode, pressing Up sends: ESC [ A
Specifications
| Specification | Section |
|---|---|
| VT510 Reference | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | Yes | Application cursor keys mode |
| Bobcat | ✓ | 0.9.0 | Implemented in TerminalCtrl library. Configurable via PCStyleFunctionKeys setting. |
| contour | ✓ | v0.1.0 | DECCKM (mode 1 - application cursor keys) implemented as DECMode::UseApplicationCursorKeys in primitives.h line 613, set via Terminal.cpp line 2488 |
| foot | ✓ | Yes | Application cursor keys mode |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | Yes | Application cursor keys mode via cursorMode property |
| Kitty | ✓ | Yes | |
| Konsole | ✓ | Yes | Application cursor keys mode (DECCKM) fully supported |
| mintty | ✓ | Yes | DECCKM (Mode 1) implemented at src/termout.c:2376-2377 |
| mlterm | ✓ | Yes | Fundamental VT100 mode, present since early versions |
| PuTTY | ✓ | 0.45 | Application cursor keys mode implemented at terminal.c:3060-3062 |
| Rio | ? | ? | |
| rxvt-unicode | ✓ | 1.2 | PrivMode_aplCUR - Application cursor keys |
| st | ✓ | 0.1 | |
| terminology | ✓ | v0.1.0 | |
| VT100 | ✓ | Yes | |
| VTE | ✓ | Yes | DEC_APPLICATION_CURSOR_KEYS mode |
| WezTerm | ✓ | Yes | Application cursor keys mode |
| Windows Terminal | ✓ | Yes | |
| xterm | ✓ | xterm-1 | DECCKM (mode 1) - Application cursor keys |
| xterm.js | ✓ | 0.10 | Application Cursor Keys |
| Multiplexers | |||
| cy | ✓ | Yes | |
| GNU Screen | ✓ | v.4.2.0 | Application cursor keys mode (src/ansi.c:1077-1082) |
| tmux | ✓ | 0.8 | |
| tuios | ✓ | v0.0.15 | Application cursor keys mode |
| Zellij | ✓ | v0.31.2 | |
See also
- DECKPAM/DECKPNM — Keypad Application/Numeric Mode — Controls the keypad sequences
- CUU/CUD/CUF/CUB — Cursor Movement — The sequences that cursor keys generate