3

在 Visual Studio Code 中,Ctrl+f激活 Find 小部件。使用集成终端时,我在 Windows 10(ssh 到 nix)上使用 vscode,并在 Ubuntu 18.04 Linux 发行版(w/Gnome Shell)上单独使用。我希望Ctrl+f在 CLI 中向前移动一个字符,这在 vscode 中的许多 Linux 终端上很典型。我该如何做到这一点?

如果可能的话,我还想保持查找功能,尽管使用不同的绑定。

因为我在 SO 中的搜索很少,所以我发布了我为社区找到的解决方案和参考资料。

4

3 回答 3

7

在通过 Google 搜索了几个链接后,我在https://vscode.readthedocs.io/en/latest/editor/integrated-terminal/找到了解决此问题的简单文档。

解决方案,总结:

  1. 打开首选项:打开键盘快捷键,例如Ctrl++Shiftp键入keyboard,然后enterreturn
  2. 在键盘快捷键搜索栏中键入Ctrl+并找到“终端:焦点查找小部件”行。f我的看起来像这样:终端焦点键绑定 UI
  3. 单击铅笔图标以更改键绑定。一种可供我使用的是Ctrl++ 。Altf

注意:以下内容是从文档中粘贴的,以便于参考。

或者,在您的keybindings.json更改中:

{ "key": "ctrl+f", "command": "-workbench.action.terminal.focusFindWidget",
                      "when": "terminalFocus" },

像这样:

{ "key": "ctrl+alt+f", "command": "-workbench.action.terminal.focusFindWidget",
                      "when": "terminalFocus" },
于 2020-04-20T20:41:02.193 回答
2

我还必须将其添加到我的 settings.json 以使其工作(VSCode 版本 1.62.0):

  "terminal.integrated.commandsToSkipShell": [
    "-workbench.action.terminal.focusFind"
  ]
于 2021-11-06T16:00:59.643 回答
1

在我的 VSCode v1.58.2 中,它现在看起来像这样:

// Place your key bindings in this file to override the defaults
[
    {
        "key": "ctrl+alt+f",
        "command": "workbench.action.terminal.focusFind",
        "when": "terminalFindFocused && terminalProcessSupported || terminalFocus && terminalProcessSupported"
    },
    {
        "key": "ctrl+f",
        "command": "-workbench.action.terminal.focusFind",
        "when": "terminalFindFocused && terminalProcessSupported || terminalFocus && terminalProcessSupported"
    }
]
于 2021-07-25T00:10:05.650 回答