DECKPAM / DECKPNM — Keypad application / numeric mode (ESC = / ESC >)
Switch the numeric keypad between sending application escape sequences (\eOM / \eOj …) and plain ASCII digits — the foundation of vim / less / readline keypad behaviour.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b= (DECKPAM) \x1b> (DECKPNM)\033= / \033>\e= / \e>ESC = / ESC >1b 3d / 1b 3eDescription
Two **C1-class** escape sequences (no CSI, no parameter — just `ESC` followed by a single final byte) that flip the numeric keypad's input encoding. **DECKPAM** (`\x1b=`) enables Application Keypad Mode — the numeric keys 0-9 and operators `+`, `-`, `*`, `/`, `.`, Enter, etc. each send an SS3-prefixed sequence (`\x1bOq` for 1, `\x1bOM` for Enter, `\x1bOk` for `+`, …) instead of the literal ASCII byte. Curses programs that want to distinguish numeric-pad `5` from main-keyboard `5` enable this on startup. **DECKPNM** (`\x1b>`) reverses — the numeric keypad emits the plain ASCII bytes `0`-`9` and `+-*/.\n`, indistinguishable from the main keyboard. Curses `keypad(stdscr, TRUE)` translates to `\x1b=` on entry and `\x1b>` on exit; vim emits the pair around its main loop; less / man pages emit them around their reader UI. **Important**: cursor-pad keys (arrows, Home, End, PgUp, PgDn) are governed by a SEPARATE mode — DECCKM (`\x1b[?1h/l`), not DECKPAM — so enabling DECKPAM does NOT change arrow-key encoding. Confusingly named together by the manuals, but they are independent settings. Both sequences are 2-byte (ESC + final byte) which makes them parser-cheap; emit them around any TUI that needs distinct numpad input.
Spec citation: DEC VT100 (DECKPAM / DECKPNM) / xterm-ctlseqs
Parameters
Examples
# Enable app keypad — read what numpad-Enter sends now:\nprintf '\033='\nread -rsn 3 key # captures \x1bOM instead of \n\nprintf '\033>' # always restore on exitimport sys, termios, tty\nsys.stdout.write('\x1b=') # app keypad on\n# … TUI loop with raw stdin …\nsys.stdout.write('\x1b>') # normal keypad on exitfmt.Print("\x1b=") // DECKPAM: numpad sends SS3 sequences\ndefer fmt.Print("\x1b>") // DECKPNM: restoreprocess.stdout.write('\x1b=') // app keypad\nprocess.on('exit', () => process.stdout.write('\x1b>'))fputs("\x1b=", stdout); /* enter app keypad — pair with atexit handler emitting \x1b> */Terminal support
- xterm
- yes
- Linux console (fbcon)
- yes
- macOS Terminal.app
- yes
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- partial
- kitty
- yes
- alacritty
- yes
- WezTerm
- yes
- Ghostty
- yes
- GNOME Terminal
- yes
- Konsole
- yes
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | yes | yes | yes | yes | partial | yes | yes | yes | yes | yes | yes | no | no |
Related sequences
In the family cookbook
ESC cookbook · 3. Keypad mode — `\x1b=` / `\x1b>` (DECKPAM / DECKPNM)