Keybindings
Keyboard shortcut system for the CrabCode TUI. Defaults plus user customization.
What it is
CrabCode ships with a built-in keybinding engine. Every UI action (submit, undo, autocomplete, confirm, scroll, etc.) has a unique action name that can be bound to one or more key combinations. Custom entries in ~/.crabcode/keybindings.json override the defaults.
When you see this doc
- Following the keybindings tab from
/helpinside the TUI - While editing
keybindings.json
Default core bindings (selected)
Bindings are scoped by context — the same key can trigger different actions in different contexts.
Global
| Key | Action | Description |
|---|---|---|
Ctrl+C | app:interrupt | Interrupt the model; press twice to quit |
Ctrl+D | app:exit | Quit |
Ctrl+L | app:redraw | Redraw the screen |
Ctrl+T | app:toggleTodos | Toggle the todo panel |
Ctrl+O | app:toggleTranscript | Toggle transcript view |
Ctrl+R | history:search | Search session history |
Chat (input box)
| Key | Action | Description |
|---|---|---|
Enter | chat:submit | Submit input |
Esc | chat:cancel | Cancel / dismiss overlay |
↑ / ↓ | history:previous / history:next | Navigate input history |
Shift+Tab | chat:cycleMode | Cycle interaction mode (falls back to Meta+M on some Windows terminals) |
Meta+P | chat:modelPicker | Open model picker |
Meta+T | chat:thinkingToggle | Toggle thinking effort |
Meta+O | chat:fastMode | Toggle Fast mode |
Ctrl+_ or Ctrl+Shift+- | chat:undo | Undo input |
Ctrl+G or Ctrl+X Ctrl+E | chat:externalEditor | Open current prompt in $EDITOR |
Ctrl+S | chat:stash | Stash current input |
Autocomplete (popover)
| Key | Action |
|---|---|
Tab | autocomplete:accept |
Esc | autocomplete:dismiss |
↑ / ↓ | autocomplete:previous / autocomplete:next |
Browse the full default set via /help → keybindings tab inside the TUI.
Customize
Edit ~/.crabcode/keybindings.json:
{
"bindings": {
"chat:submit": ["enter", "cmd+enter"],
"chat:cancel": ["escape"],
"app:interrupt": ["ctrl+g"]
}
}{
"bindings": {
"chat:submit": ["enter", "cmd+enter"],
"chat:cancel": ["escape"],
"app:interrupt": ["ctrl+g"]
}
}Modifiers: ctrl, cmd, meta, alt, shift.
Chords (two-key sequences): ["ctrl+x ctrl+s"] — space-separated means "press these in order".
Limits
- Reserved keys cannot be rebound:
Ctrl+C,Ctrl+D,Ctrl+M(terminals deliverCtrl+Mas Enter, so any binding to it conflicts) — seesrc/keybindings/reservedShortcuts.ts - Keys swallowed by the terminal / OS:
Ctrl+Z(SIGTSTP),Ctrl+\(SIGQUIT) and similar; you can still write a binding, but the event won't reach the app - Conflict detection: when duplicate bindings are detected at startup,
crabcode --debuglogs a warning