DEV Community

Luke Berry
Luke Berry

Posted on

My 5 Most Used VS Code Hotkeys And Why

VS Code is excellent software. It suits web developers amazingly.

The codebase I currently work on is larger than all my personal projects combined. The mouse can only get you so far, and rather slowly. These are my most used VS Code hotkeys as a Beginner Software Developer (and the reason behind each choice).

CTRL + SHIFT + F

This looks through your directory for any string. It can be a function, variable, etc...

Why?

Moving through a professional codebase as a beginner is intimidating. There is so much information flying around that being able to look everywhere at once will allow you to map behaviors more easily.

CTRL + P

Similarly, this hotkey allows to search for filenames, using fuzzy search. Also a must for traversing large projects.

Why?

There are files that we open regularly, such as READMEs. Also, in React we can have a component, content and template architecture. With similar naming for these files, you can find all them at once.

CTRL + SHIFT + L

This hotkey surprised me. I had been using CTRL + D repeatedly to select occurences of a string in the current file. CTRL + SHIFT + L does that immediately, for all ocurrences.

Why?

Makes it ultra-fast to refactor, specially variable names (descriptive variables FTW).

ALT + UP/DOWN

Forget cutting, removing empty spaces, pasting and adding empty lines back: by using this, you can manually move any amount of lines up or down in your file seamlessly.

Why?

Want to switch the order of your components just to see what it looks like? This is the way to go!

CTRL + SHIFT + K

This removes the selected lines. As a beginner, I felt frightened to remove anything from the codebase. This hotkey helped me overcome that fear (with some obligatory CTRL + Z to follow).

Why?

A great lesson I learned is that removing code is a shorter path to understanding functionality than adding. CTRL + SHIFT + K is our fastest tool for that.

Here is a useful pdf with many other keyboard shortcuts to increase your productivity.

Top comments (3)

Collapse
 
tracygjg profile image
Tracy Gilmore • Edited

Hi Lukeberry,
Really like CTRL + SHIFT + L, I will be using that for sure.
Thanks for sharing and in exchange here are a couple I use quite a lot.
You covered using ALT + UP/DOWN to move lines, ALT + SHIFT + UP/DOWN can be used as an easy way to duplicate lines.
A quick way back to where you were last can be navigated to using ALT + LEFT and RIGHT also works if you go too far.

Collapse
 
lukeberrypi profile image
Luke Berry

Hey TGJ!

Super interesting about ALT + SHIFT + UP/DOWN, do you have a common use case for that? Would love to hear about it.

I didn't quite understand ALT + LEFT/RIGHT though, do you have a link to the documentation on that one? Tried to replicate it to no success.

Thanks for the comment!

Collapse
 
tracygjg profile image
Tracy Gilmore

ALT + SHIFT + UP/DOWN is very useful for duplicating unit test cases when there are slight variations to be exercised.
There official documentation can be found here (code.visualstudio.com/docs/getstar...) with cheat sheets for the three major OSs.
When navigating between files the ALT + LEFT/RIGHT sequence is an easy way to view something is a second file and navigate back and forth.