Search code examples
intellij-ideamarkdown

IntelliJ key shortcut to toggle between markdown and preview?


I'm editing markdown in IntelliJ. I don't have a big monitor so I can't really show both the markdown and the preview at the same time. They have tabs, that let you switch between the two. The tabs look like this:

I want a keyboard shortcut to go back and forth. Most things in IntelliJ have commands under Settings > Keymap. But I can't find anything for this? Is there a command?


Solution

  • Yes, all these "tabs" are actually actions.

    When you hover over the icon preview icon, it says Preview (and Editor and Editor and Preview for the other icons). Using Search Action (Ctrl+Shift+A or double Shift > Actions tab) you can search for preview, then assign a shortcut with Alt+Enter according to the bottom right of the Search action window. Note that a lot of actions have their location indicated on the right hand side (or in front of its name). These actions have no such indication, which means they are in the Other action category and you will also find them there in the Keymap.

    Editor and Preview is the only one that seems to be a toggle (so you can switch from/to it with the same shortcut), so if you want to switch between Editor and Preview you will have to assign shortcuts for both separately. By using second strokes, I've tested that Alt+Ctrl+Shift+Q then E for the Editor and Alt+Ctrl+Shift+Q then P for the preview works for being able to switch between them. But use any shortcut you like.