Visual Studio Code (VS Code) Keyboard Shortcuts keys that can help developers to become more productive and efficient.
1. Opening and closing the sidebar
Mac — Command + B
Windows/Ubuntu — Ctrl + B
2. Quick file open
Mac — Command + P
Windows/Ubuntu — Ctrl + P
3. Select the word
Mac — Command + D
Windows/ Ubuntu — Ctrl + D
4. Code formatting
Windows — Shift + Alt + F
Mac — Shift + Option + F
Ubuntu — Ctrl + Shift + I
5. Select the current line
Mac — Command + L
Windows/Ubuntu — Ctrl + L
6. Move line
Mac — Option + Up/Down arrow
Windows/Ubuntu — Alt + Up/Down arrow
7. Find word/phrase
If you need to find in the current file
Mac — Command + F
Windows/Ubuntu — Ctrl + F
If you need to find from the entire project
Mac — Command+Shift + F
Windows/Ubuntu — Ctrl+Shidt + F
8. Multi cursor selection
VS Code supports multiple cursors for fast simultaneous edits. You can add secondary cursors using:
Mac — Option + Click
Windows/Ubuntu — Alt + Click
9. Open the terminal
Windows/Linux: ctrl + J
Mac: command + J
10. Duplicate line
You can make duplications of the same line using:
Mac — Command + Shift + D
Windows/Ubuntu — Ctrl + Shift + D
11. Go to line number
Windows/Linux: ctrl + G
macOS: control + G
12. Line Comments
Windows/Linux: ctrl + /
macOS: command + /
13. Block Comments
Windows/Linux: shift + alt + A
macOS: shift + option + A
14. Select a column or box of code with arrow keys
You can do the same as above but without using your mouse. Instead of dragging a mouse, you use they keyboard arrow keys.
Windows/Linux: ctrl + shift + alt + → or ← or ↓ or ↑
macOS: command + shift + option + → or ← or ↓ or ↑
15. Fold/unfold Block
Windows/Linux: ctrl + shift + [ or ]
macOS: command + option + [ or ]