Better VS Code living through Keyboard Shortcuts
This past weekend, I was writing some code in VS Code and was reminded how quick and effortless VS Code can be with a “keyboard-only” mindset. So, like with many things, I tweeted out my current thoughts…
This tweet gained a little steam, lots of people liked it and even some enough to retweet it. Then I got an interesting reply…
Immediately my thought was… “uhhh I dunno”. I realized that I had learned all of these super handy VS Code keyboard shortcuts by constant use of the product since it’s inception. Coming from a Vim background (still extremely love love LOVE Vim, but most of my software development is in VS Code these days), I have always approached VS Code with a keyboard-first mindset. And after using VS Code for such a long time I had simply amassed the keyboard shortcuts to muscle memory that I need, want and use daily.
So that got me thinking, what is the best resource to learn keyboard shortcuts ASAP in VS Code!? There’s not a really great answer here, just due to the vast nature of keyboard shortcuts.
One approach would be to open up the default configuration for keybindings by going to the command palette (CMD + SHIFT + P) and typing in “keyboard”. That’ll pop open the long list of default keyboard shortcuts defined (and allow you to define your own!). But it’s not the easiest config file to read like a book, so that could get boring and/or frustrating really fast.
I think the better approach to learning keyboard shortcuts in VS Code is to do this…
- Recognize that a task you do with the mouse probably has a keyboard shortcut (we are all computer users, we should have this sixth sense)
- Open up the command palette (VS Code did a great job of putting basically all functionality accessible through the command palette) and search for the action you want to do
- If there is a keyboard shortcut defined for this action it will be specified next to the action description… commit it to memory and start using it immediately
- If there is not a keyboard shortcut, define it in your keybindings configuration as mentioned above
This is basically how I became proficient with a keyboard-only approach to VS Code. Just a little quick discovery, a tiny bit of discipline in the beginning to actually use the keyboard shortcut, and then a lifetime of enjoying the speed and ease of keyboard control.
Enjoy!