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/reloadto take effect without restarting.
Shortcut Format
The shortcut format isModifier+KeyModifier keys include ctrl, shift, alt, and super, which can be combined.
Among them, super only works if the terminal can report this modifier key separately (usually relying on the Kitty keyboard protocol); it may not work in unsupported terminals.
Supported keys are divided into the following categories:
| Category | Value | Example |
|---|---|---|
| Letters | a-z | ctrl+b、alt+d |
| Numbers | 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 |
| Symbols | ` - = [ ] ; ' , . / etc. | ctrl+]、ctrl+- |
In the configuration file, modifier keys are written in lowercase (e.g., ctrl+shift+p), while tables in the text are usually written as Shift+Ctrl+P; the two are equivalent.
Default Shortcut Quick Reference
The following four tables list the factory default bindings by functional area, serving as a 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 full list can be viewed with /hotkeys in interactive mode.
Editor Operations
This group only takes effect in the editor area, handling cursor movement and text deletion.
| Operation | Default Shortcut | Description | Mode |
|---|---|---|---|
| Move cursor up | up | Move the cursor up in the editor; when at the top, browse earlier history instead. | Editor area |
| Move cursor down | down | Move the cursor down in the editor; when at the bottom, browse newer history instead. | Editor area |
| Move cursor left | left, ctrl+b | Move left by one character. | Editor area |
| Move cursor right | right, ctrl+f | Move right by one character. | Editor area |
| Move left by word | alt+left, ctrl+left, alt+b | Move left by one word. | Editor area |
| Move right by word | alt+right, ctrl+right, alt+f | Move right by one word. | Editor area |
| Start of line | home, ctrl+home, ctrl+a | Jump to the start of the line. | Editor area |
| End of line | end, ctrl+end, ctrl+e | Jump to the end of the line. | 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 editing 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 start of line | ctrl+u | Delete content from the cursor to the start of the line. | Editor area |
| Delete to end of line | ctrl+k | Delete content from the cursor to the end of the line. | Editor area |
Input and Submission
This group controls how content is wrapped, completed, and submitted, and also applies to the editor area.
| Operation | Default Shortcut | Description | Mode |
|---|---|---|---|
| Newline | shift+enter, ctrl+j | Insert a newline character. | Editor area |
| Submit | enter | Send the input content. | Editor area |
| Tab / Auto-completion | tab | Trigger path auto-completion. | Editor area |
| Undo | ctrl+- | Undo the last editing step. | Editor area |
| Paste deleted text | ctrl+y | Paste the most recently deleted text. | Editor area |
Application and Messages
This group is responsible for interrupting the AI, managing editor content and the message queue, and mostly does not depend on editor focus.
| Operation | Default Shortcut | Description | Mode |
|---|---|---|---|
| Interrupt / Cancel | escape | Cancel the current AI operation. | Global |
| Clear editor area | ctrl+c | Clear the editor content; press again to exit the program. | Editor area |
| Exit | ctrl+d | Exit the program when the editor is empty (this belongs to the app.exit action, separate from the deletion actions in the previous table). | Editor area |
| External editor | ctrl+g | Edit the current input in an external editor. | Editor area |
| Paste image | 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 follow-up message | alt+enter | Queue the message into the follow-up queue. | Editor area |
| Retrieve queued message | alt+up | Bring the queued message back to the editor. | Editor area |
Model and Reasoning
This group is used to switch models and adjust reasoning behavior, and is available at any time during a conversation.
| Operation | Default Shortcut | Description | Mode |
|---|---|---|---|
| Model selector | ctrl+l | Open the model selector. | Global |
| Switch model forward | ctrl+p | Switch to the next model. | Global |
| Switch model backward | shift+ctrl+p | Switch to the previous model. | Global |
| Toggle reasoning level | shift+tab | Cycle through reasoning levels. | Editor area |
| Toggle reasoning display | ctrl+t | Expand/collapse the AI reasoning process. | Global |
| Toggle tool output | ctrl+o | Expand/collapse tool call output. | Global (in the /tree browser, toggles filter mode) |
Custom Shortcut Configuration
Simply list the operations you want to override in keybindings.json; operations not listed retain their defaults.
Set a binding's value to an empty array, for example"tui.altScreen.pageUp": []to completely disable that shortcut.
Emacs Style
If you are used to Emacs shortcuts, you can~/.pi/agent/keybindings.jsonuse the following configuration in:
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 two history actions historyPrevious and historyNext are not bound by default; they are specifically for browsing submission history, and they also switch history entries in multiline input.
After binding ctrl+p to the previous history item, when the editor area gains focus, Ctrl+P will be preempted by this history binding, and forward model switching temporarily becomes ineffective in this scenario.
Ctrl+P in selection lists such as the model selector is not affected and still performs the selector's own action.
Vim Style
If you are 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"]
}
Here, alt+h/j/k/l are chosen to avoid built-in bindings such as Ctrl+H and Ctrl+D, so the Alt series is used.
Pi Agent's shortcut configuration overrides the default values.
Each operation can be bound to one or more shortcuts.
Operations not listed in the configuration file retain their default shortcuts.
View All Shortcuts
In interactive mode, use the following command to display all shortcuts and their current bindings:
/hotkeys
Example 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
Shortcut operations use namespaced IDs in the format "module.action".
IDs without namespaces in older config files (such as cursorUp, expandTools) will be automatically migrated to namespaced IDs at startup; no manual modification required.
This command lists all available shortcut actions, current bindings, and their associated feature areas, making it the best way to troubleshoot keybinding conflicts or find the shortcut for a specific feature.
Keys in Fullscreen Mode
use--tui-mode fullscreenAt startup, the transcript scrolls within the terminal viewport, while the editor and bottom status area remain fixed.
At this point, home, end, pageUp, and pageDown without modifier keys are used to scroll the transcript, while their ctrl variants still belong to 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, and ctrl+up / ctrl+down jump between the previous and next marked messages.
Fullscreen scroll bindings take precedence over editor bindings and can still be adjusted through normal action bindings.
| Keys | 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 in effect | Search transcript |
| ctrl+up、ctrl+down | Not in effect | Jump to previous/next marked message |