Bruno Haetinger

VSCode Shortcuts for Jedi

September 28, 2020

tl;dr: spoiler

Learn how to use at least the top 3 shortcuts described in Jedi section

First things first: Why using keyboard Shortcuts?

VSCode is a great IDE (if you use sufficient extensions). But to get the most of it, it’s necessary to know how to use it and take advantage of the features that it give to us. As it’s very user-friendly, you could use a great part of its functionality using its GUI. However, as a “Jedi” developer, your should always search for the best way of accomplishing your tasks.

Moreover, usually your mental flow to achieve what you are planning to do is better when you don’t need to think in less important stuff. So, having the power of a keyboard driven workflow and avoid using the mouse (when possible) will help in thinking about the problem you are solving and not WHERE to click. This process is similar to a interruption during a complex task thinking. If you are very focused in some tasks, listen to a good music and drinking a good coffee, you probably feel great and your thoghts just flow through your mind. However, being distracted by something in the middle of the development, usually make you lose some time during the “context switching”. Of course, that the real distraction would consume more time than clicking on the GUI, but, again, we are talking about improving everything we can to do our best.

To really learn and remember about the following VSCode keyboard shortcuts, I highly recommend you to do each of those shortcuts to make your brain remember.

Obs.: Those shortcuts are for Linux and some may be a little different on other platforms.

Rookie shortcuts: the essential

CommandAction
F1Show command palette (you can search there)
CTRL + SHIFT + FSearch in ALL files
CTRL + PFuzzy Search file by name (Can search for name part as: intern comp ts(dont need spaces) to search for intern-details.component.ts)
CTRL + SPACETrigger suggestion
CTRL + .Quick Fix

Example: Select some text, press F1 and search for transform to uppercase

Not only for VS Code, but good to mention:

CommandAction
HomeGo to beginning of text line
EndGo to end of text line
DELDelete Next character
CTRL + HomeGo to beginning of file
CTRL + EndGo to end of file
CTRL + BackspaceDelete Previous Word
CTRL + DELDelete Next Word
CTRL + Shift + ArrowRightSelect Next Word

Intermediary shortcuts: ready to rock

CommandAction
CTRL + ALT + SHIFT + ArrowUP/DownDuplicate line
CTRL + SHIFT + KDelete line
CTRL + SHIFT + TRe open closed editor tab
CTRL + GGo to line number
ALT + Arrow Up/DownMove line up/down
CTRL + TabMove to previous open editor tab
CTRL + Page Up/DownMove to next/previous editor tab
CTRL + WClose current tab
CTRL + LSelect current line
CTRL + SHIFT + IFormat document
CTRL + /Toggle line comment
F12Go to Definition

Pressing F12 with the cursor in some Class, Function, etc. it will navigate to its definition;

Jedi shortcuts: take care to not hack NASA unintentionally

CommandAction
ALT + SHIFT + Arrow Left/RightShrink/Expand selection

It’s great to select text between separators like: (), {}, [], ..; It’s also great to select one word in a camelCase string;

CommandAction
CTRL + DAdd selection to next finding match

With the cursor over the text to select

CommandAction
CTRL + k Ctrl + dJump 1 match selection of Ctrl+D
CTRL + SHIFT + LSelect all that matches current selection
CTRL + UUndo cursor

Try using it after make a selection mistake. For example, pressing CTRL+D 3 times, instead of just 2.

CommandAction
ALT + Mouse SelectionSelect multiple text lines
ALT + Mouse ScrollFast scrolling
CTRL + SHIFT + [Code folding
CTRL + SHIFT + ]Code unfolding
CTRL + K MChange current file language mode
CTRL + ENTERNew line under the cursor
CTRL + SHIFT + ENTERNew line above the cursor
CTRL + K CTRL + SOpen keyboard Shortcuts
CTRL + SHIFT + EShow explorer OR Focus in text editor (if focus was in explorer)

Conclusion

As you can see, there is a lot to learn in VSCode, we explored only about shortcut, but of course there are tons of features that worth learning to improve your day or at least make it easier.


Written by Bruno Haetinger. Go to my website

© 2021, Bruno Haetinger