【问题标题】:VS Code: Single keybinding to Spit/Merge Editor?VS Code:单一键绑定到 Spit/Merge 编辑器?
【发布时间】:2021-02-27 18:50:19
【问题描述】:

有没有办法检测编辑器的拆分/单个状态,以便我可以使用单个键绑定来拆分和合并编辑器?

{
  "key": "ctrl+\\",
  "command": "workbench.action.splitEditorDown"
  "when": "EDITOR IS IN SINGLE STATE"
},
{
  "key": "ctrl+\\",
  "command": "workbench.action.editorLayoutSingle",
  "when": "EDITOR IS IN SPLIT STATE"
}

或者也许有不同的设置方法?

谢谢。

【问题讨论】:

    标签: visual-studio-code editor keyboard-shortcuts


    【解决方案1】:

    我想这就是你要找的东西:

    {
      "key": "ctrl+\\",
      "command": "workbench.action.splitEditorDown",
      "when": "!multipleEditorGroups"
    },
    {
      "key": "ctrl+\\",
      "command": "workbench.action.editorLayoutSingle",
      "when": "multipleEditorGroups"
    }
    

    我通过使用Developer: Inspect Context Keys 命令找到了when 子句。

    (1) 打开开发者工具控制台:Help/Toggle Developer Tools
    (2) 从命令面板运行上述命令并单击编辑器中的任意位置
    (3) 这将在开发者工具控制台中创建一个大对象,其中包含许多 when 上下文子句及其当前值
    (4) 在控制台中查找groups 并寻找有希望的when 子句(我首先使用术语split 进行搜索,但没有任何帮助)。

    没有什么可以告诉你一个特定的文件是否被分成两个(或更多)组 - 只是有 1 组或更多组编辑器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-18
      • 2016-07-05
      • 1970-01-01
      • 2020-07-01
      • 2022-12-02
      • 2022-11-30
      • 1970-01-01
      相关资源
      最近更新 更多