Introducing useful shortcut keys in Visual Studio Code

table of contents
- 1 Jump the cursor to the matching parenthesis
- 2 Chord folding at cursor position
- 3 Code folding for the entire file
- 4 Expand all collapsed code folds
- 5 Make selected JSON data easier to read by adding line breaks and indents (JSON pretty)
- 6 Delete the entire line
- 7 Add a newline before the cursor line
- 8 Move to the beginning/end of the file
- 9 Switching Editor Tabs
- 10 Comment out / Uncomment
- 11 summary
Hello.
I'm Mandai, the Wild team member in charge of development.
When developing, the speed at which you can work depends on how familiar the editor is to your hands, so I want to use shortcut keys as little as possible and get used to them so that my hands move automatically
Even so, there are shortcuts that I only use occasionally, or shortcuts that I use often but just can't seem to get used to, and my body just rejects them.
Also, to prevent the regrettable situation of forgetting shortcuts I thought were really convenient later on, I'd like to introduce some little-known shortcuts for Visual Studio Code (VSCode) that you won't easily find by searching.
The key configuration may vary depending on the version used, but the shortcuts listed in this article were verified using version 1.17.2
Jump the cursor to the matching parenthesis
Ctrl + Shift + \
In the case of JS or PHP, it responds to "[", "{", "(", etc
In the case of HTML, it seems to react to pairs of "<" and ">" placed before and after tags
Chord folding at cursor position
Ctrl + Shift + [
Ctrl + Shift + ]
The top part is folded, and the bottom part is unfolded.
After using it for a while, it becomes tedious to move the mouse cursor to the line number every time.
Code folding for the entire file
Ctrl + k -> Ctrl + 0
CtrlJust presskand0press
Expand all collapsed code folds
Ctrl + k -> Ctrl + j
CtrlJust presskandjpress
Make selected JSON data easier to read by adding line breaks and indents (JSON pretty)
Alt + Ctrl + m
If parsing is not possible, a warning will be displayed, so it can also be used to check the structure of JSON data
I introduced this feature even though it's not a standard feature. It's just so convenient...
JSON ToolsPlease install
Delete the entire line
Ctrl + Shift + k
In Eclipse,Ctrl + Shiftwas enabled, allowing me to delete using only my left hand.
Add a newline before the cursor line
Ctrl + Shift + Enter
If you're still unsure,HomepressingEnterimagine
Move to the beginning/end of the file
Ctrl + Home
Ctrl + End
a Shift keyYou can also add
Switching Editor Tabs
There are several ways to switch editor tabs using the keyboard, so I will introduce them here
Ctrl + Tab
Select from a list of open files
Ctrl + PageUp
Ctrl + PageDown
Switch to the next editor tab
Comment out / Uncomment
Ctrl + /
Commenting out is a standard function, but for the following reasons, I always do it via shortcut keys unless there is a very good reason not to
- When you comment out using a shortcut, it will comment out with the proper indentation so as not to break the indentation
- The shortcut key combination for block comments is incredibly inconvenient (Ctrl + Shift + a).
- The combination of selection and block commenting does not work as intended, and commenting multiple lines produces the intended result
- VSCode comments out extensions according to the programming language, which is convenient for people who switch between different languages
Well, the biggest advantage is probably that you don't have to think about unnecessary things.
The downside is that code folding doesn't work for multi-line comments.
summary
When developing software, I think the longest time is spent with my right hand moving back and forth between the mouse and keyboard (a slight exaggeration). If I could
reduce that time even a little, my development speed would increase, and I could do better work with greater productivity.
Surprisingly popular,soon the Alt key,Visual Studio Code shortcuts that focusI also have a compilation of
That's all
1
