vs-code:无法在内置终端上反向搜索

2024-05-15

当我做^R在终端上进行反向搜索,我得到以下信息:

(^R) was pressed. Waiting for second key of chord...

我该如何解决?我在 OS X 上。


另请参阅运行最近的命令作为反向搜索的替代 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在他们中。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

vs-code:无法在内置终端上反向搜索 的相关文章

随机推荐