VS Code Shortcuts That Will Make You Stop Reaching for Your Mouse
VS Code Shortcuts That Will Make You Stop Reaching for Your Mouse
There are over 500 keyboard shortcuts in VS Code. Nobody needs all of them. But there is a specific set -- maybe 30 or so -- that separates developers who fly through code from developers who spend half their day clicking around menus.
This is not a reference sheet. This is a guide to the shortcuts that actually change how you work, organized by what you are trying to do, not by what keys you press.
Navigation: Stop Scrolling, Start Jumping
The mouse is a navigation tool for people who do not know where they are going. As a developer, you almost always know what you are looking for. These shortcuts get you there instantly.
Go to File (Cmd/Ctrl + P)
This is the single most important shortcut in VS Code. Instead of clicking through the file tree, just type part of the filename. It uses fuzzy matching, so "ucl" finds "UserController.ts" instantly.
Pro tip: Type a colon after the filename to jump to a specific line -- UserController.ts:45 takes you directly to line 45.
Go to Symbol (Cmd/Ctrl + Shift + O)
Inside a file, this lets you jump to any function, class, or variable definition. In a 500-line file, this is the difference between scrolling for 10 seconds and getting there in 1.
Type : first to group symbols by category (functions, variables, classes).
Go to Definition (F12)
Hover over a function call and press F12. You are now at the function definition. Press Alt + Left Arrow to jump back to where you were. This back-and-forth is how fast developers trace code.
Peek Definition (Alt + F12)
Like Go to Definition, but it opens an inline preview instead of navigating away. Perfect when you just want to quickly check a function signature without losing your place.
Go to Line (Ctrl + G)
Error on line 247? Press Ctrl + G, type 247, done. Never scroll to find a line number.
Multi-Cursor Editing: The Superpower Most Developers Ignore
Multi-cursor is not a gimmick. It is a genuine productivity multiplier that replaces dozens of find-and-replace operations.
Add Cursor Above/Below (Cmd/Ctrl + Alt + Up/Down)
Creates additional cursors on the lines above or below your current position. Perfect for editing multiple lines at once -- adding commas, changing variable names, aligning code.
Select Next Occurrence (Cmd/Ctrl + D)
Place your cursor on a word, then press Cmd+D repeatedly. Each press selects the next occurrence of that word, adding a new cursor. Now you can rename all instances simultaneously.
This is the shortcut that changes everything. Once you internalize Cmd+D, you will never use find-and-replace for simple renames again.
Select All Occurrences (Cmd/Ctrl + Shift + L)
Like Cmd+D but selects every occurrence in the file at once. Use this when you know you want to change all of them.
Add Cursor at Click (Alt + Click)
Click anywhere while holding Alt to add a cursor at that exact position. Useful for editing non-adjacent lines that do not follow a pattern.
Line Manipulation: Edit Faster Than You Think
Move Line Up/Down (Alt + Up/Down)
Reorder lines without cut-and-paste. Select a line (or multiple lines) and press Alt+Up or Alt+Down to move them. This is how you rearrange code, reorder imports, reorganize lists.
Copy Line Up/Down (Shift + Alt + Up/Down)
Duplicate the current line above or below. Faster than copy-paste for duplicating similar lines of code and then modifying them.
Delete Line (Cmd/Ctrl + Shift + K)
Delete the entire current line. No selecting, no backspacing. One shortcut.
Toggle Comment (Cmd/Ctrl + /)
Comment or uncomment the current line or selection. Works with any language VS Code understands.
Indent/Outdent (Cmd/Ctrl + ] / Cmd/Ctrl + [)
Indent or outdent the current line or selection. Faster than Tab/Shift+Tab when you need to adjust indentation of specific blocks.
Search and Replace: Find Anything, Anywhere
Search in File (Cmd/Ctrl + F)
Basic search. But most people miss the powerful options:
- •Regex mode (the .* button) -- search with regular expressions
- •Match case -- case-sensitive search
- •Match whole word -- avoid partial matches
Search Across Files (Cmd/Ctrl + Shift + F)
Search the entire project. This is your grep replacement. Use the file filter options to narrow down to specific folders or file types.
Replace in File (Cmd/Ctrl + H)
Find and replace with preview. You can see every change before applying it, and replace one at a time or all at once.
Terminal and Panel Shortcuts
Toggle Terminal (Ctrl + Backtick)
Open/close the integrated terminal without leaving VS Code. No more switching between windows.
Create New Terminal (Ctrl + Shift + Backtick)
Open a new terminal instance. Useful when you need one terminal for running the dev server and another for running commands.
Toggle Sidebar (Cmd/Ctrl + B)
Hide the sidebar to get more editing space. Especially useful on smaller screens.
Toggle Panel (Cmd/Ctrl + J)
Show/hide the bottom panel (terminal, output, problems). Maximize your code view when you do not need the terminal.
The Shortcuts Nobody Talks About
Quick Fix (Cmd/Ctrl + .)
This is criminally underused. When VS Code shows a lightbulb icon or underlines something, press Cmd+. to see suggested fixes. It can auto-import modules, add missing types, fix linting errors, and extract variables -- all automatically.
Rename Symbol (F2)
Right-click renaming is for amateurs. Press F2 on any variable, function, or class name, type the new name, and it renames every reference across your entire project. This is not find-and-replace -- it understands scope and only renames actual references.
Format Document (Shift + Alt + F)
Formats the entire document according to your formatter settings (Prettier, ESLint, etc.). No more manually fixing indentation.
Fold/Unfold Code (Cmd/Ctrl + Shift + [ / ])
Collapse or expand code blocks. When you are working with a long file and need to focus on one section, fold everything else.
Zen Mode (Cmd/Ctrl + K, Z)
Full-screen, distraction-free editing. Hides everything except the code. Press Escape twice to exit.
Building Muscle Memory
Knowing these shortcuts is not enough. You need to stop yourself every time you reach for the mouse and ask: "Is there a shortcut for this?"
The awkward phase lasts about two weeks. After that, the shortcuts become automatic, and you will wonder how you ever worked without them.
One practical tip: Pick three shortcuts from this list that would help you most, and force yourself to use them exclusively for one week. Then add three more. In a month, your workflow will be unrecognizable.
The fastest developers are not the ones who type fast. They are the ones who never take their hands off the keyboard.
Check out more productivity tips on our blog and explore our free developer tools.