A collection of VSCode shortcuts that you'll definitely want to know because the shortcut guy says so.
table of contents
Hello.
I'm Mandai, in charge of Wild on the development team.
I wrote an article about shortcuts for Visual Studio Code (VSCode) a while ago, and since then I've been spending my days googling shortcuts and reading through configurations.
My daily work revolves around memorizing a lot of shortcuts and how I can work without taking my hands off the keyboard, but after using the new shortcuts I learned from last time and using them for a while, I've been able to put them into practice. We carefully select and deliver only those that are familiar to you!
Select from the beginning of the line to the end of the line
I used to use the Shift + end combination from the home key a lot, but there was a shortcut to select the current line with one click.
Ctrl+L
In most cases, this is convenient because you want to delete an entire line, but the line feed code at the end of the line is also included in the selection range, so don't panic if there are rare cases where the line break becomes incorrect.
Add/remove indent at beginning
The standard way to indent is to use the Tab key or the Shift+Tab key, but VSCode also has shortcuts for indenting.
It is certainly possible to indent with the tab key, but it is not always possible to indent with the tab key.
To indent the tab key, the cursor needs to be at the beginning of the line, so if you notice a shift in indentation midway through, you'll need to move the cursor.
That's what it means.
# Add Ctrl + ]
# Delete Ctrl + [
The number to increase (decrease) and the character type (tab or space) use the language mode settings.
code folding
# Collapse Ctrl + Shift + [
# Expand Ctrl + Shift + ]
When modifying extremely long code, I recommend using code folding and splitting the editor (Ctrl + \) to reduce time loss by going back and forth as much as possible.
By the way, there is also a command to "collapse all foldable parts of a file", and as I may have introduced before, you can collapse everything with the combination of Ctrl + K, Ctrl + 0.
On the other hand, the command "Expand everything that can be expanded" is the Ctrl + K, Ctrl + J combination.
I want to open a file that I accidentally closed.
I discovered this by accident, and it has the same shortcuts as browsers such as Chrome.
Ctrl+Shift+T
This shortcut is especially recommended for impatient people who tend to press Ctrl + W repeatedly.
I want to see all commands
Basically, Ctrl + Shift + P opens the Command Palette, but did you know that you can also open it with just the F1 key?
So you may be wondering what's wrong with me, but I'm looking smug.
Extra: Utilize unassigned shortcuts
When doing server-side development, it's common to switch back and forth between the code editor and the terminal.
However, the shortcuts for moving the cursor from the editor to the terminal and from the terminal to the editor are not assigned shortcut keys by default!
So, why not just assign one position to your preference?
First, a shortcut to go from the editor to the terminal.
Setting keyboard shortcuts is a combination of Ctrl + K, Ctrl + S (opening shortcut settings with a shortcut!).
The command name is "workbench.action.focusPanel", so search by copying and pasting.
I think the key binding is probably empty, so when you hover the mouse cursor over the row, click the pencil icon that appears on the left.
Enter your favorite keybind and press enter to complete the registration.
Next, a shortcut to go from the terminal to the editor.
Now that you can move from the editor to the terminal, let's set up a shortcut to go and return and move from the terminal to the editor.
The command name is "workbench.action.focusActiveEditorGroup", so search by copying and pasting as before.
The key binding here is also empty, so register the key binding in the same way.
In my case, I wanted to go back and forth using the same shortcut, so when I set the same one, it didn't work.
Therefore, we will set a when expression only for this shortcut.
The when expression determines when this shortcut will be enabled, and the timing specified in the when expression is given priority.
Here, we will set a when expression called "terminalFocus" to indicate when the terminal is focused.
Then, when the focus was on the terminal, the shortcut to move from the terminal to the editor took priority, so it became possible to go back and forth nicely.
summary
I started using it because I thought that the few seconds I earned with shortcuts would be quite important, but I ended up mainly using shortcuts and discovering good shortcuts that I hadn't seen yet.
I've written several articles introducing shortcuts, so I think it's about time for something more interesting, but this time I've finally gotten into the forbidden territory of unassigned commands.
If you look closely, you'll see that there are an incredible number of commands, and the default shortcuts are just the tip of the iceberg.
It's hard to find pages that explain individual commands, so there are many that I don't understand, but I'd like to discover them and write a blog with a collection of useful unassigned commands.
That's it.