另请参阅运行最近的命令作为反向搜索的替代 https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_70.md#run-recent-command-as-a-replacement-for-reverse-search来自 v1.70 发行说明:
启用 shell 集成后,我们的目标是运行最近的命令
是一个跨 shell 的替代品,用于替代 shell 的反向搜索
(kbstyle(Ctrl+R)
)。有一种新的连续搜索模式,即
触发命令时默认。这行为就像kbstyle(Ctrl+R)
在大多数 shell 中,可以选择切换回模糊搜索:
The new inTerminalRunCommandPicker
上下文键可用
允许设置像这样的键绑定kbStyle(Ctrl+R)
转到下一个
匹配。例如,以下键绑定现在相当
完全替代 shell 的反向搜索,kbstyle(Ctrl+Alt+R)
作为旧行为的后备:
{ "key": "ctrl+r", "command": "workbench.action.terminal.runRecentCommand", "when": "terminalFocus" },
{ "key": "ctrl+alt+r", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\u0012"/*^R*/ }, "when": "terminalFocus" },
{ "key": "ctrl+r", "command": "workbench.action.quickOpenNavigateNextInViewPicker", "when": "inQuickOpen && inTerminalRunCommandPicker" },
{ "key": "ctrl+c", "command": "workbench.action.closeQuickOpen", "when": "inQuickOpen && inTerminalRunCommandPicker" },
也许您实际上两者都想要!终端键绑定的形式为
Ctrl+R Ctrl+something else
也就是说,键绑定是chords
并且仍然使用
Ctrl+R (a non-chord keybinding) to trigger a reverse search in the terminal.
您可以两者兼得 - 将此键绑定添加到您的 keybindings.json 中:
{
"key": "ctrl+r",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u0012" },
"when": "terminalFocus"
},
That sends a "Ctrl+R" to the terminal and thus starts a reverse search. Even if you have other terminal keychords that starts with Ctrl+R, the terminal will not wait for the second part of a keybinding.
请注意,如果您有经常使用的搜索,您可以向命令添加文本,例如:
"args": { "text": "\u0012node" },
它已经开始搜索命令node
在他们中。