Back to Pi Mono

Keybindings

packages/coding-agent/docs/keybindings.md

0.73.08.7 KB
Original Source

Keybindings

All keyboard shortcuts can be customized via ~/.pi/agent/keybindings.json. Each action can be bound to one or more keys.

The config file uses the same namespaced keybinding ids that pi uses internally and that extension authors use in keyHint() and injected keybindings managers.

Older configs using pre-namespaced ids such as cursorUp or expandTools are migrated automatically to the namespaced ids on startup.

After editing keybindings.json, run /reload in pi to apply the changes without restarting the session.

Key Format

modifier+key where modifiers are ctrl, shift, alt (combinable) and keys are:

  • Letters: a-z
  • Digits: 0-9
  • Special: escape, esc, enter, return, tab, space, backspace, delete, insert, clear, home, end, pageUp, pageDown, up, down, left, right
  • Function: f1-f12
  • Symbols: `, -, =, [, ], \, ;, ', ,, ., /, !, @, #, $, %, ^, &, *, (, ), _, +, |, ~, {, }, :, <, >, ?

Modifier combinations: ctrl+shift+x, alt+ctrl+x, ctrl+shift+alt+x, ctrl+1, etc.

All Actions

TUI Editor Cursor Movement

Keybinding idDefaultDescription
tui.editor.cursorUpupMove cursor up
tui.editor.cursorDowndownMove cursor down
tui.editor.cursorLeftleft, ctrl+bMove cursor left
tui.editor.cursorRightright, ctrl+fMove cursor right
tui.editor.cursorWordLeftalt+left, ctrl+left, alt+bMove cursor word left
tui.editor.cursorWordRightalt+right, ctrl+right, alt+fMove cursor word right
tui.editor.cursorLineStarthome, ctrl+aMove to line start
tui.editor.cursorLineEndend, ctrl+eMove to line end
tui.editor.jumpForwardctrl+]Jump forward to character
tui.editor.jumpBackwardctrl+alt+]Jump backward to character
tui.editor.pageUppageUpScroll up by page
tui.editor.pageDownpageDownScroll down by page

TUI Editor Deletion

Keybinding idDefaultDescription
tui.editor.deleteCharBackwardbackspaceDelete character backward
tui.editor.deleteCharForwarddelete, ctrl+dDelete character forward
tui.editor.deleteWordBackwardctrl+w, alt+backspaceDelete word backward
tui.editor.deleteWordForwardalt+d, alt+deleteDelete word forward
tui.editor.deleteToLineStartctrl+uDelete to line start
tui.editor.deleteToLineEndctrl+kDelete to line end

TUI Input

Keybinding idDefaultDescription
tui.input.newLineshift+enterInsert new line
tui.input.submitenterSubmit input
tui.input.tabtabTab / autocomplete

TUI Kill Ring

Keybinding idDefaultDescription
tui.editor.yankctrl+yPaste most recently deleted text
tui.editor.yankPopalt+yCycle through deleted text after yank
tui.editor.undoctrl+-Undo last edit

TUI Clipboard and Selection

Keybinding idDefaultDescription
tui.input.copyctrl+cCopy selection
tui.select.upupMove selection up
tui.select.downdownMove selection down
tui.select.pageUppageUpPage up in list
tui.select.pageDownpageDownPage down in list
tui.select.confirmenterConfirm selection
tui.select.cancelescape, ctrl+cCancel selection

Application

Keybinding idDefaultDescription
app.interruptescapeCancel / abort
app.clearctrl+cClear editor
app.exitctrl+dExit (when editor empty)
app.suspendctrl+z (none on Windows)Suspend to background
app.editor.externalctrl+gOpen in external editor ($VISUAL or $EDITOR)
app.clipboard.pasteImagectrl+v (alt+v on Windows)Paste image from clipboard

Sessions

Keybinding idDefaultDescription
app.session.new(none)Start a new session (/new)
app.session.tree(none)Open session tree navigator (/tree)
app.session.fork(none)Fork current session (/fork)
app.session.resume(none)Open session resume picker (/resume)
app.session.togglePathctrl+pToggle path display
app.session.toggleSortctrl+sToggle sort mode
app.session.toggleNamedFilterctrl+nToggle named-only filter
app.session.renamectrl+rRename session
app.session.deletectrl+dDelete session
app.session.deleteNoninvasivectrl+backspaceDelete session when query is empty

Models and Thinking

Keybinding idDefaultDescription
app.model.selectctrl+lOpen model selector
app.model.cycleForwardctrl+pCycle to next model
app.model.cycleBackwardshift+ctrl+pCycle to previous model
app.thinking.cycleshift+tabCycle thinking level
app.thinking.togglectrl+tCollapse or expand thinking blocks

Display and Message Queue

Keybinding idDefaultDescription
app.tools.expandctrl+oCollapse or expand tool output
app.message.followUpalt+enterQueue follow-up message
app.message.dequeuealt+upRestore queued messages to editor

Tree Navigation

Keybinding idDefaultDescription
app.tree.foldOrUpctrl+left, alt+leftFold current branch segment, or jump to the previous segment start
app.tree.unfoldOrDownctrl+right, alt+rightUnfold current branch segment, or jump to the next segment start or branch end
app.tree.editLabelshift+lEdit the label on the selected tree node
app.tree.toggleLabelTimestampshift+tToggle label timestamps in the tree
app.tree.filter.defaultctrl+dSet tree filter to default view
app.tree.filter.noToolsctrl+tToggle tree filter that hides tool results
app.tree.filter.userOnlyctrl+uToggle tree filter that shows only user messages
app.tree.filter.labeledOnlyctrl+lToggle tree filter that shows only labeled entries
app.tree.filter.allctrl+aToggle tree filter that shows all entries
app.tree.filter.cycleForwardctrl+oCycle tree filter forward
app.tree.filter.cycleBackwardshift+ctrl+oCycle tree filter backward

Scoped Models Selector

Used inside the scoped models selector (opened via /scoped-models).

Keybinding idDefaultDescription
app.models.savectrl+sSave current model selection to settings
app.models.enableAllctrl+aEnable all models (or all matching the current search)
app.models.clearAllctrl+xClear all models (or all matching the current search)
app.models.toggleProviderctrl+pToggle all models for the current provider
app.models.reorderUpalt+upMove the selected model up in the cycle order
app.models.reorderDownalt+downMove the selected model down in the cycle order

Custom Configuration

Create ~/.pi/agent/keybindings.json:

json
{
  "tui.editor.cursorUp": ["up", "ctrl+p"],
  "tui.editor.cursorDown": ["down", "ctrl+n"],
  "tui.editor.deleteWordBackward": ["ctrl+w", "alt+backspace"]
}

Each action can have a single key or an array of keys. User config overrides defaults.

On native Windows, app.suspend has no default binding because Windows terminals do not support Unix job control. If you bind it manually, pi shows a status message instead of suspending. In WSL, the normal Linux ctrl+z/fg behavior still applies.

Emacs Example

json
{
  "tui.editor.cursorUp": ["up", "ctrl+p"],
  "tui.editor.cursorDown": ["down", "ctrl+n"],
  "tui.editor.cursorLeft": ["left", "ctrl+b"],
  "tui.editor.cursorRight": ["right", "ctrl+f"],
  "tui.editor.cursorWordLeft": ["alt+left", "alt+b"],
  "tui.editor.cursorWordRight": ["alt+right", "alt+f"],
  "tui.editor.deleteCharForward": ["delete", "ctrl+d"],
  "tui.editor.deleteCharBackward": ["backspace", "ctrl+h"],
  "tui.input.newLine": ["shift+enter", "ctrl+j"]
}

Vim Example

json
{
  "tui.editor.cursorUp": ["up", "alt+k"],
  "tui.editor.cursorDown": ["down", "alt+j"],
  "tui.editor.cursorLeft": ["left", "alt+h"],
  "tui.editor.cursorRight": ["right", "alt+l"],
  "tui.editor.cursorWordLeft": ["alt+left", "alt+b"],
  "tui.editor.cursorWordRight": ["alt+right", "alt+w"]
}