Pi Agent Keyboard Shortcut Customization
Pi Agent's shortcuts are fully customizable. This chapter introduces the default shortcut configuration and how to create your own shortcut scheme.
Configuration file
The shortcut configuration file is located at ~/.pi/agent/keybindings.json.
After modification, run /reload to take effect, no restart needed.
Shortcut format
The shortcut format is modifier+key; modifiers include ctrl, shift, alt, super, and can be combined.
Among these, super requires the terminal to report that modifier separately (usually relying on the Kitty keyboard protocol) to take effect; it may not work in unsupported terminals.
Supported keys fall into the following categories:
| Category | Value | Example |
|---|---|---|
| Common Format Patterns | a-z | ctrl+b、alt+d |
| Digit | 0-9 | alt+1 |
| Function keys | f1-f12 | f2 |
| Arrow keys | up、down、left、right | alt+left |
| Special keys | escape、enter、tab、space、backspace、delete、home、end、pageUp、pageDown | shift+enter |
| sign before positive numbers | ` - = [ ] ; ' , . / etc. | ctrl+]、ctrl+- |
Modifiers in the config file use lowercase (e.g., ctrl+shift+p); the body tables conventionally write Shift+Ctrl+P; the two are equivalent.
Default shortcut quick reference
The following four tables list factory default bindings by functional area, serving as a reference baseline for customization.
This chapter only lists common bindings; ctrl+], ctrl+alt+], pageUp/pageDown, alt+y, ctrl+z, and session selector keys are not included; the complete list can be viewed with /hotkeys in interactive mode.
Editor operations
This group only takes effect in the edit area, handling cursor movement and text deletion.
| Operation | Default Shortcut | Description | Mode |
|---|---|---|---|
| Move cursor up | up | Move the cursor up in the editor; when already at the top, browse earlier history instead | Editor area |
| Move cursor down | down | Move the cursor down in the editor; when already at the bottom, browse newer history instead | Editor area |
| Move cursor left | left, ctrl+b | Move one character left | Editor area |
| Move cursor right | right, ctrl+f | Move one character right | Editor area |
| Move left by word | alt+left, ctrl+left, alt+b | Move one word left | Editor area |
| Move right by word | alt+right, ctrl+right, alt+f | Move one word right | Editor area |
| Line start | home, ctrl+home, ctrl+a | Jump to line start | Editor area |
| Line end | end, ctrl+end, ctrl+e | Jump to line end | Editor area |
| Delete previous character | backspace | Delete the character before the cursor | Editor area |
| Delete next character | delete, ctrl+d | Delete the character after the cursor (an edit action) | Editor area |
| Delete previous word | ctrl+w, alt+backspace | Delete the word before the cursor | Editor area |
| Delete next word | alt+d, alt+delete | Delete the word after the cursor | Editor area |
| Delete to line start | ctrl+u | Delete content from the cursor to the beginning of the line | Editor area |
| Delete to line end | ctrl+k | Delete content from the cursor to the end of the line | Editor area |
Input and submission
This group controls how content wraps, completes, and submits, also acting on the edit area.
| Operation | Default Shortcut | Description | Mode |
|---|---|---|---|
| Newline | shift+enter, ctrl+j | Insert newline | Editor area |
| Submit | enter | Send input content | Editor area |
| Tab/auto-completion | tab | Trigger path auto-completion | Editor area |
| Undo | ctrl+- | Undo the last edit | Editor area |
| Paste deleted text | ctrl+y | Paste recently deleted text | Editor area |
App and messages
This group handles interrupting the AI, managing edit area content, and the message queue; most do not depend on edit area focus.
| Operation | Default Shortcut | Description | Mode |
|---|---|---|---|
| Interrupt/cancel | escape | Cancel the current AI operation | Global |
| Clear the edit area | ctrl+c | Clear the edit area content; press again to exit the program | Editor area |
| Exit | ctrl+d | Exit the program when the edit area is empty (an app.exit action, separate from the delete actions in the table above) | Editor area |
| External editor | ctrl+g | Edit the current input in an external editor | Editor area |
| Paste images | ctrl+v | Paste an image from the clipboard (Windows: alt+v) | Editor area |
| Copy AI reply | ctrl+x | Copy the last AI message | Editor area |
| Send a follow-up message | alt+enter | Queue the message for follow-up | Editor area |
| Retrieve queued messages | alt+up | Retrieve queued messages back to the editor | Editor area |
Models and reasoning
This group is used to switch models and adjust reasoning behavior, available at any time during a conversation.
| Operation | Default Shortcut | Description | Mode |
|---|---|---|---|
| Model selector | ctrl+l | Open the model picker | Global |
| Switch model forward | ctrl+p | Switch to the next model | Global |
| Switch model backward | shift+ctrl+p | Switch to the previous model | Global |
| Switch reasoning level | shift+tab | Cycle reasoning levels | Editor area |
| Toggle reasoning display | ctrl+t | Expand/collapse AI reasoning process | Global |
| Toggle tool output | ctrl+o | Expand/collapse tool call output | Global (in the /tree browser, toggles filter mode) |
Custom keybinding configuration
Just list the actions you want to override in keybindings.json; actions not listed keep their defaults.
Set a binding's value to an empty array, e.g. "tui.altScreen.pageUp": [], to completely disable that keybinding.
Emacs style
If you're used to Emacs keybindings, you can use the following configuration in ~/.pi/agent/keybindings.json:
Example
{
"tui.editor.historyPrevious": "ctrl+p",
"tui.editor.historyNext": "ctrl+n",
"tui.editor.cursorUp": ["up"],
"tui.editor.cursorDown": ["down"],
"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"]
}
The historyPrevious and historyNext history actions have no bindings by default; they are specifically for browsing commit history and also cycle through history entries in multiline input.
After binding ctrl+p to history previous, when the editor area has focus Ctrl+P is taken over by this history binding, and switching models forward temporarily doesn't work in this scenario.
Ctrl+P in selection lists such as the model picker is unaffected and still performs the picker's own action.
Vim style
If you're used to Vim's arrow keys, you can use the following configuration:
Example
{
"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"]
}
alt+h/j/k/l is chosen here to avoid built-in bindings such as Ctrl+H/Ctrl+D, hence the Alt-based keys.
Pi Agent's keybinding configuration overrides the defaults.
Each action can be bound to one or more keybindings.
Actions not listed in the configuration file keep their default keybindings.
View all keyboard shortcuts
In interactive mode, use the following command to show all keybindings and their current bindings:
/hotkeys
Sample output:
编辑器
tui.editor.cursorUp up
tui.editor.cursorDown down
tui.editor.cursorWordLeft alt+left, ctrl+left, alt+b
tui.input.submit enter
模型与推理
app.model.select ctrl+l
app.model.cycleForward ctrl+p
app.model.cycleBackward shift+ctrl+p
Keybinding actions use namespaced ids in the format "module.action".
Unnamespaced ids in older config files (such as cursorUp, expandTools) are automatically migrated to namespaced ids at startup, no manual changes needed.
This command lists all available keybinding actions, current bindings, and their functional area, making it the best way to troubleshoot keybinding conflicts or find a specific function's keybinding.
Keys in fullscreen mode
When started with --tui-mode fullscreen, the transcript scrolls within the terminal viewport while the editor area and bottom status area stay fixed.
In this mode, home, end, pageUp, and pageDown without modifiers scroll the transcript, while their ctrl variants are still used by the editor.
In normal mode, both sets of keys act on the editor.
Fullscreen mode also has dedicated search and navigation: ctrl+shift+f searches the transcript, ctrl+up and ctrl+down jump between the previous and next marked messages.
Fullscreen scroll bindings take priority over editor bindings and can still be adjusted via normal action bindings.
| Key | Normal mode | Fullscreen mode |
|---|---|---|
| home、end | Editor | Scroll transcript |
| ctrl+home、ctrl+end | Editor | Editor |
| pageUp、pageDown | Editor | Scroll transcript |
| ctrl+pageUp、ctrl+pageDown | Editor | Editor |
| ctrl+shift+f (ctrl+f on Windows/WSL) | Not effective | Search transcript |
| ctrl+up、ctrl+down | Not effective | Jump to previous/next marked message |