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

[FEATURE] Add user-configurable keyboard shortcut actions

Open fj opened this issue 1 year ago β€’ 23 comments

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

It is frequently the case that Claude's keyboard shortcuts collide with terminal or OS shortcuts, or an action that would be helpful for a user workflow to take (e.g. a custom slash command) is not bound to a shortcut at all. Claude Code does not currently expose a way to have user-configurable keyboard shortcuts.

Proposed Solution

Users should be able to bind keystrokes or keychords which correspond to some set of Claude-exposed hooks or custom slash commands.

This could be configurable, in, say, a settings.json manner similar to the way that VSCode and VSCodium do. As an example, imagine a schema and instantiation like:

"settings.user.keybindings" : [
  {
    "keybinding": "ctrl+C",
    "action": ["/clear"]
  }
  {
    "keybinding": "ctrl+M A",
    "action": ["/compact", "/custom_one", "/custom_two"]
  }
]

In this example, hitting Ctrl+C causes the TUI to receive the /clear command. Hitting Ctrl+M followed by A causes the TUI to receive the /compact command followed by /custom_one and then /custom_two.

Additional desired behaviors:

  • Keybinding actions are in a stack, such that the first receiver of any keybinding wins. The stack for each keybinding is initialized with the Claude defaults at initialization time, and the user defaults are then added next. This means that whenever one of Claude's default keybindings conflicts with a user keybinding, the user keybinding takes precedence over the Claude default.

  • When keybindings are updated this mapping is reset without needing to restart Claude.

Alternative Solutions

Some other issues propose specific keyboard shortcuts, e.g. #9153. Most of the alternatives rely on using a specific upstream terminal or UI that encodes these macros for the benefit of the Claude TUI. These are generally unreliable because Claude Code doesn't expose a standard interface to receive these, and therefore is in the best position to implement keyboard shortcuts as a feature, rather than something upstream emulating keypresses.

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

Two examples:

  • Imagine that you use terminal multiplexer like tmux or screen with a keyboard shortcut that conflicts with Claude. Without this feature, there will be no way to send Claude the keyboard shortcut because you can't override the settings. If there were a user-configurable capability for keyboard shortcuts, this wouldn't be a problem.

  • You frequently send a sequence of custom slash commands. Rather than typing these out each time, it would be nicer if you could use a keyboard shortcut for this instead. Without this feature, there's no way to do this either.

fj avatar Oct 08 '25 19:10 fj

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/8315
  2. https://github.com/anthropics/claude-code/issues/796

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and πŸ‘ the existing issue instead
  • To prevent auto-closure, add a comment or πŸ‘Ž this comment

πŸ€– Generated with Claude Code

github-actions[bot] avatar Oct 08 '25 19:10 github-actions[bot]

Responding to potential duplicates:

  • This is not a duplicate of #796 because that specifically asks for Readline-compatible keybinding configurations. This is a request for a more general capability than that.
  • This is not a duplicate of #8315 because that was closed as a duplicate of #5376, which is about Ctrl+B keybindings on MacOS. #5376 was marked as fixed because Ctrl+B no longer conflicts, but the general idea outlined in this ticket is unresolved.

fj avatar Oct 08 '25 20:10 fj

I accidentally made a duplicate https://github.com/anthropics/claude-code/issues/9490 - already closed it but it's helpful in that I linked a bunch of disparate issues related to keyboard shortcut remapping to show the range of conflicts people are experiencing. I mentioned a new conflict not documented yet - ctrl+g for external text editor conflicts with Zellij's lock mode.

TyceHerrman avatar Oct 13 '25 21:10 TyceHerrman

adding my own since I'm tired of consuming all my tokens by accidentally turning on thinking mode and not noticing it:

Description:

Currently, Claude Code uses Tab to toggle thinking mode on/off. This keybinding is easy to trigger accidentally during normal typing workflows. I'd like to request support for customizable keybindings in the settings configuration.

Proposed Solution

Add a keybindings section to ~/.claude/settings.json (and project-level .claude/settings.json):

{ "alwaysThinkingEnabled": false, "keybindings": { "toggleThinking": "Shift+Tab", // Future extensibility for other shortcuts "clearScreen": "Ctrl+L", "cancelRequest": "Ctrl+C" } }

Use Case

The Tab key is frequently used during:

  • Auto-completion workflows
  • Navigation between UI elements
  • Normal typing patterns (muscle memory)

Accidentally toggling thinking mode disrupts the flow. A less collision-prone keybinding (like Shift+Tab, Option+Tab, or Ctrl+T) would improve the UX.

Alternative Solutions

  1. Disable built-in shortcuts: Allow users to disable specific keybindings entirely
  2. Keybinding conflicts warning: Detect and warn about common keybinding conflicts
  3. Modifier-only shortcuts: Require modifier keys (Shift/Ctrl/Option) for all toggle actions

Additional Context

  • Current settings file location: ~/.claude/settings.json
  • Current settings support: alwaysThinkingEnabled, statusLine, etc.
  • Similar tools (VS Code, terminal emulators) provide extensive keybinding customization

mbinde avatar Nov 24 '25 18:11 mbinde

I'd also like to bind F5 to /start-server for quick server startup Shift+F5 stop server during development.

wuwenrufeng avatar Nov 28 '25 05:11 wuwenrufeng

Just adding that Ctrl+B is the default Tmux mapping for entering command mode. Claude is using it to background processes and has worked around the conflict by requiring double tap.

This means if I accidentally press Ctrl+B twice when trying to send a command to Tmux (which happens often, such as opening a new pane while a Claude command is running) the currently running Claude command will be backgrounded.

The only way to avoid this is to remap the Tmux shortcut to something else and unlearn years muscle memory.

jonatanblue avatar Dec 14 '25 19:12 jonatanblue

Use Case: Stream Deck / External Control Device Integration

I'd like to add an use case for this feature: integration with external control devices like Stream Deck, macro keyboards, or accessibility tools.

The mode-switching problem: With the current cyclic Shift+Tab toggle, you can't assign a button to jump directly to a specific mode. Pressing the same button multiple times cycles through all modes unpredictably.

What would help: Direct keyboard shortcuts to jump to specific modes, e.g.:

  • Alt+Ctrl+Shift+P β†’ Plan Mode
  • Alt+Ctrl+Shift+A β†’ Ask before edits
  • Alt+Ctrl+Shift+E β†’ Edit automatically

With configurable shortcuts, users could map Stream Deck buttons reliably and build better automation around Claude Code.

Stefan-Schmidbauer avatar Dec 16 '25 12:12 Stefan-Schmidbauer

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 Jan 17 '26 10:01 github-actions[bot]

The issue is still occurring.

fj avatar Jan 17 '26 12:01 fj

+1 on this, my use case is that I want to have a shortcut for "/resume"

gjermundgaraba avatar Feb 02 '26 08:02 gjermundgaraba

I came here after finding #16176 closed. I am in the habit of pressing Escape to get to Normal mode (vim, and even use vim bindings in my terminal)... I've accidentally interrupted claude a few times doing this and would appreciate a method to unbind Escape.

sf1tzp avatar Feb 06 '26 00:02 sf1tzp

Adding my own since it looks like every other thread is getting closed:

Escape is bound to chat:cancel (interrupt work) and confirm:no (deny permission) by default. For vim and tmux users, Escape is pressed constantly β€” exiting insert mode, canceling a tmux prefix sequence, etc. This regularly causes accidental interruptions and permission denials mid-session.

There's no way to rebind or unbind these keys.

The feature already exists

Claude Code already has a full keybinding customization system built in (as of 2.1.69):

  • ~/.claude/keybindings.json with schema support
  • Context-aware bindings (Chat, Confirmation, Global, etc.)
  • Chord support (ctrl+k ctrl+c)
  • Unbinding via null
  • Validation via /doctor
  • A built-in keybindings-help skill

It's gated behind the tengu_keybinding_customization_release feature flag, which defaults to false.

Request

Please GA (or at minimum opt-in enable) the keybinding customization feature. The implementation looks complete and production-ready. This would immediately unblock vim/tmux/screen users who are currently unable to avoid accidental Escape-triggered interruptions.

Environment

  • Claude Code 2.1.69
  • Linux, tmux, zsh, vim keybindings

G-S-Paris avatar Mar 05 '26 19:03 G-S-Paris

another possible solution....

Summary

The VS Code extension doesn't expose a command to programmatically send a message to the chat input. This prevents users from creating keybindings that open Claude Code and submit a prompt in one step.

Use Case

I want a keybinding that opens a new Claude Code tab and runs /prime automatically:

{
  "key": "ctrl+alt+c",
  "command": "runCommands",
  "args": {
    "commands": [
      "claude-vscode.editor.open",
      {
        "command": "claude-vscode.sendMessage",
        "args": { "text": "/prime" }
      }
    ]
  }
}

This isn't possible today. The extension registers open, focus, newConversation, etc. but nothing to insert or submit text.

Precedent

GitHub Copilot Chat exposes workbench.action.chat.send which accepts a message string β€” this is a well-established pattern in VS Code extensions with chat interfaces.

Proposed Commands

Command | Args | Behavior -- | -- | -- claude-vscode.sendMessage | { "text": "string" } | Insert text and submit claude-vscode.insertTextΒ (optional) | { "text": "string" } | Insert text without submitting

The first alone would cover most use cases. The second would be nice for composing prompts with multiple keybindings.

trent-40hero avatar Mar 10 '26 14:03 trent-40hero

I would love to be able to remap the behaviour of return so that it enters a naive newline instead of submitting the chat, and then bind something else to "submit chat".

LiamClarkeNZ avatar Mar 24 '26 23:03 LiamClarkeNZ

Another ctrl-g conflict: Chrome's organization-managed Gemini shortcut intercepts ctrl-g globally when Chrome is open. Since the Chrome profile is managed by my organization, I can't disable this shortcut. Being able to rebind plan mode's editor shortcut would solve this so I could actually view plans easily from Claude.

HerbWarren avatar Mar 25 '26 19:03 HerbWarren

Escape... is a killer (literally πŸ˜„). Please let us remap it. Ideally escape would just not kill the current agent process (only clear the input).

rw3iss avatar Apr 23 '26 19:04 rw3iss

+1 β€” calling out the specific ctrl+c case here since it's currently listed as explicitly non-rebindable in ~/.claude/keybindings.json (along with ctrl+d, ctrl+m).

The conflict with the universal copy shortcut is painful on Windows in particular, where ctrl+c = copy is muscle memory. I regularly lose sessions by reflex when trying to copy text from the chat.

Two acceptable resolutions:

  1. Allow ctrl+c to be remapped/unbound via keybindings.json (preferred β€” fits this issue's scope)
  2. Change the default exit/interrupt to a different combo (e.g. ctrl+shift+c) and let users opt back in to the legacy binding

Today there's no escape hatch β€” even setting "ctrl+c": null produces a /doctor error.

jdlane2 avatar May 08 '26 15:05 jdlane2

+1 on this. My specific use case: I want to bind ctrl+alt+c to /copy so I can quickly copy the last response without typing the command each time. A generic action like chat:command:/copy or chat:runCommand that accepts any slash command would cover this and many other workflows. Would love to see this land.

blackclavus avatar May 18 '26 06:05 blackclavus

Seconding this. I'm tired of accidentally cancelling a long running query by accidentally pressing escape. At least please let us rebind or remove Escape as a shortcut to cancel thinking.

SonOfSaris avatar Jul 05 '26 04:07 SonOfSaris

I constantly use escape to navigate, but then press escape one time too many and either exit claude or interrupt workflows (that might have been running for a long time, using subagents possibly).

Using the same key for navigation and interruption is a problem!

yngvark avatar Jul 08 '26 09:07 yngvark