Here are some important Visual Studio Code shortcuts you should know to become more productive in your coding.
Multiple Cursors
Using multiple cursors in VSCode
Multiple cursors allow you to simultaneously place more than one cursor at different locations within your code.
Ctrl
+
Alt
+ Arrow Up or Down
It is particularly useful for performing repetitive tasks, such as making the same edit in different lines of code.
Command Palette
The Command Palette allows you to access and execute all the available commands.
Ctrl
+ Shift + P
You can use it to find and run any command without memorizing specific keyboard shortcuts, such as to search for symbols, install extensions, configure settings, etc.
Move A Line
This shortcut allows you to quickly move the selected line or lines of code up or down without cutting and pasting them.
Alt
+ Arrow Up or Down
You can rearrange code blocks, reorder lines, or organize your code structure easily.
Copy A Line
Copy a line VSCode keyboard shortcut
This shortcut is useful for duplicating selected lines of code.
Shift +
Alt
+ Up or Down
It allows you to copy the current line or selection and place it above or below the original line.
Toggle Sidebar
Sometimes, you want to view the full screen of your editor to focus solely on your code without distractions.
Ctrl
+ B
Use this command to hide or reveal the sidebar, allowing you to have more space for viewing and editing code when needed.
Toggle Terminal
The terminal is where you can run command-line tasks, execute scripts, and compile code within your editor.
Ctrl
+ ` (backtick)
This shortcut lets you quickly show or hide the terminal to free up space in the editor when you don’t need to use it.
Open Multiple Terminals
Open multiple Terminals in VSCode
This shortcut opens a new terminal tab, which is handy when you need to run multiple terminal commands simultaneously.
Ctrl
+ Shift + ` (backtick)
For example, you might want to run a dev server in one terminal tab while executing test commands in another.
Split View
Splitting the editor view is useful when working on multiple files or sections of code simultaneously.
Ctrl
+ \
While writing code, you can compare parts of the same file, edit multiple files side by side, or reference documentation.
Quick Open Files
You can search and open files simply by typing a few characters, and VS Code will filter the list of files to find the one you’re looking for.
Ctrl
+ P
This is one of the most useful shortcuts for navigating large codebases quickly when you need to jump from one file to another.
Find A Symbol
It opens the Go to Symbol tool, which lists symbols in the current file for easy navigation and allows you to quickly find specific symbols, such as functions, classes, or properties, anywhere in your codebase.
Ctrl
+ Shift + O
Multiple Selections
It is useful for quickly making multiple edits to similar pieces of code or changing one string in many places.
Ctrl
+ D
Place the cursor on a word or a selection and use this shortcut to select the next occurrence of that word or selection.
You can also select multiple occurrences.
Switch Tabs
This VSCode keyboard shortcut is useful for swapping files opened in the editor.
Ctrl
+ PageUp or PageDown
You can easily move to your editor’s next or previous open tabs without using the mouse.
Move Tabs
You can use this to rearrange the order of your tabs by moving the current editor tab to the left or right.
Ctrl
+ Shift + PageUp or PageDown
It provides an easy way to quickly organize tabs when you need to reposition a specific tab.
Go to Line
Go to a specific line in VSCode
You can use this shortcut to navigate to a specific line in the file.
Ctrl
+ G
You can enter the line number you want to jump directly to that line in your file.
Comment Lines or Code Block
Adding or removing comments in the code is one of the most useful shortcuts.
Ctrl
+ /
Select the code block or line you want to comment on and press
Ctrl
+ /.
It’s a quick and efficient way to add comments to your code or temporarily turn off code blocks for debugging or testing.
Format Document
This feature adjusts the format and indentation of the entire document according to the configured settings.
Shift +
Alt
+ F
You can keep your code clean and readable and easily spot errors by formatting your document.
Format Selection
It allows you to format only the selected text according to preconfigured settings.
Ctrl
+ K then
Ctrl
+ F
It’s useful when you want to automatically format and adjust the indentation settings of a specific selection without affecting the entire document.
Rename Symbol
It is useful when working on a large file and changing the name of a class, function, or variable throughout the codebase.
F2
You can easily update all references to a symbol by renaming it, which helps to keep your code clear and organized.
Debug Test View
It launches the Run and Debug view, where you can configure, start, and manage a debugging session for your code to identify and fix errors.
Ctrl
+ Shift + D
Source Control View
Source Control Panel View
With the Source Control view, you can work with Git repositories directly in your editor.
Ctrl
+ Shift + G
You can track and manage version control operations such as commit history, pull and push reviews, conflict resolution, and file change previews.
Show References
You can use this shortcut to search for all references of a symbol in your code.
Shift + F12
It will display a list of locations where the symbol is referenced so you can easily view and change it.
Find In Files
With this feature, you can search for a specific string or pattern within all files in your workspace to perform a global search and replace operation.
Ctrl
+ Shift + F
Scroll the Editor Vertically
It lets you quickly scroll up and down the screen without changing the cursor’s position.
Ctrl
+ Arrow Up / Down
Select the Current Line
You can use it to select the current line of text where the cursor is positioned to copy, cut, or edit it.
Ctrl
+ L
Final Words
These shortcuts will help you focus and concentrate on your work without moving your fingers off your keyboard.
Use these VSCode keyboard shortcuts in your daily programming to save time and start coding like a pro.
You can access Keyboard Shortcuts in VS Code by pressing
Ctrl
+ K, then
Ctrl
+ S.
How do I add Keyboard Shortcuts to VS Code?
To add keyboard shortcuts to VS Code, open the command palette (
Ctrl
+ Shift + P), type “Preferences: Open keyboard shortcuts,” and customize shortcuts in the keybindings.json file.
How to reset VS Code keyboard shortcuts?
To reset shortcuts, open the Keyboard Shortcuts panel, click on the three dots, and select “Reset Keybindings”.