Introducing powerful shortcut keys in Visual Studio Code
Hello.
I'm Mandai, in charge of Wild on the development team.
When developing, the speed at which you work depends on whether the editor feels familiar to your hands, so I want to use the shortcut keys as little as possible, so that my hands can move on their own without having to use my brain.
Even so, there are some shortcuts that you only use once in a while, or that you use often but just can't get used to and your body rejects them.
Also, even if you think it's very convenient, you can use it as a memo to prevent the wasteful case of forgetting it later.It's not easy to find even if you search for something that can be used with Visual Studio Code (hereinafter referred to as VSCode). I would like to introduce a new shortcut.
Note that the key configuration may change depending on the version you use, but the shortcut confirmation environment in this article is 1.17.2.
Jump cursor to corresponding parenthesis
Ctrl + Shift + \
In the case of JS and PHP, it reacts to "[", "{", "(", etc.).
In the case of HTML, it seems to respond to the pair of "<" and ">" placed before and after the tag.
Code folding at cursor position
Ctrl
+ Shift + [ Ctrl + Shift + ]
The top is folded and the bottom is unfolded.
As you use it, it becomes a pain to move the mouse cursor to each line number.
Fold the entire file using code folding
Ctrl + k -> Ctrl + 0
Hold down Ctrl press k and 0
Expand all collapsed code folds
Ctrl + k -> Ctrl + j
Hold down Ctrl press k and j
Add line breaks + indentation to the selected JSON data to make it easier to read (JSON pretty)
Alt + Ctrl + m
If it cannot be parsed, a warning will be displayed, so it can also be used to check the structure of JSON data.
I introduced it even though it wasn't a standard feature. It's just too convenient...
Please install JSON Tools
Delete an entire line
Ctrl + Shift + k
In Eclipse, Ctrl + Shift was set, and I was able to delete it using only my left hand.
Add line break before cursor line
Ctrl + Shift + Enter
If you're not sure, imagine doing Press Home Enter
Move to beginning/end of file
Ctrl
+ Home Ctrl + End
You can also add Shift
Switching editor tabs
There are several ways to switch editor tabs from the keyboard, so I will introduce them all.
Ctrl + Tab
Select from a list of open files.
Ctrl
+ PageUp Ctrl + PageDown
Move to the next editor tab.
Comment out / Uncomment
Ctrl + /
Commenting out is a feature of Joshiki, but for the following reasons, I always use the shortcut key unless there is a very good reason.
- If you comment out a shortcut, it will comment out with the appropriate indentation so as not to break the indentation.
- The shortcut key combination for block comments is too unfortunate ( Ctrl + Shift + a )
- The behavior of the combination of selection range and block comment is not what I intended, and it is better to comment multiple lines to get the desired result.
- VSCode comments out the extension according to the programming language, which is convenient for people who go back and forth between various languages.
Well, perhaps the biggest thing is that you don't have to think about unnecessary things.
The disadvantage is that code folding does not work for multi-line comments.
summary
When you're doing development, the thing you spend most of your time doing is probably your right hand going back and forth between the mouse and keyboard (this is a bit of an exaggeration).
If that time could be reduced even a little, it would be great if the speed of development would increase and I could be more productive and do better work.
We also have a collection of shortcuts for Visual Studio Code that start with Alt, which surprisingly popular and has become obsessed Alt
That's it.