VS Code Tips
- 1. Introduction to VS Code
- 2. Command Palette & Navigation
- 3. Multi-Cursor & Advanced Editing
- 4. Workspace & Global Search
- 5. Keyboard Shortcuts Customization
- 6. Integrated Terminal Secrets
- 7. Custom Snippets & Emmet
- 8. Advanced Git Integration
- 9. Theme & Font Customizations
- 10. Essential Productivity Extensions
- 11. Debugging in VS Code
- 12. Task Automation (tasks.json)
- 13. Remote Development (SSH, Docker, WSL)
- 14. Profiles & Settings Sync
- 15. Best Practices & Speed Up
3. Multi-Cursor & Advanced Editing
Standard text editors force you to edit lines one-by-one. In VS Code, you can edit multiple lines simultaneously, mass-generate repetitive configurations, and restructure blocks of code using simple keyboard operations.
Multi-Cursor Click & Drag
Need to add a prefix to 5 separate lines of code? Instead of typing it 5 times, add multiple active cursors to your screen:
- Manual Cursors: Press Alt + Click (or Option + Click on macOS) on any position to insert an active cursor. Anything you type will appear at every cursor point simultaneously!
- Vertical Stack Cursors: Add cursors straight up or down using Ctrl + Alt + Up/Down (Cmd + Option + Up/Down). Great for editing aligned lists or CSV outputs.
Mastering Selection Shortcuts
Speed up your bulk refactorings by letting VS Code select target words automatically:
- Select Next Occurrence: Double-click a word (like a variable name) and press Ctrl + D (Cmd + D). This finds the next matching occurrence and inserts a cursor. Repeating this shortcut lets you selectively batch edit multiple variables!
- Select All Occurrences: Highlight a word and press Ctrl + F2 (Cmd + F2) to instantly select and edit *every* instance of that word inside your active file!
- Shrink/Expand Selection: Highlight code blocks hierarchically using Shift + Alt + Left/Right (Control + Shift + Left/Right). This expands selection outward to matching brackets, functions, and elements.
Fast Line Restructuring
Copy-pasting lines to duplicate them or cutting and pasting to move them takes multiple keys. VS Code handles line manipulation natively:
1. Copy Line Up/Down
Duplicate your active line or highlighted block instantly without using clipboard commands:
| Platform | Duplicate Down Shortcut |
|---|---|
| Windows / Linux | Shift + Alt + Down |
| macOS | Shift + Option + Down |
2. Move Line Up/Down
Move lines of code or whole blocks up or down through the file. VS Code handles indentation changes automatically:
- Press Alt + Up / Down (Option + Up / Down on macOS).
Column Selection Mode
When you want to select a neat rectangular box of text (e.g. copying just the column values of a text table), enable Column Selection:
- Hold down Shift + Alt (Shift + Option on macOS).
- Click and drag your cursor diagonally over the text.
- VS Code will select a perfect bounding box of columns and insert cursors at the end of each selected line!