Turbocharge Your Coding: Accustoming ‘VSCode’ Shortcuts for Speedy Success
Why choose vscode.
Visual Studio Code
Popularly known as VS Code is a free open source text editor by Microsoft. VS Code is available for Windows, Linux, and macOS. Even while VS Code editor is of lightweight nature, its robust functionality and user-friendly interface have made VS Code one of the most popular development environment tools in recent times.
Top Reasons why developers love VS Code
Multiple language support. (for eg: Python, Java, C, etc..)
Nifty Shortcuts
Ever-growing marketplace of thousands of extensions including AI-infused extensions
A plethora of themes enabling customization of workspace tailored for user’s taste.
Built-In Git Integration and many more..
Now, whether you are familiar with VS Code or not and are looking for the most helpful shortcuts to make the most out of this awesome editor, you’ve landed on the correct spot.
This blog will take you through some most efficient shortcut keys to boost your productivity and transform you into a VS Code Ninja!:😎
VS Code shortcuts
A. Command to open VS Code using the terminal:
You must first add VS Code to your system’s PATH in order for this to function.
After that, you may start VS Code by using your preferred terminal to cd to the directory you want it to open, then typing
code .
B. Command to open a file in VS Code using the terminal:
Suppose you have a python file like ‘script.py’ in your directory and you wanna open it in VS Code. All you need is to cd to this directory and type
code script.py
C. Command Palette:
Command Palette will probably turn out to be the most used feature of VS Code if you wanna get things done quickly. It presents functionalities, configuration options and more in form of a searchable list.
There are two scenarios of using it:-
Ctrl + P and Ctrl + Shift + P
1. Ctrl + P
or cmd + P
: Opens the Command Palette with no input, starting with a list of recently opened files. You can quickly navigate to different files in your workspace using this shortcut.
2. Ctrl + shift + P
or cmd + shift + P
: Opens the Command Palette with a “>” pre-filled, starting with a list of commands. This allows you to access and execute various commands directly.
D. Navigating your code:
Ctrl + Shift + .
Typically, Codes used for creating projects are lengthy and rather comprehensive. Moving to a certain function or varaible definition can be time consuming with scroller as we have to look for it and scan the entire code. Not anymore coz with this shortcut you can select form the dropdown list of all components in your code such as classes etc..Ctrl + Shift + .
or cmd + Shift + .
E. Zen mode:
Ctrl + K Z
Zen mode is a distraction-free view mode where the spot light is on your code and rest tools like toolbars and buttons are hidden.
To activate use the shortcut Ctrl + K Z
or cmd + K Z
F. Search for specifics:
Ctrl + F
Ctrl + F
or cmd + F
: This command opens a small search bar where you can type a text string to search for it within the current file. This is incredibly useful when you’re looking for specific bits of code in larger files
G. Rename specifics:
Ctrl + H
Ctrl + H
or cmd + H
:This command is used to replace text. When you need to change a variable name or update a function across your file, Ctrl + H
will be your best friend.
Additionally, if you want to rename a certain selectionCtrl + Shift + L
or cmd + Shift + L
command is used to select all occurrences of the current selection in the active file. This can be incredibly useful when you want to edit or replace all instances of a specific word or phrase in your code.
Take caution as it may rename every instance.
H. Re-ordering your code line:
Alt + UpArrow/ DownArrow
Alt + UpArrow
command on Windows/Linux is used to move a line of code up. The equivalent command on a Mac is Opt + UpArrow
. These shortcuts allow you to quickly rearrange lines of code without having to cut and paste.
I. Split editor:
Ctrl + \ and Ctrl + W
Split Editor feature allows you to have multiple editors open side by side, vertically or horizontally. This can be incredibly useful when you want to view or edit multiple files at once or different parts of the same file.Ctrl + \
or cmd + \
To split the editor as many time as you want.Ctrl + W
or cmd + W
To close the splits.
J. Comment Lines:
Ctrl + \
We know that comments are programmer-readable explanations or annotations in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand and are ignored by the interpreters and compilers during code execution.Ctrl + \
or cmd + \
use this shortcut key once you have selected a part of code line to comment that entire line. But what if we wanna comment multiple lines in one go just select lines of code and then use the shortcut.
This can be incredibly useful when you want to temporarily disable a portion of your code without deleting it.
Additional shortcut keys
Ctrl + L
orcmd + L
: Highlights the entire line of code and you have to select just a portion of this line.Ctrl +
(`)backtick
: To toggle integrated terminal ON and OFFCtrl + B
orcmd + B
: For toggling explorerCtrl + enter
orcmd + enter
: If you are in between a code line and wanna move to the next line, this will help move to the new line without going to the end of line and pressing enter.
A handful of the most helpful shortcuts were covered, but there are many more. I’ve shown you the shortcuts that I frequently use since they’ve made it possible for me to work faster and keep my hands on the keyboard, which minimizes the need to swap between the keyboard and mouse.
You’ll only be able to choose which shortcut best suits your coding requirements, preferences, etc. if you take the time to investigate more shortcuts on your own. I’ll drop few resources to help you get started with addition such shortcuts.
Please Follow for more nice and simple blog notifications if you learned anything from this blog or thought it was interesting.
Remember, the best way to learn these shortcuts is to use them regularly in your coding workflow. Happy coding! 😊
Resources
Visual Studio Code Key Bindings
100 Crucial Keyboard Shortcuts for VS Code Users. — DEV Community