Visual Studio Code Shortcuts (that I Use A Lot on MacOS)
2023-12-22
Below is a list of shortcuts (in descending order roughly based on the frequency) that I use a lot when coding in VS Code on my Mac. It’s for personal purposes only and you should definitely ignore this post if you find it any annoying. If there’s a +
operator between keys, it means they’re supposed to be pressed at the same time. If there’s a divider |
before a key, it means you should release the previous keys and press whatever’s following.
Description | Shortcut |
---|---|
Save file | cmd + S |
Command palette | cmd + shift + P |
Delete current line | cmd + shift + K |
Run code (as in the code runner / my custom C++ compile & run workflow) | cmd + alt + N |
Select the current (and following matched) word | cmd + D |
Switch to another folder/project | ctrl + R |
Toggle bold text (in markdown) | cmd + B 1 |
Toggle italic text (in markdown) | cmd + I |
Avoid/close the annoying autocomplete | esc |
Toggle terminal (or whatever’s at the bottom) panel | cmd + J |
Switch focus to/from the terminal | ctrl + ` 2 |
Switch to the next split window | cmd + shift + ] |
Switch to the previous split window | cmd + shift + [ |
Save without auto-formatting (if auto-formatting is ON) | cmd + K | S |
Toggle word wrap | alt + Z |
Close the whole folder/project | cmd + K | F |
The list may go on but it’s worth noting that many commands are performed with the command palette, a bad habit from my old Sublime Text3 days.
-
Conflicts with toggling side panel, yikes. ↩︎
-
In order to escape a backtick
`
in markdown, we can use a backward slash when it’s in regular text (e.g.\`
is rendered as `), use double backticks with extra spaces (e.g.`` `this` ``
is rendered as`this`
), use triple (and more) backticks with extra spaces to escape double (and more) backticks. We can always fall back to raw HTML using<code>
tags, of course. ↩︎ -
Despite how I love ST4, the fact that VS Code comes with a native terminal and debugger is irresistable. ↩︎