
First things first: Why using Shortcuts?
VS Code 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 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
Command > Action
F1 > Show command palette (you can search there)
CTRL + SHIFT + F > Search in ALL files
CTRL + P > Fuzzy Search file by name (Can search for name part as: intern comp ts (dont need spaces) to search for intern-details.component.ts
CTRL + SPACE > Trigger 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
Command > Action
Home > Go to beginning of text line
End > Go to end of text line
DEL > Delete Next character
CTRL + Home > Go to beginning of file
CTRL + End > Go to end of file
CTRL + Backspace > Delete Previous Word
CTRL + DEL > Delete Next Word
CTRL + Shift + Arrow Right > Select Next Word
Intermediary shortcuts: ready to rock
Command > Action
CTRL + ALT + SHIFT + ArrowUP/Down > Duplicate line
CTRL + SHIFT + K > Delete line
CTRL + SHIFT + T > Re open closed editor tab
CTRL + G > Go to line number
ALT + Arrow Up/Down > Move line up/down
CTRL + Tab > Move to previous open editor tab
CTRL + Page Up/Down > Move to next/previous editor tab
CTRL + W > Close current tab
CTRL + L > Select current line
CTRL + SHIFT + I > Format document
CTRL + / > Toggle line comment
F12 > Go 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
Command > Action
ALT + SHIFT + Arrow Left/Right > Shrink/Expand selection
It’s great to select text between separators like: (), {}, [], ..; It’s also great to select one word in a camelCase string;
Command > Action
CTRL + D > Add selection to next finding match
With the cursor over the text to select
Command > Action
CTRL + k Ctrl + d > Jump 1 match selection of Ctrl+D
CTRL + SHIFT + L > Select all that matches current selection
CTRL + U > Undo cursor
Try using it after make a selection mistake. For example, pressing CTRL+D 3 times, instead of just 2.
Command > Action
ALT + Mouse Selection > Select multiple text lines
ALT + Mouse Scroll > Fast scrolling
CTRL + SHIFT + [ > Code folding
CTRL + SHIFT + ] > Code unfolding
CTRL + K M > Change current file language mode
CTRL + ENTER > New line under the cursor
CTRL + SHIFT + ENTER > New line above the cursor
CTRL + K CTRL + S > Open keyboard Shortcuts
CTRL + SHIFT + E > Show 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.