【问题标题】:VSCode shorcut to tab between files on secondary editor groupVSCode 在辅助编辑器组上的文件之间切换的快捷方式
【发布时间】:2020-04-22 12:36:52
【问题描述】:

我目前正在使用 VSCode 来编辑 Latex 文档。我的设置是左侧一个编辑器组中的乳胶文档,然后是右侧另一组中文档(pdf)的预览。此外,我还在正确的工作组中打开了一些其他文件。

有没有办法创建一个快捷方式,通过右侧工作组中的文件选项卡,而焦点仍然在左侧?

【问题讨论】:

    标签: visual-studio-code keyboard-shortcuts keymapping keymaps


    【解决方案1】:

    我认为没有任何内置方法可以做到这一点。您可以很容易地使用宏来完成它。使用 multi-command 之类的宏扩展将其放入您的设置中:

    "multiCommand.commands": [
    
     {
      "command": "multiCommand.NextEditorOtherGroup",
      "sequence": [
        "workbench.action.focusNextGroup",
        "workbench.action.nextEditorInGroup",
        "workbench.action.focusNextGroup"
        //  "workbench.action.focusPreviousGroup" if you more than two editor groups for example
      ]
     },
    {
      "command": "multiCommand.PreviousEditorOtherGroup",
      "sequence": [
        "workbench.action.focusNextGroup",
        "workbench.action.previousEditorInGroup",
        "workbench.action.focusNextGroup"
      ]
     }
    ]
    

    宏只关注另一个编辑器组(假设你只有两个,如果你有更多,可以修改宏以关注right/last/most recently used 编辑器组。在关注另一个编辑器组后,它会移动到下一个编辑器组/previous editor 在另一个组中,然后将焦点返回到另一个组(因为你只有两个编辑组focusNextGroup 在这里工作得很好,如果你有更多并且想返回以前集中的组使用 workbench.action.focusPreviousGroup 代替) .

    然后你想使用任何键绑定来触发这些宏(在 keybindings.json 中):

    {
      "key": "alt+q",              // trigger the macro with any keybinding you wish
      "command": "extension.multiCommand.execute",
      "args": { "command": "multiCommand.NextEditorOtherGroup" },
      "when": "editorTextFocus"
    },
    {
      "key": "shift+alt+q",        // any keybinding
      "command": "extension.multiCommand.execute",
      "args": { "command": "multiCommand.PreviousEditorOtherGroup" },
      "when": "editorTextFocus"
    },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-25
      • 1970-01-01
      • 2021-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-15
      相关资源
      最近更新 更多