I LOVE HOTKEYS! The less keystrokes I need to type, the better. In this blog I'll go over my favorite hotkeys that I've found so far when using VS Code.
Before we dive in I'd like to address that I'm currently using a mac for my coding adventures. All of the hotkeys I'll be talking about will be for mac. Sorry windows and linux users...
Opening VS Code's Built In Terminal
To open VS Code's built in terminal, use command
+ ~
. No more tabbing back and forth for me!
Open and Close the Sidebar
To quickly close and open the sidebar, use command
+ b
.
Switch Between Workspaces
VS Code does a good job of recording what folders you have previously opened. To quickly navigate to these folders use control
+ r
.
Search For a File
If your project gets complex enough searching for specific files can be a pain. Use command
+ p
to quickly search for a file or symbol by name.
Navigate to a Specific Line
On the topic of command
+ p
, if you start your search with :
followed by a number VS Code will navigate you to that specific line. You can also use control
+ g
.
Folding and Unfolding
If your codebase is getting too large and you prefer a clean screen you can fold your classes or methods to reduce clutter. To fold your classes or methods use command
+ option
+ [
. To unfold them use command
+ option
+ ]
.
Select All Instances of a Word
To select all occurrences of a word use command
+ shift
+ l
. From here you're able to edit all of your selections at once.
Select a Single Instance of a Word
To select a single word use command
+ d
. If you do it more than once VS Code will add the next occurrence of the word to your selection.
Move a Line
To move a line up or down a line, use option
+ the up
or down
arrows.
Copy a Line
To copy a line of code either up or down a line use shift
+ option
+ up
or down
.
Delete a Line
To quickly delete a line use command
+ x
. To delete the portion of the line to the left of your selection use command
+ delete
.
Duplicate Your Cursor
This one is incredibly helpful when you are doing repetitive tasks. Use command
+ option
+ up
or down
. Alternatively, you can hold option
and click to add another cursor location.
Hopefully some of these hotkeys are helpful in your future coding adventures! I'm always looking for new hotkeys to add to my arsenal so please let me know if I missed any important ones.
Top comments (0)