DEV Community

Connor Van Etten
Connor Van Etten

Posted on

Are you using VS Code Shortcuts?

Overview :

TLDR;
Using the mouse although a valid way to navigate VS Code, tends to slow me down. Being able to add keyboard shortcuts to your VS Code workflow can improve your coding efficiency.

Introduction

One thing as a developer that I believe to be important is efficiency. Code efficiency for specific problems is important, but so is the speed of code production in our work. How fast a programmer is able to produce a file or method can be extremely beneficial. For this article, I'd like to share some ways you might be able to become more efficient within your own development process, specifically within Visual Studio Code.

Within programming there tends to be a negative stigma between developers that use a mouse when editing code and navigating there environment and those who only use a keyboard. Now although I don't condone gatekeeping or looking down on other programmers for the way they make there code, there seems to be some benefit to using only the keyboard (atleast for me). The main benefit can be sometimes be seen is performance.

When using a mouse it can feel like I am "taking a break" from my normal coding to select an item, but it tends to hinder my workflow. As I switch between two different motor skills I tend to spend an extra half-second or two adjusting to my new peripheral. Now this being said I have seen programmers who are able to still maintain a consistent and effortless workflow using both their mouse and keyboard, but I feel more often than not it slows me down. Now you may be thinking, its milliseconds of time and overall it's not a big deal, but time does compound over a day.

It reminds me of the quote "A death by a million cuts". In this comparison, the little cuts are time wasted from using our mouse, and although insignificant in the moment, they will add up to a more significant amount of time wasted. As for me I wanted to make sure that I was more efficient as I developed code within my chosen environment. The way I achieved this was through keyboard shortcuts. Not having to remove my hand from the keyboard to open windows, select files, etc. has limited the amount of "breaks" I usually needed to take with my mouse. Luckily, VS Code comes preloaded with a large amount of premade commands that you can start utilizing now. In the next section I will share my used shortcuts to help improve my development speed!

Shortcuts

Windows Guide
For MacOS replace Ctrl with ⌘

Show Command Palette
Ctrl + Shift + P
-or-
F1
This is the command for when you forget all other commands. This shortcut opens a menu with all the commands available by search.

Quick Open / Go to File
Ctrl+P
When you need to open a new file within your directory, this shortcut gives you a menu of all files to select.

Close Editor
Ctrl + W
If you have finished all development on the file in the current editor window, use this shortcut to close that tab.

Cut Line
Ctrl + X
Lets say you don't want to keep copying, and deleting all your console.log()'s, this is the shortcut for you.

Go to Line
Ctrl + T
More of a specific shortcut but after it is entered you may tell VS Code what line you would like to be redirected to.

New File
Ctrl + N
Once the directory is made and opened, use this shortcut to make a new file in the current folder.

Select All Occurrences of Selection
Ctrl + Shift + L
Especially helpful when you want to change all occurrences of a selection. Remember hitting ESC will remove the extra cursors!

Open Integrated Terminal
Ctrl + backquote
For beginner programmers sometimes the terminal is scary, but trust me the more familiar you are with it the better off you are. This shortcut will get you there!

Toggle Sidebar Visibility
Ctrl + B
Definitely a necessary shortcut for those who have only one screen or work on a laptop. Remember this shortcut is a toggle, therefore if it is missing this will make it reappear.

Open Keyboard Shortcut Preferences
Ctrl + K Ctrl + S
Lastly, if you feel that any shortcuts involve the wrong keys for your preference use this shortcut to open preferences and change them.

Thank you for Reading!

Feel free to comment if you have any other commands that you use daily that I may have missed! Cheers!

Top comments (0)