A collection of VSCode shortcuts that you'll definitely want to know because the shortcut guy says so.

Hello.
I'm Mandai, in charge of Wild on the development team.

I wrote an article about Visual Studio Code (VSCode) shortcuts a while ago, and since then I've been spending my days googling shortcuts and reading up on configurations. I've been
trying to memorize a lot of shortcuts and work every day with the goal of being able to get my work done without taking my hands off the keyboard. I've been using the new shortcuts I've learned since the last time, and I've carefully selected only the ones that feel right to me!


 

Select from the beginning to the end of the line

I used to frequently use the combination of home key followed by Shift + end, but there is a shortcut that instantly selects the current line

Ctrl + L

 

In most cases, this is convenient because you want to delete the entire line, but since the line break code at the end of the line is also included in the selection range, there are rare cases where the line breaks become strange, but don't panic

 

Add/remove leading indent

The standard way to indent is to use the tab key or shift-tab, but VSCode also has shortcuts assigned for indentation

It is true that you can indent using the tab key, but that doesn't mean you can always indent using the tab key.
To indent using the tab key, the cursor must be at the beginning of the line, so if you notice that the indent is off, you have to move the cursor.

That's what I mean

# Add Ctrl + ]

 

# Delete Ctrl + [

 

The number to increase (decrease) and the character type (tab or space) are determined by the language mode settings

 

Chord Folding

# Collapse Ctrl + Shift + [

 

# Expand Ctrl + Shift + ]

 

When modifying extremely long pieces of code, it's a good idea to make use of code folding and splitting the editor (Ctrl + \) to minimize the amount of time you waste by going back and forth as much as possible

By the way, there is also a command to "collapse all foldable parts in the file", which I may have mentioned before, but you can collapse everything with the combination of Ctrl + K, Ctrl + 0.
Conversely, the command to "expand all expandable parts" is the combination of Ctrl + K, Ctrl + J.

 

I want to open a file that I accidentally closed

I discovered this by chance, but it has the same shortcuts as browsers like Chrome

Ctrl + Shift + T

 

This is a shortcut that is especially recommended for impatient people who tend to hit Ctrl + W repeatedly

 

I want to see all the commands

Basically, Ctrl + Shift + P opens the command palette, but did you know you can also open it with just the F1 key?
You might be wondering what that means, but I'm feeling pretty smug about it.

 

Bonus: Utilizing Unassigned Shortcuts

When developing on the server side, it's common to switch back and forth between the code editor and the terminal.
However, there are no standard shortcut keys assigned to move the cursor from the editor to the terminal and vice versa!

So, why not just assign this to a position of your choice?

 

First, a shortcut to move from the editor to the terminal

The keyboard shortcut setting is the combination of Ctrl + K, Ctrl + S (opening shortcut settings with a shortcut!).
The command name is "workbench.action.focusPanel", so copy and paste it into your search.

The key bindings are probably blank, so hover your mouse cursor over the row and click the pencil icon that appears on the left

Enter your desired key binding and press Enter to complete registration

 

Next, a shortcut to move 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 back and then go from the terminal to the editor.
The command name is " workbench.action.focusActiveEditorGroup ", so search for it by copy and paste as before.
The key binding here is also empty, so register it in the same way.

In my case, I wanted to switch back and forth using the same shortcut, so I set it up, but it didn't work properly

So, we will set up something called a when expression for this shortcut only

The when expression determines when this shortcut will be enabled, and it will take priority if the timing specified in the when expression is used.
Here, we will set a when expression called "terminalFocus" to indicate when the terminal is focused.

This means that when the terminal has focus, the shortcut to move from the terminal to the editor takes priority, making it easier to switch back and forth

 

summary

I started using shortcuts because I thought the few seconds I saved by using them would be quite important, but my main purpose ended up being to use shortcuts and discover good shortcuts I hadn't seen before

I've written a few articles introducing shortcuts, so I'm running out of material, but this time I've finally ventured into the forbidden territory of unassigned commands. If you
look closely, you'll see that there are an incredible number of commands available, and the default shortcuts are just the tip of the iceberg.

I can't find any pages that explain individual commands, so there are many that I don't understand, but I would like to write a blog that digs up and collects useful unassigned commands

 
That's it.

If you found this article helpful , please give it a like!
0
Loading...
0 votes, average: 0.00 / 10
8,057
X facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Yoichi Bandai

My main job is developing web APIs for social games, but I'm also fortunate to be able to do a lot of other work, including marketing.
Furthermore, my portrait rights in Beyond are treated as CC0 by him.