Skip to content

How Keybindings Work

Keybindings in Claude Code are context-sensitive sequences that trigger actions. This section explains the core concepts: contexts, chord sequences, feature gating, and reserved keys.

Keybindings are scoped to contexts—UI states where specific keys should be active. Each context has its own binding table, and Claude Code activates the appropriate context based on what’s focused.

ContextWhen ActiveScope
GlobalAlwaysEverywhere in the app
ChatInput field has focusChat prompt entry
AutocompleteSuggestion menu is visibleWhile typing completions
ConfirmationDialog shownPermission, choice, confirmation prompts
HelpHelp overlay openHelp view
TranscriptTranscript view focusedHistory/transcript panel
HistorySearchHistory search active (ctrl+r)Search mode only
TaskTask/agent running foregroundWhile task executes
ThemePickerTheme picker displayedTheme selection modal
SettingsSettings menu openSettings panel
TabsTab navigation activeTab switching mode
AttachmentsSelecting image attachmentsAttachment picker
FooterFooter indicators focusedTask/team/diff indicator nav
MessageSelectorRewind dialog openMessage selection (rewind feature)
DiffDialogDiff viewer openFile diff display
ModelPickerModel selection dialog openModel selection UI
SelectGeneric list/choice componentSelect menus, permission lists
MessageActionsMessage action menu open (gated)Action selection on messages

Some bindings use chord sequences—a series of key presses in sequence, not simultaneously.

  • ctrl+x ctrl+k — Press Ctrl+X, release, then press Ctrl+K. Used to avoid shadowing readline editing keys (ctrl+a, ctrl+b, etc.).
  • ctrl+x ctrl+e — Standard readline binding for edit-and-execute-command.

Chords are entered by pressing the first key combination, releasing it completely, then pressing the next. The application tracks the state between steps and executes the action only when the full sequence is recognized.

Some bindings are feature-gated—they only activate if a feature flag is enabled.

BindingFeature GateCondition
ctrl+shift+f / cmd+shift+fQUICK_SEARCHGlobal search enabled
ctrl+shift+p / cmd+shift+pQUICK_SEARCHQuick open enabled
meta+jTERMINAL_PANELIntegrated terminal enabled
ctrl+shift+bKAIROS or KAIROS_BRIEFBrief mode available
shift+up (Chat)MESSAGE_ACTIONSMessage actions enabled
space (Chat)VOICE_MODEVoice mode enabled
MessageActions contextMESSAGE_ACTIONSMessage action menu

If a feature gate is not met, the keybinding is not registered. This prevents conflicts with other uses of the key and keeps the keybinding registry clean.

Certain keys cannot be rebound or are intercepted by the OS/terminal:

KeyActionReason
ctrl+cInterruptHardcoded interrupt mechanism; used for double-tap exit
ctrl+dExitHardcoded exit mechanism; distinct from ctrl+c
ctrl+m(same as Enter)Terminals send CR for both; cannot distinguish

Attempting to rebind these in keybindings.json will show an error.

KeyActionSeverity
ctrl+zProcess suspend (SIGTSTP)Warning
ctrl+\Terminal quit (SIGQUIT)Error

These are intercepted by the terminal/shell before reaching Claude Code.

KeyActionSeverity
cmd+cSystem copyError
cmd+vSystem pasteError
cmd+xSystem cutError
cmd+qQuit applicationError
cmd+wClose windowError
cmd+tabApp switcherError
cmd+spaceSpotlightError

macOS intercepts all cmd+* combinations; they do not reach Claude Code.

User keybindings are stored in ~/.claude/keybindings.json and override the shipped defaults.

{
"Global": {
"ctrl+alt+x": "app:customAction"
},
"Chat": {
"ctrl+enter": "chat:submit",
"alt+up": "history:previous"
}
}
  1. Context names must match one of the 18 valid contexts (case-sensitive).
  2. Keys follow the chord syntax: modifier+key or modifier+key modifier+key.
  3. Actions must be valid action identifiers (e.g., chat:submit, app:redraw).
  4. Last-wins: If a key is bound in both default and user config, user binding takes precedence.
  5. Null unbinding: Setting a key to null removes it entirely (disables that binding).
ModifierPlatformsExample
ctrlWindows, Linuxctrl+a
altWindows, Linuxalt+a
metaAllmeta+p (equivalent to cmd on macOS, alt on Linux/Windows)
cmdmacOS (kitty protocol only)cmd+c
shiftAllshift+tab
  • meta is a portable alias: cmd on macOS, alt on Windows/Linux (when using kitty-protocol terminals).
  • cmd bindings only work on terminals using the kitty keyboard protocol (kitty, WezTerm, ghostty, iTerm2).
  • ctrl+alt and shift+alt are platform-dependent; test on your target platform.

Chord sequences are limited by terminal capabilities:

  • Modifier-only chords (e.g., shift+tab) may fail on Windows Terminal without VT mode (see Platform Quirks).
  • Two-step chords work reliably across platforms; deeper sequences are not recommended.

Actions are namespaced by context or feature:

NamespaceExamples
app:*app:interrupt, app:exit, app:redraw, app:globalSearch
chat:*chat:submit, chat:cancel, chat:modelPicker, chat:undo
history:*history:search, history:previous, history:next
confirm:*confirm:yes, confirm:no, confirm:toggle
select:*select:previous, select:next, select:accept
autocomplete:*autocomplete:accept, autocomplete:dismiss
voice:*voice:pushToTalk
diff:*diff:nextSource, diff:previousFile
message:*messageActions:next, messageActions:prev
scroll:*scroll:pageUp, scroll:pageDown, scroll:top
tabs:*tabs:next, tabs:previous
settings:*settings:close, settings:search
task:*task:background

← Back to Keybindings/README.md