【问题标题】:Switch to, and from, Preview, with 1 keyboard shortcut?使用 1 个键盘快捷键切换到预览和从预览切换?
【发布时间】:2021-10-04 13:59:52
【问题描述】:

我尝试在 Markdown.showSource 的 When Expression 中使用 textInputFocus && !inputFocus && editorLangId == 'markdown'textInputFocus && editorReadonly && editorLangId == 'markdown',以及 markdown.showPreview 的相关版本。

但是当 Preview 有 Focus 时,快捷方式仍然不起作用。

【问题讨论】:

    标签: visual-studio-code vscode-keybinding


    【解决方案1】:

    如果您查看 Keybindings Shortcuts 中的 markdown.showSource,您会发现它没有 context/when 子句。它必须找到匹配的资源并转到它。

    此外,当预览处于活动状态时,您会看到右下角的 language ID 消失了,因此 editorLangId == markdown 可能总是会失败。

    如果您希望使用when 子句来防止键绑定冲突,请尝试:

      {
        "key": "alt+e",
        "command": "markdown.showSource",
        "when": "markdownPreviewFocus"
      }
    

    了解Developer: Inspect Context Keys 命令,请参阅inspect context keys utility。这就是我找到markdownPreviewFocus 子句的方式。

    【讨论】:

    • 相关 -- htmlPreviewFocus
    猜你喜欢
    • 2019-03-29
    • 1970-01-01
    • 1970-01-01
    • 2012-12-02
    • 2021-11-20
    • 2014-03-18
    • 1970-01-01
    • 1970-01-01
    • 2014-05-19
    相关资源
    最近更新 更多