My Top Favorite VS Code Keyboard Tips, Tricks, and Shortcuts
As a software engineer, how many times a day do you reach for the mouse to navigate your code editor to select the right bits of code to edit, remove, add, or move around? Although it can take just a second or so to perform each of these mouse moments and clicks, those seconds can add significantly.
Additionally, your level of confidence and proficiency with typing during a technical coding interview can weigh the opportunity in your favor. Or if you already have a job, then you can blow their minds with your mad Typin’Skillz!
Today I’m going to share my favorite daily-driver keyboard shortcuts that work across all text applications and VS Code specific ones.
To best teach you these shortcuts, I’m not going to just tell you like some cheatsheet you can find online by googling “VS Code keyboard shortcuts” but instead show real code with real use cases to exemplify it.
Putting a little bit of practice now will pay off enormously in time saved.
Let’s get started
General Keyboard Shortcuts — Basics
Copy / Paste / Cut
Mac: Command + C / Command + V / Command X
PC: Ctrl + C / Ctrl + V / Ctrl + X
2. Select All
Mac: Command + A
PC: Ctrl + A
General Keyboard Shortcuts — Leveled Up
1. Word Jump
Mac: Option + Left/Right Arrow
PC: Alt + Left/Right Arrow
2. Delete Word
Mac: Option + Backspace
PC: Ctrl + Backspace
3. Jump to End of Line / Just to Start of Line
Mac: Command + Left/Right Arrow
PC: Home Key / End Key
4. Delete Whole Line of Code
Mac: Command + backspace |OR| Command + Shift + K
PC: Shift + End Key, then Delete Key |OR| Ctrl + Shift + K
6. DEL Key
Mac (not to be confused with the “delete” / backspace key):
- Without full-sized keyboard -> Control + D
- With full-sized keyboard -> Del Key
PC: Del Key
VS Code Keyboard Shortcuts
1. Multi-Line / Multi-Cursor
Both (Mac / PC): Click and hold middle mouse wheel and drag vertically
Mac:
- Keyboard: Option + Command + Up/Down Arrow
- Mouse/Keyboard: Command + Option + Left Click (drag)
PC:
- Keyboard: Ctrl + Alt + Up/Down Arrow
- Mouse/Keyboard: Ctrl + Alt + Left Click (drag)
2. Select sequential identical selected words
Mac: Command (hold) + D (repeated)
PC: Ctrl (hold) + D (repeated)
3. Select all identical selected words
Mac: Command + Shift + L
PC: Ctrl + Shift + L
warning: if you have the Mac desktop LastPass app install it hijacks this shortcut
4. Duplicate Line of Code
Mac: Option + Shift + Up/Down Arrow
PC: Ctrl + Shift + d
5. Move/Swap Line of Code
Mac: Option + Up/Down Arrow
PC: Shift + Alt + Up/Down Arrow
6. Search Whole Project
Mac: Command + Shift + F
PC: CTRL + Shift + F
6. Go To File
Mac: Command + P
PC: Ctrl + P
7. Open new Terminal
Mac: Control + ` (pronounced tick
upper left on keyboard)
PC: Ctrl + ` (pronounced tick
upper left on keyboard)
8. Quickly Create <div> with class Attribute, and Auto Complete Elements
BOTH (Mac/PC):
With class: .
then type classname and then tab
.
Just Element: type of element and then tab
complete