DEV Community

Suifeng023
Suifeng023

Posted on

10 VS Code Shortcuts Every Developer Should Know (But Most Don't)

10 VS Code Shortcuts Every Developer Should Know (But Most Don't)

Stop reaching for the mouse. These keyboard shortcuts will 10x your coding speed.

I've been using VS Code for 5+ years, and I still discover new shortcuts that blow my mind. Here are the 10 most impactful shortcuts that separate power users from everyone else.


1. Multi-Cursor Magic: Ctrl + D

Select the next occurrence of the current word. Keep pressing to select more.

// Want to rename all 'count' to 'total'? 
// Place cursor on 'count' → Ctrl+D repeatedly → type 'total'
Enter fullscreen mode Exit fullscreen mode

Pro tip: Ctrl + Shift + L selects ALL occurrences at once.


2. Move Lines Like a Boss: Alt + ↑/↓

Move the current line (or selected block) up or down. No cutting and pasting.

# Cursor on line 2, press Alt+↑
x = 10        # ← was line 2, now line 1
def hello():  # ← was line 1, now line 2
    pass
Enter fullscreen mode Exit fullscreen mode

3. Duplicate Line: Shift + Alt + ↓

Instantly duplicate the current line below. Perfect for when you need a similar line.


4. Quick Open Anything: Ctrl + P

Jump to any file by typing part of its name. No more clicking through folders.

Bonus: Add @ to jump to symbols, : to jump to line numbers.

Ctrl+P → "app@main"  → jumps to main() in app.py
Ctrl+P → "util:42"   → jumps to line 42 in util.py
Enter fullscreen mode Exit fullscreen mode

5. Command Palette: Ctrl + Shift + P

The gateway to ALL VS Code features. Change settings, run tasks, install extensions — all without touching the mouse.

Ctrl+Shift+P → "format"     → Format Document
Ctrl+Shift+P → "theme"      → Color Theme
Ctrl+Shift+P → "python"     → Python-specific commands
Enter fullscreen mode Exit fullscreen mode

6. Toggle Sidebar: Ctrl + B

Instantly show/hide the sidebar. More screen real estate for your code.

Pair it with: Ctrl + J to toggle the terminal panel.


7. Go to Definition: F12

Jump to where a function, class, or variable is defined. Press Alt + F12 to peek without leaving your current file.

result = calculate_total(items)
#        ^ F12 here → jumps to the function definition
Enter fullscreen mode Exit fullscreen mode

Go back: Alt + ← returns you to where you were.


8. Rename Symbol: F2

Rename a variable/function across your entire project safely. No more find-and-replace nightmares.

# Place cursor on 'username', press F2, type 'email'
username = get_user_input()  # → becomes email = get_user_input()
Enter fullscreen mode Exit fullscreen mode

9. Terminal Toggle: Ctrl +`

Open the integrated terminal without leaving your editor. Split screen bliss.

Pro tip: Ctrl + Shift + creates a NEW terminal instance.


10. Format Document: Shift + Alt + F

Auto-format your entire file based on your language's formatter. Python? Black. JS? Prettier. No arguments.

Set up autosave formatting:
`json
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
`


Bonus: My Top 3 Extension Recommendations

Extension What it does
GitHub Copilot AI-powered code suggestions
Error Lens Shows errors inline (no hovering)
GitLens See who changed each line and when

The Real Secret

Shortcuts only work if you commit to using them. Here's my challenge:

Pick just 3 shortcuts from this list and force yourself to use them for one week. No mouse allowed for those actions. After 7 days, they'll be muscle memory.

Then come back and pick 3 more.


What's YOUR favorite VS Code shortcut that I missed? Drop it in the comments! 👇

If you found this helpful, follow me for more dev productivity tips.

Top comments (0)