跳至内容

快捷键

创建于 2025-07-16·更新于 2026-07-16

所有键盘快捷键均可通过 ~/.pi/agent/keybindings.json 自定义。每个动作可以绑定一个或多个按键。

配置文件使用与 pi 内部相同的带命名空间的键绑定 ID,扩展作者在 keyHint() 和注入的 keybindings 管理器中使用的也是这些 ID。

使用旧版非命名空间 ID(如 cursorUpexpandTools)的配置会在启动时自动迁移为命名空间 ID。

编辑 keybindings.json 后,在 pi 中运行 /reload 即可应用更改,无需重启会话。

键格式 Key Format

modifier+key,其中 modifier 可以是 ctrlshiftalt(可组合),key 可以是:

  • 字母 Letters: a-z
  • 数字 Digits: 0-9
  • 特殊键 Special: escapeescenterreturntabspacebackspacedeleteinsertclearhomeendpageUppageDownupdownleftright
  • 功能键 Function: f1-f12
  • 符号 Symbols: `, -, =, [, ], \, ;, ', ,, ., /, !, @, #, $, %, ^, &, *, (, ), _, +, |, ~, {, }, :, <, >, ?

修饰键组合示例:ctrl+shift+xalt+ctrl+xctrl+shift+alt+xctrl+1 等。

所有动作 All Actions

TUI 编辑器光标移动 TUI Editor Cursor Movement

键绑定 ID Keybinding id默认键 Default描述 Description
tui.editor.cursorUpup光标上移
tui.editor.cursorDowndown光标下移
tui.editor.cursorLeftleftctrl+b光标左移
tui.editor.cursorRightrightctrl+f光标右移
tui.editor.cursorWordLeftalt+leftctrl+leftalt+b光标向左移动一个单词
tui.editor.cursorWordRightalt+rightctrl+rightalt+f光标向右移动一个单词
tui.editor.cursorLineStarthomectrl+a移动到行首
tui.editor.cursorLineEndendctrl+e移动到行尾
tui.editor.jumpForwardctrl+]向前跳转到指定字符
tui.editor.jumpBackwardctrl+alt+]向后跳转到指定字符
tui.editor.pageUppageUp向上翻页
tui.editor.pageDownpageDown向下翻页

TUI 编辑器删除 TUI Editor Deletion

键绑定 ID Keybinding id默认键 Default描述 Description
tui.editor.deleteCharBackwardbackspace向后删除字符
tui.editor.deleteCharForwarddeletectrl+d向前删除字符
tui.editor.deleteWordBackwardctrl+walt+backspace向后删除单词
tui.editor.deleteWordForwardalt+dalt+delete向前删除单词
tui.editor.deleteToLineStartctrl+u删除到行首
tui.editor.deleteToLineEndctrl+k删除到行尾

TUI 输入 TUI Input

键绑定 ID Keybinding id默认键 Default描述 Description
tui.input.newLineshift+enterctrl+j插入新行
tui.input.submitenter提交输入
tui.input.tabtabTab / 自动补全

TUI Kill Ring TUI Kill Ring

键绑定 ID Keybinding id默认键 Default描述 Description
tui.editor.yankctrl+y粘贴最近删除的文本
tui.editor.yankPopalt+y在粘贴后循环切换已删除的文本
tui.editor.undoctrl+-撤销上次编辑

TUI 剪贴板与选择 TUI Clipboard and Selection

键绑定 ID Keybinding id默认键 Default描述 Description
tui.input.copyctrl+c复制选中内容
tui.select.upup向上移动选择
tui.select.downdown向下移动选择
tui.select.pageUppageUp列表中向上翻页
tui.select.pageDownpageDown列表中向下翻页
tui.select.confirmenter确认选择
tui.select.cancelescapectrl+c取消选择

应用 Application

键绑定 ID Keybinding id默认键 Default描述 Description
app.interruptescape取消 / 中止
app.clearctrl+c清空编辑器
app.exitctrl+d退出(编辑器为空时)
app.suspendctrl+z(Windows 上无默认值)挂起到后台
app.editor.externalctrl+g在外部编辑器中打开(externalEditor$VISUAL$EDITOR、Windows 上的 Notepad,或其他平台上的 nano
app.clipboard.pasteImagectrl+v(Windows 上为 alt+v从剪贴板粘贴图片

会话 Sessions

键绑定 ID Keybinding id默认键 Default描述 Description
app.session.new(无)启动新会话(/new
app.session.tree(无)打开会话树导航器(/tree
app.session.fork(无)分支当前会话(/fork
app.session.resume(无)打开会话恢复选择器(/resume
app.session.togglePathctrl+p切换路径显示
app.session.toggleSortctrl+s切换排序模式
app.session.toggleNamedFilterctrl+n切换仅显示已命名会话的过滤器
app.session.renamectrl+r重命名会话
app.session.deletectrl+d删除会话
app.session.deleteNoninvasivectrl+backspace查询为空时删除会话

模型与思考 Models and Thinking

键绑定 ID Keybinding id默认键 Default描述 Description
app.model.selectctrl+l打开模型选择器
app.model.cycleForwardctrl+p切换到下一个模型
app.model.cycleBackwardshift+ctrl+p切换到上一个模型
app.thinking.cycleshift+tab循环切换思考级别
app.thinking.togglectrl+t折叠或展开思考块

显示与消息队列 Display and Message Queue

键绑定 ID Keybinding id默认键 Default描述 Description
app.tools.expandctrl+o折叠或展开工具输出
app.message.copyctrl+x复制最后一条助手消息,或在 /tree 中复制选中的消息
app.message.followUpalt+enter排队追加消息
app.message.dequeuealt+up将已排队的消息恢复到编辑器

树导航 Tree Navigation

键绑定 ID Keybinding id默认键 Default描述 Description
app.tree.foldOrUpctrl+leftalt+left折叠当前分支段,或跳转到上一个段起始位置
app.tree.unfoldOrDownctrl+rightalt+right展开当前分支段,或跳转到下一个段起始位置或分支末尾
app.tree.editLabelshift+l编辑选中的树节点标签
app.tree.toggleLabelTimestampshift+t切换树中标签时间戳的显示
app.tree.filter.defaultctrl+d将树过滤器设置为默认视图
app.tree.filter.noToolsctrl+t切换树过滤器以隐藏工具结果
app.tree.filter.userOnlyctrl+u切换树过滤器以仅显示用户消息
app.tree.filter.labeledOnlyctrl+l切换树过滤器以仅显示有标签的条目
app.tree.filter.allctrl+a切换树过滤器以显示所有条目
app.tree.filter.cycleForwardctrl+o向前循环切换树过滤器
app.tree.filter.cycleBackwardshift+ctrl+o向后循环切换树过滤器

作用域模型选择器 Scoped Models Selector

用于作用域模型选择器(通过 /scoped-models 打开)。

键绑定 ID Keybinding id默认键 Default描述 Description
app.models.savectrl+s将当前模型选择保存到设置
app.models.enableAllctrl+a启用所有模型(或所有匹配当前搜索的模型)
app.models.clearAllctrl+x清除所有模型(或所有匹配当前搜索的模型)
app.models.toggleProviderctrl+p切换当前提供商的所有模型
app.models.reorderUpalt+up将选中的模型在循环顺序中上移
app.models.reorderDownalt+down将选中的模型在循环顺序中下移

自定义配置 Custom Configuration

创建 ~/.pi/agent/keybindings.json

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

每个动作可以绑定单个按键或按键数组。用户配置会覆盖默认值。

在原生 Windows 上,app.suspend 没有默认绑定,因为 Windows 终端不支持 Unix 作业控制。如果手动绑定此键,pi 会显示状态消息而非挂起。在 WSL 中,正常的 Linux ctrl+z/fg 行为仍然适用。

Emacs 示例 Emacs Example

{
  "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 示例 Vim 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"]
}