DECARM — Auto-repeat keys mode (CSI ? 8 h / l)
Toggle whether the terminal repeats key bytes while a key is held down — a TUI-relevant knob for games and editors where holding `j` should NOT spam the buffer.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[?8h (repeat) \x1b[?8l (no repeat)\033[?8h / \033[?8l\e[?8h / \e[?8lESC [ ? 8 h / ESC [ ? 8 l1b 5b 3f 38 68 / 6cDescription
Auto-Repeat Mode. When set (`\x1b[?8h`, the default in nearly every terminal), holding down a key after the OS-defined repeat delay (typically 250 ms) causes the terminal to inject repeated key bytes at the OS-defined repeat rate (typically 30/sec) — the standard typewriter-style behaviour. When reset (`\x1b[?8l`), the terminal sends exactly one byte per physical keypress regardless of how long the key is held — so a roguelike that interprets `j` as 'move down once' won't see the player skipping across the map when they hold the key. The OS-defined delay/rate isn't tunable via DECARM (use `xset r rate` on X11, `defaults write -g KeyRepeat` on macOS, accessibility panel on Windows); DECARM only flips on/off. Critical for TUI games (curses-based roguelikes like nethack, brogue), action editors that interpret modal-style single-keystroke commands, and applications that want every keystroke debounced into a discrete event. Almost-universal support — only Linux console partial (depends on framebuffer driver). Restore to `?8h` on exit, always — leaving auto-repeat off pollutes the user's shell session.
Spec citation: DEC VT100 (DECARM) / xterm-ctlseqs
Parameters
Examples
printf '\033[?8l' # turn OFF auto-repeat for the duration of this TUI\ntrap 'printf "\\033[?8h"' EXIT # restore on any exit\n# … game loop …import sys, atexit\nsys.stdout.write('\x1b[?8l') # roguelike: one move per keypress\natexit.register(lambda: sys.stdout.write('\x1b[?8h'))fmt.Print("\x1b[?8l")\ndefer fmt.Print("\x1b[?8h") // always restoreprocess.stdout.write('\x1b[?8l')\nprocess.on('exit', () => process.stdout.write('\x1b[?8h'))printf("\x1b[?8l");\natexit_set_restore("\x1b[?8h"); /* paired restore is non-optional */Terminal support
- xterm
- yes
- Linux console (fbcon)
- partial
- 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 | partial | yes | yes | yes | partial | yes | yes | yes | yes | yes | yes | no | no |