跳转到内容

键盘快捷键

快捷键(Windows / Linux)macOS操作条件
Alt+\Alt+\请求代码补全编辑文件时
TabTab接受显示的补全有建议显示时
EscEsc忽略显示的补全有建议显示时
Ctrl+ICmd+I内联编辑:描述对选区的修改编辑文件时
Ctrl+Shift+EnterCmd+Shift+Enter接受待定的内联编辑有编辑待定时
Ctrl+Shift+BackspaceCmd+Shift+Backspace拒绝待定的内联编辑有编辑待定时
Ctrl+Shift+/Cmd+Shift+/停止生成(补全、对话、编辑或审查)twinny 正在生成时
Ctrl+.Cmd+.灯泡:Fix with Twinny、Edit with Twinny在诊断或选区上

TabEscCtrl+. 是 VS Code 自身对内联建议和代码操作的绑定。

修改

打开键盘快捷方式Ctrl+K Ctrl+S)并搜索 twinny。或在 keybindings.json 中添加:

[
{ "key": "ctrl+alt+i", "command": "twinny.edit", "when": "editorTextFocus && !editorReadonly" },
{ "key": "ctrl+alt+enter", "command": "twinny.acceptEdit", "when": "twinnyInlineEditPending && editorTextFocus" }
]

有用的 when 上下文:twinnyInlineEditPending(有编辑待定)和 twinnyGeneratingText(有内容正在流式输出)。

冲突

补全快捷键绑定在 VS Code 内置命令 Trigger Inline Suggestioneditor.action.inlineSuggest.trigger)上,GitHub Copilot 也把它绑定到 Alt+\。两者都安装时请改掉其中一个。Ctrl+I 也被一些其他助手绑定;twinny 的绑定只在可写的文本编辑器中生效。

建议的额外绑定

没有默认绑定但常用时值得绑定的命令:

命令 id建议
twinny.addTestsCtrl+Alt+T
twinny.explainCtrl+Alt+E
twinny.terminalCommandCtrl+Alt+`
twinny.fixTerminalErrorCtrl+Alt+F
twinny.newConversationCtrl+Alt+N