Most Useful VScode Shortcuts
·1691 words·8 mins·
0
·
0
·
VScode
Introduction #
Visual Studio Code (VScode) is a powerful code editor, and mastering its keyboard shortcuts can greatly enhance your productivity. This article serves as a comprehensive cheat sheet for some of the most useful VScode keyboard shortcuts. The shortcuts may vary slightly depending on your operating system (Linux, Windows, or MacOS).
Editing #
Shortcut | Description |
---|---|
Ctrl + X |
Cut the current line (no need for selection). |
Ctrl + C |
Copy the current line (no need for selection). |
Alt + ↓/↑ |
Move the current line up or down. |
Ctrl + / |
Toggle line comment for the current line or selection. |
Ctrl + Shift + I |
Format the entire document. |
Ctrl + . |
Trigger quick fixes and suggestions. |
F12 |
Rename the symbol under the cursor. |
Ctrl + H |
Open the Find and Replace dialog. |
Display #
Shortcut | Description |
---|---|
F11 |
Toggle full-screen mode. |
Ctrl + B |
Toggle the sidebar. |
Ctrl + K V |
Show a Markdown preview of the current file. |
Ctrl + K Z |
Enter or exit Zen mode, providing a distraction-free environment. |
Ctrl + \ |
Split the editor. Change the active pane with Ctrl + 1, 2, 3, etc. |
`Ctrl + `` | Show or hide the terminal (backtick). |
Navigation #
Shortcut | Description |
---|---|
Ctrl + G |
Go to a specific line in the file. |
Ctrl + Alt/Shift + - |
Navigate back/forward through the cursor’s location history. |
Ctrl + P |
Quickly open files or navigate to a specific file. |
Ctrl + K Z |
Enter or exit Zen mode, offering a full-screen editor with no distractions. |
Ctrl + T |
Show all symbols in the current file. |
Ctrl + Shift + O |
Go to a specific symbol within the current file. |
Debug #
Shortcut | Description |
---|---|
F8 |
Go to the next error or warning in the Problems panel. |
F9 |
Toggle a breakpoint at the current line. |
F5 |
Start or continue debugging. |
F11/Shift+F11 |
Step into or out of a function during debugging. |
Source Control #
Shortcut | Description |
---|---|
Ctrl + Shift + G |
Open the source control (Git) panel. |
Ctrl + Shift + J |
Open the source control (SVN) panel. |
Terminal #
Shortcut | Description |
---|---|
`Ctrl + `` | Create a new terminal. |
`Ctrl + Shift + `` | Create a new terminal in split view. |
Extensions #
Shortcut | Description |
---|---|
Ctrl + Shift + P |
Show the command palette, allowing you to run various VScode commands and extensions. |
Ctrl + Shift + X |
Open the Extensions view, where you can manage your VScode extensions. |
Ctrl + K Ctrl + X |
Show the Extensions menu for quick extension management. |
Ctrl + Shift + C |
Install new extensions directly from VScode. |
Ctrl + Shift + I |
Show the extensions installed in the current workspace. |
Integrated Terminal #
Shortcut | Description |
---|---|
Ctrl + C |
Terminate the currently running command in the integrated terminal. |
Ctrl + Space |
Trigger code suggestions and auto-completion in the integrated terminal. |
Ctrl + Up |
Scroll up in the integrated terminal. |
Ctrl + Down |
Scroll down in the integrated terminal. |
Zen Mode #
Shortcut | Description |
---|---|
Ctrl + K Z |
Enter or exit Zen mode, providing a full-screen editor with no distractions. |
Search and Replace #
Shortcut | Description |
---|---|
Ctrl + F |
Open the Find dialog to search for text in the current file. |
Ctrl + H |
Open the Replace dialog to find and replace text in the current file. |
F3 |
Find the next occurrence of the search term. |
Shift + F3 |
Find the previous occurrence of the search term. |
Alt + Enter |
Select all occurrences of the search term in the document. |
Ctrl + F2 |
Select all occurrences of the current word under the cursor. |
Ctrl + D |
Add the current selection to the next find match. |
Version Control #
Shortcut | Description |
---|---|
Ctrl + Shift + K |
Commit changes to your version control system (e.g., Git). |
Ctrl + Alt + M |
Resolve merge conflicts when working with version control. |
Ctrl + Alt + S |
Push changes to your version control system. |
Ctrl + Alt + U |
Pull changes from your version control system. |
Ctrl + Shift + L |
Open the Source Control Status view. |
Files and Folders #
Shortcut | Description |
---|---|
Ctrl + N |
Create a new file. |
Ctrl + O |
Open an existing file. |
Ctrl + S |
Save the current file. |
Ctrl + W |
Close the current file. |
Ctrl + F4 |
Close the active editor. |
Ctrl + K Ctrl + O |
Show the current file in the File Explorer. |
Ctrl + K P |
Copy the file path of the current file to the clipboard. |
Debugging #
Shortcut | Description |
---|---|
F9 |
Add or remove a breakpoint at the current line. |
F10 |
Step over while debugging. |
Shift + F5 |
Stop the debugging session. |
Ctrl + Shift + F5 |
Restart the debugging session. |
Emmet Abbreviations #
Shortcut | Description |
---|---|
Tab |
Expand Emmet abbreviations when working with HTML and CSS. |
Code Navigation #
Shortcut | Description |
---|---|
Alt + Left/Right |
Navigate back and forward between cursor positions. |
Ctrl + - |
Go to the last edit location. |
Ctrl + F6 |
Navigate editor group history. |
Ctrl + M |
Toggle the menu bar. |
Ctrl + T |
Go to a specific file symbol within the current file. |
Git Lens (if you have the extension installed) #
Shortcut | Description |
---|---|
Alt + G |
Toggle Git Lens Blame to see the Git blame annotation. |
Alt + P |
Toggle Git Lens Previous Changes to see previous changes in Git. |
Alt + N |
Toggle Git Lens Next Changes to see next changes in Git. |
Alt + Shift + P |
Toggle Git Lens Uncommitted Changes to see uncommitted changes. |
Alt + Shift + N |
Toggle Git Lens Current Changes to see current changes in Git. |
Code Folding #
Shortcut | Description |
---|---|
Ctrl + (K, 0-9) |
Fold or unfold code levels from 1 to 9. |
Ctrl + K Ctrl + 0 |
Fold or unfold all code levels. |
Ctrl + (K, J) |
Fold all code in the editor. |
Ctrl + (K, L) |
Unfold all code in the editor. |
Multi-Cursor and Selection #
Shortcut | Description |
---|---|
Alt + Click |
Add a new cursor at the clicked location. |
Ctrl + Alt + Down |
Add a cursor below the current line. |
Ctrl + Alt + Up |
Add a cursor above the current line. |
Shift + Alt + I |
Insert a cursor at the end of each line in the current selection. |
Commenting #
Shortcut | Description |
---|---|
Ctrl + K Ctrl + C |
Comment the selected lines. |
Ctrl + K Ctrl + U |
Uncomment the selected lines. |
Zen Mode #
Shortcut | Description |
---|---|
Ctrl + K Z |
Enter or exit Zen mode, providing a full-screen editor with no distractions. |
Emmet Actions #
Shortcut | Description |
---|---|
Ctrl + Alt + Enter |
Expand an abbreviation with Emmet. |
Tab |
Expand an abbreviation when working with Emmet. |
Selection and Navigation #
Shortcut | Description |
---|---|
Ctrl + D |
Select the word under the cursor or the next occurrence of the word. |
Ctrl + U |
Undo the last cursor operation. |
Ctrl + L |
Select the entire current line. |
Ctrl + Shift + L |
Select all occurrences of the current selection. |
Ctrl + Alt + Down |
Add cursors below the current cursor positions. |
Ctrl + Alt + Up |
Add cursors above the current cursor positions. |
Ctrl + Left/Right |
Move the cursor to the beginning or end of the current word. |
Indentation #
Shortcut | Description |
---|---|
Tab |
Indent the current line or selected lines. |
Shift + Tab |
Outdent the current line or selected lines. |
Ctrl + [ / ] |
Indent or outdent the current line or selected lines. |
Formatting #
Shortcut | Description |
---|---|
Ctrl + K Ctrl + F |
Format the entire document according to the language-specific rules. |
Ctrl + K Ctrl + S |
Sort the lines in the selection. |
Alt + Shift + F |
Format the current selection according to the language-specific rules. |
Terminal #
Shortcut | Description |
---|---|
Ctrl + T |
Create a new terminal. |
Ctrl + W |
Close the terminal panel. |
Ctrl + K Ctrl + C |
Copy the current selection from the terminal. |
Ctrl + K Ctrl + V |
Paste the clipboard content into the terminal. |
Ctrl + Home/End |
Scroll to the top or bottom of the terminal. |
Code Actions #
Shortcut | Description |
---|---|
Alt + Enter |
Show available code actions, including quick fixes and refactorings. |
Ctrl + . |
Trigger the Quick Fix and refactoring menu for the selected code. |
Extensions #
Shortcut | Description |
---|---|
Ctrl + Shift + P |
Show the command palette for running VScode commands and extensions. |
Ctrl + Shift + X |
Open the Extensions view for managing VScode extensions. |
Ctrl + K Ctrl + X |
Show the Extensions menu for quick extension management. |
Ctrl + Shift + C |
Install new extensions directly from VScode. |
Ctrl + Shift + I |
Show the extensions installed in the current workspace. |
Git Integration #
Shortcut | Description |
---|---|
Ctrl + Alt + G |
Stage changes in Git. |
Ctrl + Shift + D |
Show the Git Changes view. |
Ctrl + Alt + C |
Open the Git Blame annotation for the current line. |
Ctrl + K Ctrl + G |
Show the Git Graph for a visual representation of Git history. |
Debugging #
Shortcut | Description |
---|---|
F9 |
Add or remove breakpoints in your code. |
F10 |
Step over functions while debugging. |
Shift + F5 |
Stop the debugging session. |
F11/Shift+F11 |
Step into or out of functions while debugging. |
Intellisense #
Shortcut | Description |
---|---|
Ctrl + Space |
Trigger code suggestions and auto-completion. |
Ctrl + Shift + Space |
Trigger parameter hints for function calls. |
Markers #
Shortcut | Description |
---|---|
F2 |
Go to the next error or warning in the current file. |
Shift + F2 |
Go to the previous error or warning in the current file. |
Ctrl + F8 |
Toggle code markers in the editor. |
Ctrl + Shift + F8 |
Show code markers in the Problems panel. |
Miscellaneous #
Shortcut | Description |
---|---|
Ctrl + P |
Use Quick Open to quickly navigate to a file. |
Ctrl + T |
Go to a specific file symbol in the workspace. |
Ctrl + E |
Show the list of recent files. |
Ctrl + J |
Toggle various panels (Output, Terminal, Problems, etc.). |
Ctrl + K Ctrl + M |
Change the language mode for the current file. |
These shortcuts cover a wide range of actions within VScode, and mastering them can significantly improve your coding efficiency. Feel free to refer back to this cheat sheet whenever you need a quick reminder of a particular shortcut.
Related
Nmap the Network Testing Tool
·1321 words·7 mins·
0
·
0
Security
Nmap
Pentesting with Nmap the Network Testing Tool (with Cheat Sheets)
Bash Scripting
·817 words·4 mins·
0
·
0
Linux
MacOS
Tutorial
bash
A Comprehensive Beginner’s Guide to Bash
Cryptocurrency and Blockchain
·385 words·2 mins·
0
·
0
Cryptocurrency
Introduction to Cryptocurrency and Blockchain