Most useful visual studio code shortcuts
I got tired of looking up shortcuts dozens of times before I learn them, so I'm creating this post for myself to learn the shortcuts and also as a cheatsheet so I have them all in one place!
⌘ + F - Find
Everyone should know this, it's not just for coding. If you don't, learn it. I use this as much as copy/paste
⌘ + P - Quick Open
This is probably my most used shortcut. When I'm stuck into a code project I rarely look at the explorer, I mainly search for files by their name, similar to Alfred/Spotlight on Mac.
⌘ + ⇧ + P - Command Palette
I end up opening this sometimes when I want Quick Open... but it's still a fairly useful command for installing extensions or searching for options in some of your plugins
CTRL + ` - Open/Close Terminal
I've started to get more and more into using the integrated terminal in VS Code, which allows me to stay in my editor longer. It also allows me to go fullscreen with my editor and not have to 'look around' for my terminal.
⌘ + ⇧ + K - Delete Line
Most of my code gets deleted after I've written, especially dozens of logs I write because I'm not smart enough to keep track of all the things going on on my latest feature. This is invaluable for cleaning things up. I used to highlight a line and then delete it, but this takes way less time - Just click on a line and CMD + SHIFT + K
it away.
⌥ + ↑ or ⌥ + ↓ - Move Line up or down
Sometimes I write good code, and it just needs to be moved to a smarter place. This is good for moving code in and out of functions or for some clean up.
⌥ + ⇧ + ↑ or ⌥ + ⇧ + ↓ - Copy Line up or down
You can do this with a single line or a highlighted block of code. Good for copying similar components/functions or a block of html that you'd like to reuse. I rarely use this as I find it easier to highlight and copy/paste, but I should learn it.
CMD + L - Select current line
This is good for non-trackpad/mouse selection. You can push this multiple times to select the next line. Combined with delete or ⌥ + ↓ this is a powerful shortcut.