VSCode is quick and easy to use, and the mouse is used less
The main purpose of this note is to improve the efficiency of notebook development and reduce the use of the mouse.
Notes
Comments are divided into single-line comments and multi-line comments. The most commonly used is ctrl + /
the combination of , but in fact, there are still many aspects that can be played with comments.
A single-line comment command is:
-
ctrl + /
-
ctrl + K, ctrl + c
(note)ctrl + K, ctrl + u
(uncomment single line)
The biggest difference between the two is that, ctrl + /
more like a toggle, it will comment out uncommented code and uncommented code, such as:
and ctrl + K, ctrl + c
will continue to annotate:
It can be said that the usage scenarios of the two are slightly different.
The directive for multi-line comments is alt + shift + a
.
As for why you need to remember so many annotation commands, the application scenarios can be considered:
or:
Collapse/Expand code
The command to fold the code is ctrl + k + [0-9]
, where 0-9 represent the degree of folding. For example ctrl + k + 0
, all code blocks ctrl + k + 1
will be folded, and all code blocks except the area where the cursor is located will be folded.
The command to expand code is ctrl + k + j
, this command will expand all code blocks.
The commands to collapse and expand the current code block are ctrl + shift + [
and ctrl + shift + ]
.
Folding code blocks and comments + GO TO taste better.
toggle
switch open tabs
This command line is ctrl + tab
or ctrl + shift + tab
, the difference being that it opens the previous (left) tab or the next (right) tab.
GO TO
The GO TO series is a very interesting and very efficient command.
GO TO File
That is, jumping to a file can also be understood as opening a file. The command is as follows. The ctrl + P
interface is as follows:
Folder searches can also be performed, such as:
This operation has a good effect with other prefix names, such as direct input >
is command pallete, such as direct input :
is go to line, etc., it is a universal operation.
In addition, if you want to delete a file quickly, you can also locate the file through go to file, use ctrl + shift + e
to open file browser, and then use to del
delete the file.
GO TO Line
ctrl + g
, this command allows you to jump to the specified line, the interface is as follows:
It tastes even better when eaten with shortcuts that go with collapsing code blocks.
GO TO Symbol
go to symbol
Before understanding , let's understand another command: show all symbols
, that is ctrl + t
, the interface is as follows:
The meaning of symbol here is still relatively complex, more like a keyword, and can also be understood as a variable, function, or equation in the code:
If you know that the symbol is in the current file, you can also directly use the GO TO Symbol shortcut: ctrl + shift + o
:
go to symbol only shows symbols in the current file, but search symbol can find all symbols in the current workspace.
GO TO Definition
ctrl + CLICK
There are also corresponding shortcut keys: f12
.
single line operation
Copy a single line
The shortcut keys are alt + shift + UP
or alt + shift + DOWN
, which will copy a line up or down, respectively.
delete a single line
shift + control + k
, which deletes a single row.
split editor
ctrl + \
The current file will be re-rendered to a new editor, which makes it easier to compare the differences between the two files.
With shortcut keys:
ctrl + w
close the current windowctrl + [1-3]
Switch editor for split
Create new files and folders
This is a function that needs to be completed with the help of a plug-in. I am a Windows user, so it is quite efficient. It is said that Mac/Linux can create files directly, so this may not be used.
The name of the plugin is: Create Files & Folders : On The Go.
This is a relatively small plug-in, the size is quite small, the main function is two, create a new file and create a new folder.
The default shortcut is to use ctrl + alt + n
to create a new file and ctrl + alt + shift + n
to create a new folder. Then enter /path/subpath/fileName.js
or /path/subpath/TestPath
specify the path to create a new file or folder.
The best way to eat this plugin:
- Use go to file to go to the specified file
ctrl + shift + e
Open file directory with- Use
ctrl + k, ctrl + shift + c
to get the current relative path - Use the shortcut keys of Create Files & Folders : On The Go to create a new directory or file
The effect is as follows, no frame extraction and no acceleration: