[FEATURE] Support CSI u keyboard protocol for Ctrl+[ (ESC equivalent)
Resolved 💬 3 comments Opened Jan 13, 2026 by yancya Closed Feb 28, 2026
Description
Claude Code does not properly handle Ctrl+[ as ESC when using modern terminal emulators with CSI u keyboard protocol enabled (e.g., Ghostty, kitty with keyboard_protocol=kitty enabled).
Environment
- Claude Code version: 2.1.6
- Terminal: Ghostty (CSI u protocol enabled by default)
- OS: macOS 15.1
Current Behavior
When CSI u keyboard protocol is enabled:
- Pressing
Ctrl+[in Claude Code's confirmation dialogs (e.g., "Do you want to proceed? Esc to cancel") does nothing - The key is encoded as CSI
91;5uformat instead of being recognized as ESC - In fzf launched from Claude Code, pressing
Ctrl+[displays91;5uliterally
Expected Behavior
Ctrl+[ should function as ESC in Claude Code's TUI, just like in other CSI u-aware applications:
- ✅ Vim/Neovim:
Ctrl+[correctly functions as ESC - ✅ Fish shell: CSI u protocol works perfectly for advanced key bindings
- ❌ Claude Code:
Ctrl+[is not recognized as ESC
Why This Matters
- Modern terminal standard: CSI u is becoming the standard keyboard protocol for modern terminal emulators
- Ergonomics:
Ctrl+[is more ergonomic than reaching for ESC key (especially on keyboards without physical ESC) - Consistency: Other modern CLI tools (vim, neovim, fish) already support it
Workaround
Currently, users must use the physical ESC key instead of Ctrl+[, which defeats the purpose of using modern keyboard protocols.
References
- CSI u keyboard protocol: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
- Ghostty terminal (uses CSI u by default): https://ghostty.org/
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗