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

C-g keybinding conflicts with Emacs and should be configurable/disableable

Open rhblind opened this issue 1 month ago • 1 comments

Problem

The C-g (Ctrl+G) keybinding is hardcoded to open the current prompt in an external editor. This creates a significant conflict for Emacs users running Claude Code inside terminal emulators like vterm or eat.

Why this is problematic

In Emacs, C-g (keyboard-quit) is the universal "cancel" command - one of the most fundamental keybindings. It's used constantly to:

  • Cancel partially typed commands or key sequences
  • Abort running commands or long operations
  • Exit the minibuffer without completing input
  • Cancel incremental search
  • Deselect active regions
  • Escape from recursive edit levels
  • Return to normal state in Evil mode (Vim emulation)

It's essentially Emacs' equivalent of ESC - the "get me out of whatever I'm in" key. Muscle memory makes users press C-g reflexively dozens of times per session.

When running Claude Code inside Emacs terminals (vterm, eat, eshell, etc.), every accidental C-g press opens an external editor, disrupting workflow significantly.

Requested solution

Please provide a configuration option to:

  1. Disable the C-g keybinding entirely, or
  2. Remap it to a different key combination

This could be exposed via:

  • ~/.claude/settings.json
  • The /config command
  • An environment variable

Workarounds attempted

  • Setting $EDITOR to a no-op script works but is a hack
  • Terminal-level key remapping is complex and error-prone
  • There's no native configuration option available

Related

This is related to issue #13531 requesting configurable vi mode keybindings.

Environment

  • Running Claude Code inside Emacs terminal emulators (vterm, eat)
  • macOS / Linux

rhblind avatar Dec 20 '25 23:12 rhblind