Using Ctrl+K V
we can open markdown preview in side panel, but my requirement is different.
I want to add custom keyboard shortcut to open markdown preview for markdown file which is present my hard disc at any specific location.
Suppose I have D:testDatatest.md
file. Now if I press any specific key (ex. ctrl+e) in vs code then preview of test.md
should get displayed at right side panel in vs code.
2
Answers
you can do that by editing Keyboard Shortcuts in vs code
goto:
Files > Preferences > Keyboard Shortcuts
search for "ctrl+k v"
you will see command: "Markdown: Open Preview to the Side"
here you can edit the Keybinding to whatever you like.
images for reference:
keyboard shortcuts
search for correct shortcut
change the Keybinding
You can set up a keybinding to do this with an extension I wrote, Find and Transform. For example, with this keybinding:
Note that the backslashes need to appear as
\\
– that represents each backslash being double-escaped.The only requirements are that an editor be focused and that your cursor is not at a "word" so there is no match (the extension is primarily designed to make find/searches easy and powerful so it would otherwise create the find). On an empty line or after punctuation for example.