Let's get right into it: here are my top 10 most useful VS Code keyboard shortcuts. Some of these I've learnt in the past year 🙂
Video
If you prefer, I've gone through these in video on my YouTube channel, dcode
1. Reveal in file explorer
CTRL + K, R
Reveals the active document in the file explorer. Before I knew about this, I used to right-click the side bar and reveal the file from there 😔
2. Go to symbol
CTRL + SHIFT + O
Opens up a list of symbols in the current file. This especially comes in handy when you have a large class and need to jump to a particular method 🦘
3. Go to line
CTRL + G
Allows you to jump directly to a line by using the line number. This saves me time when colleagues give me a line number 🔢
4. Move line up/down
ALT + DOWN/UP
I think most people know this one. You can use it to move a line up or down ⬆
5. Copy line up/down
SHIFT + ALT + DOWN/UP
Similar to the last one, but this will copy a line up or down 🖨
6. Remove current line
CTRL + SHIFT + K
I struggle to get used to using this one, but as the name suggests, it will delete the current line ❌
7 . Trigger suggestion
CTRL + SPACE
This one will trigger the suggestion window to appear again if you accidently get into a situation where it's lost ⚡
8. Trigger parameter hints
CTRL + SHIFT + SPACE
Similar to the last one, but this one will trigger parameter hints for a method of function if you lose them. Definitely helpful for long parameter lists! 📈
9. Select all occurrences of current word
CTRL + F2
As the name suggests, using this shortcut will automatically select all occurrences of the active word 🔡
10. Select all occurrences of current selection
CTRL + SHIFT + L
Lastly, this one will select all occurrences of the current/active selection. Very useful for file-wide replacements 📑
For a full list of VS Code shortcuts, check out their Keyboard reference sheets
Hope I taught you at least one of these shortcuts! 😁
Top comments (1)
Nice post and video, thanks for sharing!
You might be interested in KeyCombiner's public VSCode collection. It is a reference of all VSCode shortcuts that can be searched and one-click filtered by category and by modifiers.
Also, I used KeyCombiner to learn every single VSCode shortcut, as described in a blog post.