Hello and welcome to my blog! Today, I'm excited to share with you a valuable resource that will significantly enhance your coding experience.
|
| Useful Visual Studio Code Shortcuts - GraphCodeX |
We'll dive into the world of Visual Studio Code shortcuts, uncovering a treasure trove of time-saving keyboard combinations. These shortcuts are designed to streamline your workflow, boost your coding productivity, and make your life as a developer much easier.
From navigating through your codebase effortlessly to accessing powerful features with just a few keystrokes, these shortcuts will empower you to write code faster and more efficiently.
Get ready to unlock the full potential of Visual Studio Code and take your coding skills to new heights. Let's dive in!
GENERAL
| Shortcut Keys |
Function |
Explanation |
| Ctrl+Shift+P |
Show Command Palette |
Displays a command palette that allows you to quickly access various commands and features in Visual Studio Code. |
| Ctrl+P |
Quick Open, Go to File... |
Allows you to quickly open files in your project by typing their names or searching for them using fuzzy search. |
| Ctrl+Shift+N |
New window/instance |
Launches a new instance of Visual Studio Code in a new window. |
| Ctrl+Shift+W |
Close window/instance |
Closes the current window or instance of Visual Studio Code. |
| Ctrl+, |
User Settings |
Opens the user settings file in Visual Studio Code, allowing you to configure various settings and preferences. |
| Ctrl+K Ctrl+S |
Keyboard Shortcuts |
Opens the keyboard shortcuts editor in Visual Studio Code, allowing you to view, edit, and customize keyboard shortcuts. |
| Ctrl+Shift+E |
Show Explorer / Toggle focus |
Shows or hides the Explorer panel, which allows you to navigate and manage files and folders in your project. |
| Ctrl+Shift+F |
Search in all files |
Opens the "Search" view in Visual Studio Code, allowing you to search for text in all files in your project at once. |
| Ctrl+Shift+H |
Replace in all files |
Opens the "Replace" view in Visual Studio Code, allowing you to search and replace text inall files in your project at once. |
| Ctrl+Shift+G |
Show git commands |
Opens the Git panel in Visual Studio Code, allowing you to access various Git commands and features, such as committing changes, pushing and pulling changes, and viewing the Git history. |
| Ctrl+Shift+D |
Show debug commands |
Opens the Debug panel in Visual Studio Code, allowing you to access various debugging commands and features, such as setting breakpoints, stepping through code, and inspecting variables. |
BASIC EDITING
| Shortcut Keys |
Function |
Explanation |
| Ctrl+X |
Cut line (empty selection) |
This shortcut key cuts the current line of code when there is no text selected. |
| Ctrl+C |
Copy line (empty selection) |
This shortcut key copies the current line of code when there is no text selected. |
| Alt+↑/↓ |
Move line up/down |
This shortcut key moves the current line of code up or down within the file. |
| Shift+Alt+↑/↓ |
Copy line up/down |
This shortcut key copies the current line of code and pastes it above or below the current line. |
| Ctrl+Shift+K |
Delete line |
This shortcut key deletes the current line of code. |
| Ctrl+Enter |
Insert line below |
This shortcut key inserts a new line of code below the current line. |
| Ctrl+Shift+Enter |
Insert line above |
This shortcut key inserts a new line of code above the current line. |
| Ctrl+Shift+\ |
Jump to matching bracket |
This shortcut key jumps the cursor to the matching bracket (parenthesis, square bracket, or curly brace) in the code. |
| Ctrl+]/[ |
Indent/outdent line |
This shortcut key indents or outdents the current line of code one level. |
| Home / End |
Go to beginning/end of line |
These shortcut keys movethe cursor to the beginning or end of the current line of code. |
| Ctrl+Home |
Go to beginning of file |
This shortcut key moves the cursor to the beginning of the file. |
| Ctrl+End |
Go to end of file |
This shortcut key moves the cursor to the end of the file. |
| Ctrl+↑/↓ |
Scroll line up/down |
This shortcut key scrolls the editor view up or down one line. |
| Alt+PgUp/PgDn |
Scroll page up/down |
This shortcut key scrolls the editor view up or down one page. |
| Ctrl+Shift+[ |
Fold (collapse) region |
This shortcut key collapses the current block of code. |
| Ctrl+Shift+] |
Unfold (uncollapse) region |
This shortcut key expands the current collapsed block of code. |
| Ctrl+K Ctrl+[ |
Fold (collapse) all subregions |
This shortcut key collapses all nested blocks of code within the current block. |
| Ctrl+K Ctrl+] |
Unfold (uncollapse) all subregions |
This shortcut key expands all nested blocks of code within the current block. |
| Ctrl+K Ctrl+0 |
Fold (collapse) all regions |
This shortcut key collapses all blocks of code within the file. |
| Ctrl+K Ctrl+J |
Unfold (uncollapse) all regions |
This shortcut key expands all collapsed blocks of code within the file. |
| Ctrl+K Ctrl+C |
Add line comment |
This shortcut keycomments out the current line of code. |
| Ctrl+K Ctrl+U |
Remove line comment |
This shortcut key removes the comment from the current line of code. |
| Ctrl+/ |
Toggle line comment |
This shortcut key toggles the comment status of the current line of code. |
| Shift+Alt+A |
Toggle block comment |
This shortcut key toggles the comment status of a selected block of code. |
| Alt+Z |
Toggle word wrap |
This shortcut key toggles word wrap on or off for the editor view. |
NAVIGATION
| Shortcut |
Function |
Explanation |
| Ctrl+T |
Show all Symbols |
Displays a list of symbols (functions, variables, classes, etc.) in the current file or project |
| Ctrl+G |
Go to Line... |
Navigates to a specific line number in the current file |
| Ctrl+P |
Go to File... |
Opens a dialog to quickly navigate to a specific file in the project |
| Ctrl+Shift+O |
Go to Symbol... |
Allows you to search and navigate to a specific symbol (function, class, variable, etc.) in the project |
| Ctrl+Shift+M |
Show Problems panel |
Displays a panel that lists any errors or warnings in the current project |
| F8 |
Go to next error or warning |
Moves the cursor to the next error or warning in the file |
| Shift+F8 |
Go to previous error or warning |
Moves the cursor to the previous error or warning in the file |
| Ctrl+Shift+Tab |
Navigate editor group history |
Cycles through the recently accessed editor groups or tabs |
| Alt+-/- |
Go back / forward |
Navigates backward or forward through the navigation history |
SEARCH AND REPLACE
| Shortcut |
Function |
Explanation |
| Ctrl+F |
Find |
Opens the Find dialog to search for a specific text in the current file |
| Ctrl+H |
Replace |
Opens the Replace dialog to find and replace specific text in the current file |
| F3/Shift+F3 |
Find next/previous |
Moves the cursor to the next or previous occurrence of the searched text |
| Alt+Enter |
Select all occurrences of Find match |
Selects all instances of the found text in the file |
| Ctrl+D |
Add selection to next Find match |
Selects the current occurrence and adds the next occurrence of the searched text to the selection |
| Ctrl+K Ctrl+D |
Move last selection to next Find match |
Moves the last selection made to the next occurrence of the searched text |
| Alt+C/R/W |
Toggle case-sensitive/regex/whole word |
Toggles between case-sensitive search, regular expression search, and whole-word search options |
MULTI-CURSOR AND SELECTION
| Shortcut |
Function |
Explanation |
| Alt+Click |
Insert cursor |
Allows you to insert multiple cursors at different locations by clicking with the Alt key held down |
| Ctrl+Alt+ ↑/↓ |
Insert cursor above/below |
Inserts a cursor above or below the current cursor position |
| Ctrl+U |
Undo last cursor operation |
Undoes the last cursor operation, such as adding or removing a cursor |
| Shift+Alt+I |
Insert cursor at end of each line selected |
Places a cursor at the end of each line within the selected block or range |
| Ctrl+L |
Select current line |
Selects the entire current line where the cursor is positioned |
| Ctrl+Shift+L |
Select all occurrences of current selection |
Selects all instances of the currently selected text in the file |
| Ctrl+F2 |
Select all occurrences of current word |
Selects all instances of the word currently under the cursor |
| Shift+Alt+→ |
Expand selection |
Expands the current selection to the right |
| Shift+Alt+← |
Shrink selection |
Decreases the size of the current selection by moving the selection boundary to the left |
| Shift+Alt+(drag mouse) |
Column (box) selection |
Allows you to select a rectangular block of text by dragging the mouse pointer while holding Shift and Alt keys |
| Ctrl+Shift+Alt+(arrow key) |
Column (box) selection |
Enables column (box) selection by using arrow keys in combination with Ctrl, Shift, and Alt keys |
| Ctrl+Shift+Alt+PgUp/PgDn |
Column (box) selection page up/down |
Extends the column (box) selection to the previous or next page in the editor |
RICH LANGUAGES EDITING
| Shortcut |
Function |
Explanation |
| Ctrl+Space |
Trigger suggestion |
Displays a list of suggestions or completions based on the current context |
| Ctrl+Shift+Space |
Trigger parameter hints |
Displays hints or information about function parameters while typing |
| Shift+Alt+F |
Format document |
Automatically formats the entire document according to the predefined formatting rules |
| Ctrl+K Ctrl+F |
Format selection |
Formats the selected portion of the document according to the predefined formatting rules |
| F12 |
Go to Definition |
Navigates to the definition of the symbol at the current cursor position |
| Alt+F12 |
Peek Definition |
Shows the definition of the symbol at the current cursor position in a peek window without changing the editor focus |
| Ctrl+K F12 |
Open Definition to the side |
Opens the definition of the symbol at the current cursor position in a side-by-side editor view |
| Ctrl+. |
Quick Fix |
Shows a list of quick fixes or suggestions to resolve errors or improve code |
| Shift+F12 |
Show References |
Displays all references to the symbol at the current cursor position |
| F2 |
Rename Symbol |
Renames the symbol at the current cursor position and updates all references to it |
| Ctrl+K Ctrl+X |
Trim trailing whitespace |
Removes any extra whitespace at the end of each line in the selected portion of the document |
| Ctrl+K M |
Change file language |
Allows you to change the language or syntax highlighting for the current file |
EDITOR MANAGEMENT
| Shortcut |
Function |
Explanation |
| Ctrl+F4 |
Close editor |
Closes the currently active editor or tab |
| Ctrl+W |
Close editor |
Alternative shortcut to close the currently active editor or tab |
| Ctrl+KF |
Close folder |
Closes the currently opened folder or workspace |
| Ctrl+\ |
Split editor |
Splits the editor area horizontally, creating two editor panes side by side |
| Ctrl+1/2/3 |
Focus into 1, 2 or 3 editor group |
Focuses the keyboard input into the specified editor group (pane) |
| Ctrl+K Ctrl+←/→ |
Focus into previous/next editor group |
Switches the focus to the previous or next editor group (pane) |
| Ctrl+Shift+PgUp/PgDn |
Move editor left/right |
Moves the currently active editor or tab to the left or right |
| Ctrl+K+←/→ |
Move active editor group |
Moves the active editor group (pane) to the left or right within the editor area |