Originally published on dev.to
As a developer working with Next.js and Python on macOS, I've discovered that mastering VS Code keyboard shortcuts is one of the fastest ways to supercharge your productivity. Instead of constantly reaching for your mouse, these shortcuts will have you navigating, editing, and debugging code like a seasoned pro.
Quick Mac Tip: Most VS Code shortcuts replace
Ctrl
withCmd
andAlt
withOption
on Mac. I'll highlight any exceptions as we go!
Why Keyboard Shortcuts Matter
Before we dive in, let's be honestβlearning shortcuts feels tedious at first. But once they become muscle memory, you'll wonder how you ever coded without them. The time you save adds up quickly, especially when you're deep in a coding flow state.
π Basic Text Editing: Your Daily Drivers
These are the shortcuts you'll use every single day:
Essential Copy/Paste Operations
-
Cmd + X
- Cut selected text (or entire line if nothing's selected) -
Cmd + C
- Copy selected text (or entire line if nothing's selected) -
Cmd + V
- Paste from clipboard -
Cmd + A
- Select all content in file
Undo/Redo & Comments
-
Cmd + Z
- Undo last action -
Cmd + Shift + Z
- Redo (Mac's version of Ctrl+Y) -
Cmd + /
- Toggle line comment (works on multiple selected lines too!)
β‘ Advanced Text Editing: Level Up Your Game
Once you're comfortable with the basics, these shortcuts will make you feel like a coding wizard:
Smart Selection & Autocomplete
-
Cmd + Space
- Trigger autocomplete suggestions -
Cmd + .
- Quick fix for errors/warnings under cursor -
Cmd + D
- Select word under cursor, then select next occurrence
Line Manipulation
-
Cmd + Shift + K
- Delete current line (without copying to clipboard) -
Cmd + Enter
- Insert new line below cursor -
Cmd + Shift + Enter
- Insert new line above cursor -
Option + Up/Down
- Move current line up/down
Code Folding & Indentation
-
Tab
- Indent line -
Cmd + ]
- Increase indentation -
Cmd + Option + [
- Collapse code block -
Cmd + Option + ]
- Expand code block -
Shift + Option + A
- Block comment selected code
ποΈ Tab Management: Stay Organized
Managing multiple files efficiently is crucial for larger projects:
Opening & Closing Tabs
-
Cmd + Shift + T
- Reopen last closed tab -
Cmd + W
- Close current tab -
Cmd + K, Cmd + W
- Close all tabs
Navigation Between Tabs
-
Ctrl + Tab
- Show recent tabs list (note:Ctrl
, notCmd
!) -
Ctrl + Shift + Tab
- Show tabs in reverse order
Panel Management
-
Cmd + Option + Left/Right
- Move tab to left/right panel -
Ctrl + 1/2/3
- Switch focus between panels
ποΈ Panel & Sidebar Control
Maximize your screen real estate and access tools quickly:
Terminal & Panels
-
Ctrl + ~
- Toggle terminal (remember:Ctrl
notCmd
) -
Ctrl + Shift + ~
- Open new terminal -
Cmd + Shift + M
- Open problems panel -
Cmd + Shift + U
- Open output panel
Sidebar Navigation
-
Cmd + B
- Toggle sidebar -
Cmd + Shift + E
- Focus Explorer -
Cmd + P
- Quick file search -
Cmd + Shift + P
- Command Palette (your best friend!)
Settings & Shortcuts
-
Cmd + ,
- Open settings -
Cmd + K, Cmd + S
- View/edit keyboard shortcuts
π Find, Replace & Symbol Navigation
These shortcuts are game-changers when working with large codebases:
Search Operations
-
Cmd + F
- Find in current file -
Cmd + Shift + F
- Global search across project -
Cmd + Option + F
- Find and replace in file -
Cmd + Shift + H
- Global find and replace
Symbol Navigation (Perfect for Next.js components and Python functions!)
-
F2
- Rename symbol everywhere -
Shift + F12
- Show all references inline -
Shift + Option + F12
- Open references in side panel -
Option + F12
- Peek definition -
F12
- Go to definition -
Cmd + Click
- Go to definition (mouse + keyboard combo)
Symbol Search
-
Cmd + Shift + O
- Search symbols in current file -
Cmd + T
- Search symbols globally
π― Advanced Selection & Multi-Cursor Magic
Multi-cursor editing is where VS Code really shines:
Text Selection
-
Shift + Arrow Keys
- Select character by character -
Option + Left/Right
- Jump by word -
Shift + Option + Left/Right
- Select by word -
Ctrl + Shift + Left/Right
- Expand selection to logical blocks
Multi-Cursor Mastery
-
Option + Click
- Add cursor at click position -
Cmd + U
- Undo last cursor placement -
Cmd + Option + Up/Down
- Add cursor above/below
Box Selection
-
Shift + Option + Drag
- Select rectangular text block -
Cmd + Shift + Option + Arrows
- Adjust box selection
π Debugging Shortcuts
Essential for troubleshooting your Next.js apps and Python scripts:
Debug Control
-
F5
- Start debugging / Continue execution -
Shift + F5
- Stop debugger -
F9
- Toggle breakpoint -
Shift + F9
- Add inline breakpoint
Step Through Code
-
F11
- Step into function -
F10
- Step over function -
Shift + F11
- Step out of function
π‘ Pro Tips for Maximum Efficiency
Start Small: Pick 5-10 shortcuts that match your most common actions and practice them for a week.
Use the Command Palette:
Cmd + Shift + P
is your gateway to discovering new features and their shortcuts.Customize When Needed: Access
Cmd + K, Cmd + S
to modify shortcuts that don't feel natural.Practice with Real Projects: The best way to memorize shortcuts is by using them in your actual Next.js and Python development work.
π Additional Resources
Want to dive deeper? Check out these helpful resources:
- Official VS Code Keyboard Shortcuts Reference
- VS Code Keyboard Shortcuts PDF (Mac version)
- VS Code Tips and Tricks Documentation
- Customizing Keyboard Shortcuts Guide
π― Your Next Steps
The journey to keyboard shortcut mastery doesn't happen overnight, but every shortcut you learn is a small investment in your future productivity. Start with the basic text editing shortcuts, then gradually work your way up to the advanced multi-cursor and debugging features.
Which shortcuts are you most excited to try? Drop a comment below and let me know how these shortcuts have improved your development workflow!
Found this helpful? Give it a β€οΈ and share it with your fellow developers. Happy coding! π
Tags: #vscode #productivity #macos #nextjs #python #shortcuts #webdev #developer
Top comments (0)