Best VSCode Shortcuts

Best VSCode Shortcuts

Published on Saturday, 20 Jan 2024, updated on Monday, 09 Sep 2024.
Built under vscode, developing, text editors .

373 Words

 | 

2 Minutes

Table of Contents

Best VSCode Shortcuts

I was thinking about what might be a nice easy blog post to start this site off. Something straight forward that won’t be too technically challenging to write and is largely based on my own subjective opinion.

The best topic is a top five list of the best keyboard shortcuts in VSCode that you may or may not have heard of before.

5. Hide Sidebar

The program’s sidebar has a nasty habit of getting in the way when developing, especially on a laptop where screen space is premium real estate.

In order to get rid of it just hit:

Ctrl + b

Kablamo! An extra 3cm to fill with your spaghetti code.

4. Insert Newline Before

Okay so the shortcut

Ctrl + return

is fairly well known and common to many different text editors.

But did you know that if you combine this with the shift key it will insert a newline before your currently selected line.

Ctrl + Shift + return

To be honest this is one that I very seldom use, but its interesting to know.

3. Select Next Occurance of Text

Let’s say you want to highlight every occurance of the same string throughout your file, for instance renaming a variable.

Your could do a find and replace on that string, but that would be soooooo labourious.

Instead try

Ctrl + d

to select the next occurance and then edit it in the desired way.

2. Cycle Through Cursor History

If you’ve ever found yourself working between two distant locations in a file it can be somewhat of a pain to keep track of the line numbers where you’ve been working.

Fortunately VSCode keeps track of your cursor location in much the same way that a web browser will remember the pages you visited and in which order.

To cycle to the previous cursor location type

Alt + Left

then to go to the next location type

Alt + Right

1. The Most Satisfying One

Finally once you’ve made all your changes for the day, pushed to your repository and finished everything.

Ctrl + Shift + w

Conclusion

If you want to read more about these, here are some platform specific guides by Microsoft.

Linux, Mac, Windows