DECUDK — Define User-Defined Keys (DCS Pc;Pl|Ky/St;... ST)
Remap the DEC user-defined function keys (F6–F20) at runtime — legacy DEC VT, still decoded by xterm and its forks.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1bPPc;Pl|Ky/St;Ky/St;...\x1b\\\033PPc;Pl|Ky/St;...\033\\\ePPc;Pl|Ky/St;...\e\\ESC P Pc ; Pl | Ky / St ; ... ESC \1b 50 ... 1b 5cDescription
DECUDK — Define User-Defined Keys. The DCS frame whose body starts with two numeric parameters separated by `;`, then a `|` literal, then one-or-more `Ky/St` pairs separated by `;`. **Pc** = clear-policy: `0` clear all keys first, `1` clear only the keys being defined. **Pl** = lock-state: `0` lock the definitions (further DECUDK ignored until DECSTR), `1` keep unlocked. **Ky** = the key code (17 = F6, 18 = F7, ..., 34 = F20; F1–F5 are reserved as terminal-local). **St** = the replacement bytes, hex-encoded (two ASCII hex chars per byte). On a DEC VT520 the user could thus map F6 to send `vim<CR>` by emitting `\x1bP1;1|17/76696D0D\x1b\\`. xterm honours DECUDK by routing the hex payload into its translation table for the named PF key. Modern emulators that draw their own UI for shortcut binding (kitty, wezterm) ignore DECUDK in favour of their config file, but xterm + mintty + some industrial terminals still implement it. Practical value today: legacy DEC software, terminal-test-suites (`vttest` includes a DECUDK page), and emulator development.
Spec citation: DEC STD 070 (DECUDK) / xterm-ctlseqs
Examples
# Map F6 to literally type 'vim\\n' when pressed (key code 17, hex 76 69 6d 0d):\nprintf '\033P1;1|17/76696D0D\033\\'import sys; sys.stdout.write('\x1bP1;1|17/76696D0D\x1b\\\\')fmt.Print("\x1bP1;1|17/76696D0D\x1b\\\\")process.stdout.write('\x1bP1;1|17/76696D0D\x1b\\\\')printf("\x1bP1;1|17/76696D0D\x1b\\\\");Terminal support
- xterm
- yes
- Linux console (fbcon)
- no
- macOS Terminal.app
- no
- iTerm2
- no
- Windows Terminal
- no
- cmd.exe / ConPTY
- no
- kitty
- no
- alacritty
- no
- WezTerm
- no
- Ghostty
- no
- GNOME Terminal
- no
- Konsole
- no
- 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 | no | no | no | no | no | no | no | no | no | no | no | no | no |
Related sequences
In the family cookbook
DCS cookbook · 4. VT remap surfaces — DECUDK (user-defined keys) and DECDLD (downloaded glyphs)