10 Must-Know VSCode Shortcuts to Enhance Your Productivity
Written on
Chapter 1: Introduction to VSCode Shortcuts
In a time when text editors are a hot topic and users often argue over which is superior—be it Vim, Neovim, or Emacs—I find myself sticking with Visual Studio Code (VSCode). Here, I will share ten shortcuts that have genuinely simplified my daily tasks.
This article isn’t a critique of other text editors; all of them have their merits. My choice of VSCode is influenced by several factors. As a 39-year-old father juggling a 9-to-5 job and two young daughters, I simply don’t have the bandwidth to learn and configure a new editor from scratch.
While many advocate for switching text editors to boost productivity, I question the need for speed when my coding often outpaces my thought process. I have years of valuable plugins that function well for me, and I’d rather not go through the hassle of finding replacements for them.
The goal of learning shortcuts is to enhance coding speed, but it’s essential to consider whether rapid coding leads to an increase in errors. Taking time to reflect and create well-structured code from the start can save a lot of trouble down the line.
My focus is on mastering programming idioms and patterns rather than merely improving typing speed. Nonetheless, efficient code manipulation is crucial, which is why I've assembled a list of the most effective keyboard shortcuts in VSCode.
Section 1.1: Essential Shortcuts
Select Word
This shortcut lets you select the word where your cursor is positioned.
- Linux/Windows: Ctrl + d
- Mac: Command + d
Once you select a word or code snippet, pressing the shortcut again will highlight subsequent occurrences of the same text, allowing for quick edits across all selections.
Move Line(s)
I often use this command to quickly shift lines within or outside a code block.
- Linux/Windows: Alt + Up/Down arrow
- Mac: Option + Up/Down arrow
Delete Line
This handy shortcut deletes an entire line without needing to select it first.
- Linux/Windows: Ctrl + Shift + K
- Mac: Command + Shift + K
Jump to Specific Line
If you know exactly where you want to go, this command is invaluable.
- Linux/Windows/Mac: Ctrl + g
Jump Back
This command allows you to return to your original position after making changes.
- Linux/Windows: Ctrl + u
- Mac: Command + u
Code Folding
For lengthy files, folding and unfolding code blocks can make navigation easier.
- Folding:
- Linux/Windows: Ctrl + Shift + [
- Mac: Command + Option + [
- Unfolding:
- Linux/Windows: Ctrl + Shift + ]
- Mac: Command + Option + ]
- Folding:
Rename Symbol
Renaming a symbol throughout a project can be tedious. Instead of searching for every instance, use:
- F2: Place the cursor on the symbol and press F2 to rename all occurrences at once.
Switch Focus Between Explorer and Open Files
Initially, I relied on my mouse to find files. Now, I use:
- Linux/Windows: Ctrl + (0 to n)
- Mac: Command + (0 to n)
Utilizing the Outline Feature
Clicking on the Outline section in the explorer provides a quick overview and navigation aid.
- Linux/Windows: Ctrl + Shift + o
- Mac: Command + Shift + o
Command Palette
If you forget a shortcut, you can always access the command palette.
- Linux/Windows: Ctrl + Shift + p
- Mac: Command + Shift + p
Bonus: Vim Plugin
If you're looking for additional shortcuts or a more traditional approach, VSCode allows you to emulate other editors through plugins like Vim and Emacs.
In conclusion, I genuinely enjoy using VSCode. While it has its areas for improvement, what works for me may not suit everyone. It's essential to choose a text editor that enhances your coding experience rather than define your programming skills.
What about you? What text editor do you prefer, and what are your favorite shortcuts in VSCode? I’d love to hear your thoughts! For more articles like this, consider following me, clapping, subscribing, or sharing this post!
Chapter 2: Video Resources
To further enhance your understanding of VSCode shortcuts, check out the following videos.
This video, titled "30 VSCode Keyboard Shortcuts You NEED to Know," provides valuable insights into essential shortcuts that can significantly improve your workflow.
The second video, "10 Best VSCode Keyboard Shortcuts," offers a concise guide to the most effective shortcuts that can streamline your coding process.