[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;5u format instead of being recognized as ESC
  • In fzf launched from Claude Code, pressing Ctrl+[ displays 91;5u literally

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

  1. Modern terminal standard: CSI u is becoming the standard keyboard protocol for modern terminal emulators
  2. Ergonomics: Ctrl+[ is more ergonomic than reaching for ESC key (especially on keyboards without physical ESC)
  3. 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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗