Keybindings

Pi supports fully customizable keybindings. Configure them in your settings file under the keybindings key.

Key Format

Keys are expressed as modifier+key strings. Multiple modifiers are joined with +:

ModifierAliasDescription
ctrlcControl key
alta, meta, mAlt/Option/Meta key
shiftsShift key

Examples: ctrl+a, alt+d, ctrl+shift+k, alt+f

Special key names: enter, tab, escape, backspace, delete, up, down, left, right, home, end, pageup, pagedown, space.

All Actions

Cursor Movement

ActionDefaultDescription
cursor.leftleftMove cursor left one character
cursor.rightrightMove cursor right one character
cursor.wordLeftalt+leftMove cursor left one word
cursor.wordRightalt+rightMove cursor right one word
cursor.homehome, ctrl+aMove cursor to start of line
cursor.endend, ctrl+eMove cursor to end of line
cursor.upupMove to previous line / previous history
cursor.downdownMove to next line / next history
cursor.pageUppageupScroll up one page
cursor.pageDownpagedownScroll down one page
cursor.topctrl+homeScroll to top of output
cursor.bottomctrl+endScroll to bottom of output

Deletion

ActionDefaultDescription
delete.charLeftbackspaceDelete character before cursor
delete.charRightdeleteDelete character after cursor
delete.wordLeftalt+backspaceDelete word before cursor
delete.wordRightalt+dDelete word after cursor
delete.toLineStartctrl+uDelete from cursor to start of line
delete.toLineEndctrl+kDelete from cursor to end of line

Text Input

ActionDefaultDescription
input.submitenterSubmit the current message
input.newlineshift+enterInsert a newline
input.tabtabInsert or trigger autocomplete

Kill Ring

ActionDefaultDescription
killRing.yankctrl+yPaste from kill ring
killRing.yankPopalt+yCycle through kill ring entries
killRing.yankShiftalt+shift+yCycle kill ring in reverse

Clipboard

ActionDefaultDescription
clipboard.copyctrl+cCopy selection (or interrupt if no selection)
clipboard.pastectrl+vPaste from system clipboard

Application

ActionDefaultDescription
app.interruptctrl+cInterrupt current generation
app.quitctrl+dQuit the application
app.escapeescapeCancel / close picker / escape context
app.doubleEscapeescape,escapeTrigger double-escape action (see settings)
app.toggleHelpctrl+?Toggle help overlay

Session

ActionDefaultDescription
session.newctrl+nStart a new session
session.pickerctrl+tOpen session picker
session.forkctrl+shift+fFork the current session
session.undoctrl+zUndo last message

Models & Thinking

ActionDefaultDescription
model.cyclectrl+mCycle through enabled models
thinking.cyclectrl+shift+tCycle through thinking levels
thinking.togglectrl+shift+eToggle thinking on/off

Display

ActionDefaultDescription
display.toggleMarkdownctrl+shift+mToggle rendered markdown
display.toggleThinkingctrl+shift+hToggle thinking block visibility

Message Queue

ActionDefaultDescription
queue.clearctrl+shift+xClear the message queue
queue.togglectrl+shift+qPause/resume message queue

Selection

ActionDefaultDescription
selection.leftshift+leftExtend selection left one character
selection.rightshift+rightExtend selection right one character
selection.wordLeftalt+shift+leftExtend selection left one word
selection.wordRightalt+shift+rightExtend selection right one word
selection.homeshift+homeExtend selection to start of line
selection.endshift+endExtend selection to end of line

Session Picker

These bindings are active when the session picker is open:

ActionDefaultDescription
picker.upupMove selection up
picker.downdownMove selection down
picker.selectenterOpen selected session
picker.deletectrl+backspaceDelete selected session
picker.closeescapeClose the picker
picker.filter(any character)Type to filter sessions

Custom Configuration

Add a keybindings object to your settings file. Each key is an action name and each value is a key string or array of key strings:

{
  "keybindings": {
    "input.submit": "ctrl+enter",
    "input.newline": "enter",
    "cursor.home": ["home", "ctrl+a"],
    "cursor.end": ["end", "ctrl+e"],
    "app.quit": "ctrl+q",
    "session.new": "ctrl+shift+n"
  }
}

Emacs Keybindings

An Emacs-inspired configuration:

{
  "keybindings": {
    "cursor.left": "ctrl+b",
    "cursor.right": "ctrl+f",
    "cursor.wordLeft": "alt+b",
    "cursor.wordRight": "alt+f",
    "cursor.home": "ctrl+a",
    "cursor.end": "ctrl+e",
    "cursor.up": "ctrl+p",
    "cursor.down": "ctrl+n",
    "delete.charLeft": "backspace",
    "delete.charRight": "ctrl+d",
    "delete.wordLeft": "alt+backspace",
    "delete.wordRight": "alt+d",
    "delete.toLineStart": "ctrl+u",
    "delete.toLineEnd": "ctrl+k",
    "killRing.yank": "ctrl+y",
    "killRing.yankPop": "alt+y"
  }
}

Vim Keybindings

A Vim-inspired configuration (for insert-mode-like behavior):

{
  "keybindings": {
    "cursor.left": "left",
    "cursor.right": "right",
    "cursor.wordLeft": "ctrl+left",
    "cursor.wordRight": "ctrl+right",
    "cursor.home": "home",
    "cursor.end": "end",
    "cursor.up": "up",
    "cursor.down": "down",
    "delete.charLeft": "backspace",
    "delete.charRight": "delete",
    "delete.wordLeft": "ctrl+w",
    "delete.toLineEnd": "ctrl+k",
    "delete.toLineStart": "ctrl+u",
    "app.escape": "escape",
    "input.submit": "enter"
  }
}
Tip

Custom keybindings completely replace the default for that action. If you want multiple keys for one action, use an array.