VSCode is quick and easy to use, and the mouse is used less

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:

commit1

and ctrl + K, ctrl + cwill continue to annotate:

commit2

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:

group commit

or:

group commit2

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 + 1will 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 + tabor 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 + Pinterface is as follows:

go to file

Folder searches can also be performed, such as:

go to file folder search

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 + eto open file browser, and then use to deldelete the file.

GO TO Line

ctrl + g, this command allows you to jump to the specified line, the interface is as follows:

go to line

It tastes even better when eaten with shortcuts that go with collapsing code blocks.

GO TO Symbol

go to symbolBefore understanding , let's understand another command: show all symbols, that is ctrl + t, the interface is as follows:

search symbol

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:

search symbol2

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

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 + CLICKThere are also corresponding shortcut keys: f12.

single line operation

Copy a single line

The shortcut keys are alt + shift + UPor 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 + wclose the current window
  • ctrl + [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 + nto create a new file and ctrl + alt + shift + nto create a new folder. Then enter /path/subpath/fileName.jsor /path/subpath/TestPathspecify the path to create a new file or folder.

The best way to eat this plugin:

  1. Use go to file to go to the specified file
  2. ctrl + shift + eOpen file directory with
  3. Use ctrl + k, ctrl + shift + cto get the current relative path
  4. 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:

create file

Guess you like

Origin blog.csdn.net/weixin_42938619/article/details/124162376