如何在 Visual Studio 代码中重新映射默认的 CTRL+f(查找),以便我可以像在 unix/linux 中那样使用 CTRL+f?

How do I remap the default CTRL+f (find) in Visual Studio Code such that I can use CTRL+f as is typical in unix/linux?

在 Visual Studio 代码中,Ctrl+f 激活查找小部件。我在 Windows 10(ssh 到'nix)上使用 vscode 并在 Ubuntu 18.04 Linux 发行版(w/Gnome Shell)上单独使用,当使用集成终端。我希望 Ctrl+f 在 CLI 中向前移动一个字符,就像许多 Linux 终端上的典型情况一样,在 vscode.我该如何实现?

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

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

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

解决方案,总结:

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

注:以下内容是从the docs粘贴过来的,方便参考。

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

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

像这样:

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

在我的 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"
    }
]

我还必须将其添加到我的 settings.json 中才能使其正常工作(VSCode 版本 1.62.0):

  "terminal.integrated.commandsToSkipShell": [
    "-workbench.action.terminal.focusFind"
  ]