VS Code Shortcut Practice

How to use
STARTSTOP
*Toggle input mode: ctrl + shift + alt + space
PRE
NEXT
Exclude this question from the list
Restore excluded questions
Get a URL for the current exclusions
https://command-lab.com
Copy
Guide mode
Repeat mode

*Recommended browser: Google Chrome

PUSH ENTER
If you enjoy this site, please share it — it keeps us motivated to keep improving!

VS Code Keyboard Shortcuts: Full List (57 shortcuts)

Every VS Code keyboard shortcut used in the practice above, listed in full. Each row shows the Windows and Mac keys plus a short explanation of what the shortcut does. Find one you want to learn, then drill it above until your fingers remember it.

Editing

VS Code — Editing
Action Windows Mac What it does
Insert a blank line below the line where the cursor is Ctrl+Enter +Enter Inserts a new blank line below the current line and moves the cursor there, without splitting the line at the cursor's position. Useful when you want to add a new line of code while the cursor is in the middle of existing text.
Insert a blank line above the cursor line Ctrl+Shift+Enter ++Enter Inserts a new blank line above the current line and moves the cursor there. Handy when you want to add space above the current line — for example, just before a function — without disturbing the line itself.
Copy the contents of the cursor line up Alt+Shift+ ++ Duplicates the line the cursor is on and inserts the copy directly above it. Useful when you want to write similar lines of code side by side, or add a slightly modified version based on the current line.
Copy the contents of the cursor line below Alt+Shift+ ++ Duplicates the line the cursor is on and inserts the copy directly below it. Useful when you want to write similar lines of code side by side, or add a slightly modified version based on the current line.
Add indent to line Ctrl+] +] Adds one level of indentation to the current line, or to all selected lines. Use it to express nested structure in code, such as the body of an if statement or a for loop.
Remove line indent Ctrl+[ +[ Removes one level of indentation from the current line, or from all selected lines. Use it when you want to shift deeply nested code up by one level.
Copy the line where the cursor is Ctrl+C +C When nothing is selected, this copies the entire line the cursor is on to the clipboard. Handy when you want to copy a whole line without having to drag-select it first.
paste Ctrl+V +V Pastes the content you copied or cut to the clipboard at the cursor's position. If you copied a whole line, it's inserted as a new line above the cursor's current line.
Cut the line where the cursor is Ctrl+X +X When nothing is selected, this cuts the entire line the cursor is on and moves it to the clipboard. Use it when you want to remove a line but also paste it elsewhere later.
paste Ctrl+V +V Pastes the line you cut to the clipboard at the cursor's new position. Use it right after cutting a line, once you've moved the cursor to where you want it placed.

Navigation

VS Code — Navigation
Action Windows Mac What it does
Move contents of cursor line up Alt+ + Moves the line the cursor is on up by one line, swapping places with the line above, without changing its content. Lets you quickly reorder code without cutting and pasting.
Move the contents of the cursor line down Alt+ + Moves the line the cursor is on down by one line, swapping places with the line below, without changing its content. Lets you quickly reorder code without cutting and pasting.
Move to beginning of line Home +A Jumps the cursor straight to the beginning of the current line. Frequently used when you want to start typing from the beginning of a line, or return to just before its indentation.
Move to end of line End +E Jumps the cursor straight to the end of the current line. Lets you quickly start editing at the end of a line, such as adding a semicolon or comma.
Jump to line 20 Ctrl+G 2 0 Enter +G 2 0 Enter Lets you type a line number directly and jump straight to that line. Useful when an error message points to a specific line and you want to get there immediately.
Move focus to sidebar Ctrl+0 +0 Moves keyboard focus from the editor to the sidebar. Use it when you want to navigate the file tree with the arrow keys instead of the mouse.
Jump to the beginning of a word Ctrl+ + Moves the cursor from its current position to the beginning of the word (just after the previous delimiter). Faster than moving one character at a time with the arrow keys when you want to navigate word by word.
Jump to the back of the word Ctrl+ + Moves the cursor from its current position to the end of the next word (just before the next delimiter). Faster than moving one character at a time with the arrow keys when you want to navigate word by word.
Move to beginning of file Ctrl+Home + Jumps the cursor straight to the very beginning of the file. Useful when you want to quickly check the import statements or header comment at the top of a long file.
Move to end of file Ctrl+End + Jumps the cursor straight to the very end of the file. Useful for reaching the latest line of a log file, or for appending new code at the bottom of a file.

Comments

VS Code — Comments
Action Windows Mac What it does
Make line comment Ctrl+/ +/ Comments out the current line, or all selected lines, using the comment syntax for the file's language. Commonly used to temporarily disable a piece of code while debugging.
Uncomment line Ctrl+/ +/ Removes the line comment markers from a commented-out line, turning it back into active code. It uses the same shortcut as commenting — running it on an already-commented line toggles the comment off.
Make a block comment Alt+Shift+A ++Å Wraps the selected range in block comment syntax, such as /* */. Use it where line comments aren't available, or when you want to wrap multiple lines together as a single comment block.
Remove block comment Alt+Shift+A ++Å Removes the block comment markers /* */ that surrounded a range, turning it back into active code. It uses the same shortcut as adding a block comment — running it on an already-commented range removes it.

View

VS Code — View
Action Windows Mac What it does
Toggle word wrap Alt+Z +Ω Toggles whether long lines wrap to fit within the editor window, or extend off-screen requiring horizontal scrolling. Useful for making files with long comments or prose easier to read.
Increase the font size etc. Ctrl+Shift++ ++; Increases the font size and related display elements in the editor. Use it when the text is hard to read, or when you want to make code more visible during a screen share.
Reduce the font size etc. Ctrl+- +- Decreases the font size and related display elements in the editor. Use it when you want to fit more code on the screen, or to undo a display that's been zoomed in too far.

Selection

VS Code — Selection
Action Windows Mac What it does
Select word with cursor Ctrl+D +D Selects the whole word at the cursor's position. Gives the same result as double-clicking a word, but without leaving the keyboard.
Select 4 words with cursor Ctrl+D Ctrl+D Ctrl+D +D +D +D Extends the selection to include the next occurrence of the same word that's already selected. Each additional press adds one more match, setting up a multi-cursor edit across several matching spots at once.
Select current line Ctrl+L +L Selects the entire line the cursor is on. Saves you the trouble of selecting from the start to the end of the line manually, so you can immediately delete or restyle the whole line.
Select two lines below the current line Ctrl+L Ctrl+L +L +L After selecting the current line, pressing the same key again extends the selection down by one more line at a time. Use it when you want to select and manipulate several lines at once, such as for deletion or moving.
Expand Action Smart Select by 2 Alt+Shift+ Alt+Shift+ +++ +++ Expands the selection outward through nested syntax units — word, expression, statement, and so on — starting from the cursor's position. Each additional press widens the selection by one more level.
Reduce Action Smart Select by two Alt+Shift+ Alt+Shift+ +++ +++ Shrinks the selection made with Smart Select back inward by one level at a time. Use the reverse-direction key when you've expanded the selection too far and want to pull it back in.

Search & replace

VS Code — Search & replace
Action Windows Mac What it does
Search in editor Ctrl+F +F Searches for a specific string within the currently open file. A search box appears in the top-right of the screen, highlighting matches so you can jump between them one by one.
Replace in editor Ctrl+H ++Ƒ Replaces a string within the currently open file with another string. A replacement input field appears below the search box, letting you replace matches one at a time or all at once.
Search entire folder/workspace Ctrl+Shift+F ++F Searches for a string across the entire folder or workspace, not just the currently open file. Use it when you need to find every file that references a particular function or variable.
Replace entire folder/workspace Ctrl+Shift+H ++H Replaces a string across the entire folder or workspace at once. Useful for renaming a variable or function across many files, though it's important to review the matches before confirming since the scope is broad.

UI operations

VS Code — UI operations
Action Windows Mac What it does
Open sidebar Ctrl+B +B Toggles the visibility of the sidebar, which shows the Explorer and other views. Running it while the sidebar is hidden brings the file tree back into view.
Close sidebar Ctrl+B +B Toggles the visibility of the sidebar. Run it when you want to temporarily hide the file tree to give the editor area more room. The same key toggles it back on.
Open explorer Ctrl+Shift+E ++E Opens the file tree (Explorer) in the sidebar. This is usually the first view you switch to when you want to open a different file in the project.
Open search Ctrl+Shift+F ++F Opens the dedicated Search view in the sidebar. Unlike in-editor find, this opens a panel for searching and replacing across the entire project.
Open the setting screen Ctrl+, +, Opens the Settings screen where you can change VSCode's various options. Use it to customize the editor's overall behavior, such as font size, theme, or auto save.
Open source control Ctrl+Shift+G ++G Opens the Source Control view, which shows the current Git status. Use it when you want to see the list of changed files, stage them, or commit through the GUI instead of the command line.
Open debug Ctrl+Shift+D ++D Opens the Debug view, where you manage debug runs and breakpoints. Use it when you want to step through a program while inspecting variable values.
Open extension Ctrl+Shift+X ++X Opens the view for searching, installing, and managing extensions. Use it when you want to add new functionality to VSCode, such as language support or a new theme.
Open panel Ctrl+J +J Toggles the visibility of the panel at the bottom of the screen, which shows the terminal, output, and similar views. Running it while the panel is hidden brings it back into view.
Close panel Ctrl+J +J Toggles the visibility of the panel at the bottom of the screen. Run it when you want to temporarily hide the terminal or output to give the editor area more room. The same key toggles it back on.
Open output Ctrl+Shift+U ++U Opens the Output panel, which shows logs from extensions and build tools. Use it when something isn't working as expected and you need to check messages that explain what went wrong.
Close output Ctrl+Shift+U ++U Toggles the visibility of the Output panel. Run it after you've finished checking the logs and want to close the panel to free up space in the editor area.
Open the problem Ctrl+Shift+M ++M Opens the Problems panel, which lists errors and warnings found in your code. Use it to check for syntax or type errors all at once before saving a file.
Close the problem Ctrl+Shift+M ++M Toggles the visibility of the Problems panel. Run it after you've finished checking for errors and want to close the panel to free up space in the editor area.
Open debug console Ctrl+Shift+Y ++Y Opens the Debug Console, where you can print variable values or evaluate expressions while a debug session is running. Use it when you've paused at a breakpoint and want to inspect or change values on the spot.
Close debug console Ctrl+Shift+Y ++Y Toggles the visibility of the Debug Console. Run it once you're done debugging and want to close the panel to free up space in the editor area.

Basic operations

VS Code — Basic operations
Action Windows Mac What it does
overwrite save Ctrl+S +S Saves the file being edited, overwriting the existing version on disk. It's good practice to run this frequently while working so you don't lose your changes.
save as Ctrl+Shift+S ++S Saves the content you're editing under a new file name or in a different location. Use it when you want to keep the original file intact while creating a separate copy or version.

Editor

VS Code — Editor
Action Windows Mac What it does
Create a second editor group Ctrl+2 +2 Creates a second editor group next to the current one, splitting the editor area. Use it when you want to view and edit two files side by side.
Move to first editor group Ctrl+1 +1 Moves focus to the first (leftmost) editor group when the editor area is split. Use it to jump back to the left-side file when working across a split view.
Back to top