简体   繁体   中英

Switch to, and from, Preview, with 1 keyboard shortcut?

I tried using textInputFocus && !inputFocus && editorLangId == 'markdown' and textInputFocus && editorReadonly && editorLangId == 'markdown' in When Expression for markdown.showSource, with relevant respective versions for markdown.showPreview.

But the shortcut still doesn't work when the Preview has Focus.

If you look at the markdown.showSource in the Keybindings Shortcuts you will see it has no context/when clause. It must just find the matching resource and go to it.

Also when a preview is active, you will see that the language ID in the bottom right corner disappears, so editorLangId == markdown will presumably always fail.

If you want a when clause to prevent keybinding conflicts, try:

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

Learn about the Developer: Inspect Context Keys command, see inspect context keys utility . That is how I found the markdownPreviewFocus clause.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM