claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] Ctrl-C and Esc keys should be single-purposed not multi-purposed

Open dimension-zero opened this issue 5 months ago • 9 comments

Preflight Checklist

  • [x] I have searched [existing requests](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20label%3Aenhancement) and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Current key bindings suffer from overloaded functionality that creates usability issues:

Ctrl-C conflicts:

  • Single press: clears prompt box
  • Double press: exits Claude Code entirely
  • Lack of clear feedback increases risk of accidental exit

Esc key conflicts:

  • Single press: interrupts Claude Code execution
  • Double press: shows prompt history
  • Also exits interactive menus

These multi-function bindings lead to confusion and unintended actions, particularly on slower systems where key presses may be delayed or buffered.

Proposed Solution

Implement single-purpose key bindings:

  • Ctrl-Q → quit Claude Code
  • Ctrl-C → clear prompt box only
  • Ctrl-Up-Arrow → show prompt history
  • Ctrl-X / Ctrl-Down-Arrow → exit interactive menus
  • Esc → interrupt Claude Code execution only

Benefits

Single-purpose key bindings provide:

  • Clear separation of functions
  • Elimination of accidental actions
  • Improved user experience through predictable behavior
  • Reduced cognitive load when remembering shortcuts

Use Case Examples

Current problematic scenarios:

  1. Sluggish system + Ctrl-C: User presses Ctrl-C to clear prompt, sees no response, presses again. Minutes later, both keypresses register and Claude Code exits unexpectedly.

  2. Esc key confusion: User presses Esc twice to review prompts, but inadvertently stops current execution instead.

  3. Menu exit delays: User presses Esc to exit menu, sees no response due to system lag, presses again. Both keypresses eventually register, causing menu exit plus unwanted task interruption.

Alternative Solutions

  • Allow user-configurable key bindings
  • Community input on preferred key combinations
  • Implement confirmation dialogs for destructive actions

Priority

High - Significant impact on productivity and user experience

Feature Category

Interactive mode (TUI)

Additional Context

This represents a straightforward UX improvement that can be implemented without significant complexity while addressing fundamental usability concerns.

dimension-zero avatar Sep 10 '25 08:09 dimension-zero

My thoughts as a daily user of Claude Code:

Ctrl+D is normally used to exit shell sessions so it's already very intuitive for users using shells/terminals regularly. I think Ctrl+D is a better shortcut to exit it because it follows the shortcut which is already used in the terminal normally. I think removing the possibility of exiting with Ctrl+C makes the most sense to me and leaving the Ctrl+D to exit session.

The changes you are suggesting have the downside of many more different keys to memorise vs being able to only have to have the fingers ready in some keys.

I think slower computers is a good point thou, Claude Code can already sometimes get a bit slowed down when history gets huge, even just writing text while its running to me is slowed down sometimes. Maybe it's due to the terminal I'm using (Gnome Console) or the Nodejs implementation instead of something more performant like Rust.

gui-wf avatar Sep 10 '25 11:09 gui-wf

I'd like Ctrl+C to exit Claude Code with one press, not two. It's unconventional, therefore confusing.

alexec avatar Sep 19 '25 02:09 alexec

I'd like Ctrl+C to exit Claude Code with one press, not two. It's unconventional, therefore confusing.

I'd like keyboard shortcuts to be user-configurable. Some want Ctrl-C to be quit like regular CLI terminals. Others want Ctrl-C to be Copy like in GUI apps. IMO the issue is double-purposing / overloading of key-strokes rather than what they are specifically.

dimension-zero avatar Sep 19 '25 05:09 dimension-zero

On MacOS, copy is Command+C , so maybe a Windows/Linux problem?

alexec avatar Sep 19 '25 16:09 alexec

On MacOS, copy is Command+C , so maybe a Windows/Linux problem?

This is why key-strokes should be user-configurable (like in VSCode, Visual Studio, etc.)

dimension-zero avatar Sep 21 '25 12:09 dimension-zero

On MacOS, copy is Command+C , so maybe a Windows/Linux problem?

Copying from terminal normally is Shift+Ctrl+C in Linux Windows I think it works too. For pasting needs Shift+Ctrl+V in Linux terminals and Windows doesn't need Shift

Ctrl+C in Linux terminals normally just cancels/clears current written command/prompt, And does Not exist the current shell - For that Ctrl+D can be used.

So the double Ctrl+C to exit Claude Code is unconventional.

I think it's a fair thing to have changeable shortcuts from a config file somewhere. I would like for Anthropic to keep the opinionated default configurations thou. Line in Helix Editor which is a "neo-neovim" with opinionated changes which to me feel better but then it still gives me the freedom to change shortcuts.

gui-wf avatar Sep 25 '25 09:09 gui-wf

On MacOS, copy is Command+C , so maybe a Windows/Linux problem?

In Windows, copy is Ctrl+C. In any shell, Ctrl+C is usually quit.

Copying from terminal normally is Shift+Ctrl+C in Linux Windows I think it works too. For pasting needs Shift+Ctrl+V in Linux terminals and Windows doesn't need Shift

Ctrl+C in Linux terminals normally just cancels/clears current written command/prompt, And does Not exist the current shell - For that Ctrl+D can be used.

So the double Ctrl+C to exit Claude Code is unconventional.

Yes!

I think it's a fair thing to have changeable shortcuts from a config file somewhere. I would like for Anthropic to keep the opinionated default configurations thou. Line in Helix Editor which is a "neo-neovim" with opinionated changes which to me feel better but then it still gives me the freedom to change shortcuts.

The issue here is we have collision of WIMP OS conventions (macOS vs Windows vs Linux), CLI conventions and cross-platform confusion. Everyone has their own setup and their own taste so configurability is vital. Opinionated is a good starting point as you say. But overloading Ctrl+C and Esc with multiple non-intersecting / non-complimentary functions is a really odd choice. A bit of config easily fixes this.

Come on @anthropics - open-source it and let the community do it for you!

dimension-zero avatar Sep 25 '25 10:09 dimension-zero

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 06 '25 10:12 github-actions[bot]

As a heavy user of the vi editing mode, I must say that the experience is much worse in claude code than in bash. (MacOS iTerm, Claude Code v2.1.1). I would prefer that Ctrl-C interrupts and ESC does not interrupt, I make this mistake all the time when I hit ESC a second time and accidentially interrupt.

But the root of my problem may be more of a different issue that I have not seen here, so I'll open 🙌 a new issue linked below.

chrismerck avatar Jan 07 '26 23:01 chrismerck

As a heavy user of the vi editing mode, I must say that the experience is much worse in claude code than in bash. (MacOS iTerm, Claude Code v2.1.1). I would prefer that Ctrl-C interrupts and ESC does not interrupt, I make this mistake all the time when I hit ESC a second time and accidentially interrupt.

But the root of my problem may be more of a different issue that I have not seen here, so I'll open 🙌 a new issue linked below.

I agree with you it would be a good change. better to have one way that follows some standard/muscle memory

gui-wf avatar Jan 13 '26 02:01 gui-wf