Skip to content

Custom Keybindings

Customize CodeBuddy Code keyboard shortcuts through the keybindings configuration file.

CodeBuddy Code supports custom keyboard shortcuts. Run the /keybindings command to create or open the configuration file located at ~/.codebuddy/keybindings.json.


Configuration File

The keybindings configuration file is an object containing a bindings array. Each block specifies a context and key-to-action mappings.

Changes to the keybindings file are automatically detected and applied without restarting CodeBuddy Code.

FieldDescription
$schemaOptional, JSON Schema URL for editor autocompletion
$docsOptional, documentation URL
bindingsArray of binding blocks organized by context

The following example binds Ctrl+E to the external editor in the Chat context and unbinds Ctrl+U:

json
{
  "$schema": "https://code.codebuddy.ai/schemas/keybindings.json",
  "$docs": "https://code.codebuddy.ai/docs/keybindings",
  "bindings": [
    {
      "context": "Chat",
      "bindings": {
        "ctrl+e": "chat:externalEditor",
        "ctrl+u": null
      }
    }
  ]
}

Contexts

Each binding block specifies a context that determines when the shortcuts are active:

ContextDescription
GlobalActive anywhere in the application
ChatWhen the chat input box has focus
InputBoxWhen a text input box is active
TerminalWhen the terminal view is active
AutocompleteWhen the autocomplete menu is displayed
ConfirmationWhen a confirmation/permission dialog is displayed
HistorySearchWhen searching command history (Ctrl+R)
TaskWhen a task/agent is running in the foreground
SettingsWhen the settings panel is open
CommandPaletteWhen the command palette is open
SelectWhen a select/list component has focus
PermissionDialogWhen a tool permission dialog is displayed
HelpWhen the help page is open
PluginWhen the plugin dialog is open
DiffDialogWhen the diff dialog is open
MessageSelectorWhen the message selector (rewind) is open

Available Actions

Actions follow the namespace:action format, such as chat:submit to send a message or app:toggleTodos to toggle the todo list. Each context has specific available actions.

App Actions

Available in the Global context:

ActionDefault KeyDescription
app:interruptCtrl+CInterrupt the current operation
app:exitCtrl+DExit CodeBuddy Code
app:redrawCtrl+LRefresh the terminal screen
app:toggleTodosCtrl+TToggle the todo list
app:toggleTranscriptCtrl+OToggle verbose transcript
app:toggleSidebarCmd+BToggle sidebar (Web UI)
app:toggleTerminalCmd+JToggle terminal (Web UI)
app:commandPaletteCmd+Shift+P / Ctrl+Shift+POpen command palette (Web UI)
app:newChatCmd+NNew conversation (Web UI)
app:settingsCmd+,Open settings (Web UI)
app:focusInputCmd+LFocus input box (Web UI)

History Actions

For navigating command history:

ActionDefault KeyDescription
history:searchCtrl+ROpen history search
history:previousUpPrevious history entry
history:nextDownNext history entry

Chat Actions

Available in the Chat context:

ActionDefault KeyDescription
chat:cancelEscapeCancel current input
chat:submitEnterSend message
chat:killAgentsCtrl+X Ctrl+KKill all background agents
chat:cycleModeShift+Tab*Cycle permission mode
chat:modelPickerMeta+POpen model picker
chat:thinkingToggleMeta+TToggle extended thinking
chat:undoCtrl+_, Ctrl+Shift+-Undo
chat:externalEditorCtrl+G, Ctrl+X Ctrl+EOpen in external editor
chat:stashCtrl+SStash current input
chat:imagePasteCtrl+V (Windows: Alt+V)Paste image

*On Windows without VT mode (Node <24.2.0/<22.17.0, Bun <1.2.23), defaults to Meta+M.

Autocomplete Actions

Available in the Autocomplete context:

ActionDefault KeyDescription
autocomplete:acceptTabAccept suggestion
autocomplete:dismissEscapeDismiss menu
autocomplete:previousUpPrevious item
autocomplete:nextDownNext item

Confirmation Actions

Available in the Confirmation context:

ActionDefault KeyDescription
confirm:yesY, EnterConfirm
confirm:noN, EscapeCancel
confirm:previousUpPrevious item
confirm:nextDownNext item
confirm:toggleSpaceToggle selection
confirm:toggleExplanationCtrl+EToggle permission explanation
permission:toggleDebugCtrl+DToggle permission debug info

Transcript Actions

Available in the Transcript context:

ActionDefault KeyDescription
transcript:toggleShowAllCtrl+EToggle show all content
transcript:exitQ, Ctrl+C, EscapeExit transcript view

History Search Actions

Available in the HistorySearch context:

ActionDefault KeyDescription
historySearch:nextCtrl+RNext match
historySearch:acceptEscape, TabAccept selection
historySearch:cancelCtrl+CCancel search
historySearch:executeEnterExecute selected command

Task Actions

Available in the Task context:

ActionDefault KeyDescription
task:backgroundCtrl+BSend current task to background

Help Actions

Available in the Help context:

ActionDefault KeyDescription
help:dismissEscapeDismiss help menu

Settings Actions

Available in the Settings context:

ActionDefault KeyDescription
settings:search/Enter search mode
settings:closeEnterSave and close settings panel

Select List Actions

Available in the Select context:

ActionDefault KeyDescription
select:nextDown, J, Ctrl+NNext item
select:previousUp, K, Ctrl+PPrevious item
select:acceptEnterConfirm selection
select:cancelEscapeCancel selection

Command Palette Actions

Available in the CommandPalette context:

ActionDefault KeyDescription
commandPalette:previousUpPrevious item
commandPalette:nextDownNext item
commandPalette:executeEnterExecute command
commandPalette:closeEscapeClose palette

Diff Actions

Available in the DiffDialog context:

ActionDefault KeyDescription
diff:dismissEscapeDismiss diff viewer
diff:previousFileUpPrevious file
diff:nextFileDownNext file
diff:viewDetailsEnterView details

Message Selector Actions

Available in the MessageSelector context:

ActionDefault KeyDescription
messageSelector:upUp, K, Ctrl+PMove up
messageSelector:downDown, J, Ctrl+NMove down
messageSelector:topShift+UpJump to top
messageSelector:bottomShift+DownJump to bottom
messageSelector:selectEnterSelect message

Plugin Actions

Available in the Plugin context:

ActionDefault KeyDescription
plugin:toggleSpaceToggle plugin selection
plugin:installIInstall selected plugin

Key Syntax

Modifiers

Combine modifiers using the + separator:

  • ctrl or control — Control key
  • alt, opt, or option — Alt/Option key
  • shift — Shift key
  • meta, cmd, or command — Meta/Command key

Examples:

ctrl+k          Single modifier + key
shift+tab       Shift + Tab
meta+p          Command/Meta + P
ctrl+shift+c    Multiple modifiers

Chords

Chords are consecutive key combinations separated by spaces:

ctrl+x ctrl+k   Press Ctrl+X, release, then press Ctrl+K
ctrl+x ctrl+e   Press Ctrl+X, release, then press Ctrl+E

Chords have a 1000ms timeout. If the second step is not completed before the timeout, the chord is cancelled.

Special Keys

  • escape or esc — Escape key
  • enter or return — Enter key
  • tab — Tab key
  • space — Space key
  • up, down, left, right — Arrow keys
  • backspace, delete — Delete keys

Unbinding Default Shortcuts

Set an action to null to unbind a default shortcut:

json
{
  "bindings": [
    {
      "context": "Chat",
      "bindings": {
        "ctrl+s": null
      }
    }
  ]
}

After unbinding all chord combinations, the prefix key can be used as a single-key binding:

json
{
  "bindings": [
    {
      "context": "Chat",
      "bindings": {
        "ctrl+x ctrl+k": null,
        "ctrl+x ctrl+e": null,
        "ctrl+x": "chat:newline"
      }
    }
  ]
}

If only some chord sequences are unbound, pressing the prefix key will still enter chord waiting mode.


Reserved Shortcuts

The following shortcuts cannot be rebound:

ShortcutReason
Ctrl+CHard-coded interrupt/cancel
Ctrl+DHard-coded exit
Ctrl+MEquivalent to Enter in terminals (both send CR)

Terminal Conflicts

Some shortcuts may conflict with terminal multiplexers:

ShortcutConflict
Ctrl+Btmux prefix key (press twice to send)
Ctrl+AGNU screen prefix key
Ctrl+ZUnix process suspend (SIGTSTP)

Web UI Visual Configuration

In addition to editing the JSON file, you can manage shortcuts through the visual interface in the Web UI:

  1. Click Keybindings in the sidebar navigation, or use the URL #/keybindings
  2. Use the search box to filter shortcuts by name, key, or context
  3. Click the edit button (pencil icon) to record a new shortcut combination
  4. The recording dialog shows real-time conflict detection
  5. User-customized bindings are marked with a highlighted left border
  6. Click the reset button to restore individual bindings to their defaults

REST API

The Web UI manages shortcuts through the REST API:

EndpointMethodDescription
/api/v1/keybindingsGETGet all shortcuts (default + user + merged)
/api/v1/keybindingsPUTSave user shortcut configuration
/api/v1/keybindings/resetPOSTReset to defaults (delete user configuration)
/api/v1/keybindings/validatePOSTValidate configuration (without saving)

Validation

CodeBuddy Code validates your keybinding configuration and displays warnings for the following:

  • Parse errors (invalid JSON or structure)
  • Invalid context names
  • Reserved shortcut conflicts
  • Terminal multiplexer conflicts
  • Duplicate bindings within the same context