Since I started using VSCode a couple of years ago, I've learned quite a few handy shortcuts and installed some incredible extensions to make my day to day not only easier, but also quicker and more productive. Perhaps many of you are familiar already with some of these, but I hope to introduce you to some new ones too!
Shortcuts
⌘ K ⌘ C
: This command is by far my favorite one I've learned. It's used to add comment lines, but it can also be used to comment out lines if you're wanting to quickly test a piece of code.⌘X
: Cut away a whole line of code. It'll get saved into your clipboard allowing you to either delete or paste it somewhere else with⌘V
.⌥⌘↑
: Multi-cursors are great for editing, removing or commenting multiple lines of code at the same time. Using the↑
or↓
directional keys will add a cursor to a line above or below respectively.⇧⌘L
: Select all occurrences of selected piece of code. This comes in really handy for changing variable names.
Extensions
Project Manager: So much of my day is switching between repositories wether thats due to bugs in one project causing problems in another or implementing many features in one day. This extension allows you to save projects and easily switch between them via
⌘⌥P
shortcut.Jira and Bitbucket Extension: For the many of use who are using Jira boards to handle ticketing our issues or features, this extension allows you to create and modify Jira tickets directly in your editor. It will even give you the option to create a ticket directly from a
/**TODO:**/
Better Comments: Speaking of writing TODOs, Better Comments provides syntax highlighting and comment formatting to make your life and the lives of other developers who read your code easier.
Bracket Pairing: When I first started learning to program I would easily get lost trying to figure out which brackets were closed and which were open, let alone trying to figure out which one I actually need to delete. Nested brackets in any code base can be a pain to navigate through without a colorizer.
VSCode-Spotify: I'm not sure about your office, but mine tends to be pretty damn quiet with all of us developers hacking away behind the computer. I couldn't get through my day without listening to music or podcasts. This handy little extension connects the Spotify application to VSCode, creating a handy toolbar to skip, pause and play songs or podcasts directly in the editor. Really nice if you just need to quickly pause to ask or answer a question.
I hope I introduced you to some new shortcuts or extensions, feel free to comment down below some of your favorites!
Top comments (10)
You can also try using ⌘ / instead of ⌘ K ⌘ C
Nice! Much easier
Yeah that’s what I use as well.
And ⌘ Opt / for block comments.
My favorite keyboard shortcut is alt/option + enter. If you have a search open (via cmd+f) it will select all occurrences with their own cursors. Great for renaming variables or modifying all calls to the same function!
I love doing "select all occurrences" but if you need to only change something in a few places, ⌘ D is one of my favorite! 👍
Omg. I’ve been listening to music while coding wrong the whole time. Thanks for the new tips 😱
It's sooo handy
Holy crap thank you for this article. The shortcuts and Spotify plugin is what I have been needing
Thanks for the love!