当前位置:网站首页>20 shortcut keys for vs code!
20 shortcut keys for vs code!
2022-06-12 20:10:00 【wx61f365eb1f9fc】
author | Deepak Gupta
translator | Da Luo , Coordinating editor | Guo Lei
This article article , Hope it can help developers use it more efficiently VS Code Programming .
The following is the translation :
Not every developer has enough time , To get familiar with all the shortcuts , To help us improve coding efficiency . Because there are too many shortcut keys . therefore , Below I list my favorite shortcuts .
Multi line to one line
- stay MAC On :
Ctrl + J
- stay Ubuntu/Windows On : adopt
File
> Preferences
> Keyboard shortcuts
Open shortcut key settings , And bind editor.action.joinLines
Your own shortcut .
formatting code
This shortcut can help us indent the code . notes : You can use it at any time of coding , But I prefer to format it when my code is finished .
- stay Windows On :
Shift + Alt + F
- stay Mac On :
Shift + Option + F
- stay Ubuntu On :
Ctrl + Shift + I
Remove trailing spaces
This shortcut key can help you remove the extra space in front and back , So you don't have to use strict Lint Checked . notes : I suggest that when you finish writing the code , Use this shortcut . in fact , This shortcut key needs to be configured by yourself :
- Open the user settings page (
Preferences
> Settings
> User TAB
);
- Click on The icon in the upper right corner switches to code editing mode ;
- add to
"files.trimTrailingWhitespace": true
To settings file ; - Save your settings file .
If you are using a new version VS Code, You can set up... On the user settings page , Here's the picture :
Code folding
Sometimes , The code file is very large , But you just want to know the general logic of the code . At this time, code folding is very necessary .
Collapse the unfolded code at the cursor :
- stay Windows/Ubuntu On :
Ctrl + Shift + [
- stay Mac On :
Command+ Option + [
Expand the cursor to display the folded code :
- stay Windows/Ubuntu On :
Ctrl + Shift + ]
- stay Mac On :
Command+ Option + ]
Up / Down Copy line
- stay Windows On :
Shift + Alt + Up/Down
- stay Mac On :
Shift + Option + Up/Down
- stay Ubuntu On :
Ctrl + Shift + Alt + Up/Down
Of course , You can also set and bind your own shortcut keys :File
> Preferences
> Keyboard Shortcuts
Split edit box
stay Windows On :
Shift + Alt + \ or 2,3,4
stay Mac On :
Command + \ or 2,3,4
stay Ubuntu On :
Shift + Alt + \ or 2,3,4
The split editor can use the shortcut keys for splitting , Use 123
You can also switch the editor focus . Of course, you can also bind your own shortcut keys .
Editor grid layout
By default , Vertical column layout used in the editor interface ( When you split the editor , By default, it opens on the side ) You can also easily layout horizontally and vertically according to your preferences :
To support a more flexible layout , You can create an empty editor group . By default , When you close the last edit window , The group will also be closed , But you can use the following configuration to turn off this default behavior :"workbench.editor.closeEmptyGroups": false
stay View
> Edit Layout
On the menu , There are also preset layouts :
Select the word
stay Windows On :
Ctrl+ d
stay Mac On :
Command + d
stay Ubuntu On :
Ctrl+ d
If you repeatedly Click on This shortcut key , Multiple keywords that are the same will be selected .
Open and close the sidebar
stay Windows On :
Ctrl+ b
stay Mac On :
Command + b
stay Ubuntu On :
Ctrl+ b
occasionally , The code width in the file is relatively large , Closing the sidebar allows for greater code visibility .
Jump to a specific line
notes : Line jump in file , You can use Ctrl + G
, Then enter the line number to jump , Of course , You can also use Ctrl + P
, Then input :
And the line number to jump .
stay Windows On :
Ctrl + g
stay Mac On :
Ctrl + g
orCtrl + p
stay Ubuntu On :
Ctrl + g
Symbol jump in file
stay Windows On :Ctrl + Shift + o
stay Mac On :Command + Shift+ o
stay Ubuntu On :Ctrl + Shift + o
You can also group by colons :@:
Workspace symbol jump
stay Windows On :
Ctrl + t
stay Mac On :
Command + t
stay Ubuntu On :
Ctrl + t
Delete the last word
stay Windows On :
Ctrl + backspace
stay Mac On :
Option + delete
stay Ubuntu On :
Ctrl + backspace
This function is very useful when you enter an error , You don't need to hold delete Delete one by one .
Selected words
stay Windows On :
Ctrl + Shift + Right click / Left key head
stay Mac On :
Option + Shift + Right click / Left key head
stay Ubuntu On :
Ctrl + Shift + Right click / Left key head
This shortcut key helps you quickly select and edit .
Copy line
stay Windows On :
Ctrl + Shift + d
stay Mac On :
Command + Shift +d
stay Ubuntu On :
Ctrl + Shift + d
Copying rows is a very powerful function .
Delete row
stay Windows On :
Ctrl + x
stay Mac On :
Command + x
stay Ubuntu On :
Ctrl + x
Add multiple cursors
stay Windows On :
Ctrl + Alt + Up/Down
stay Mac On :
Command + Alt + Up / Down
stay Ubuntu On :
Ctrl + Alt + Up / Down
The copy cursor is VS Code One of the features in , Can save a lot of time .
rename
stay Windows On :
F2
stay Mac On :
F2
stay Ubuntu On :
F2
Select the variable , Press F2
, References in the context are renamed .
Block selection
stay Windows On :
Shift + Alt
stay Mac On :
Shift + Option
stay Ubuntu On :
Shift + Alt
You can press and hold the shortcut key above , Then drag the mouse , Select a text block , The cursor is added to each selected row .
Command Panel
stay Windows On :
Ctrl + p
stay Mac On :
Command + p
stay Ubuntu On :
Ctrl + p
Access available commands based on your current context . Here are some common commands :1. Open file When you want to open a file , Use the following command , Then enter the file name , It can help you jump to files quickly .
2. Check out the shortcuts All commands can be seen in the command panel , And there are shortcut key binding relationships ( If there are shortcut keys ), If you forget the shortcut , You can use it to query :
Conclusion
There are many shortcut keys to meet your needs , ad locum , I listed all VS Code Fast key PDF file :
Linux:https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf
Window:https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf
macOS:https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf
边栏推荐
- 6 R factor and judgment Na
- 一致性哈希的简单认识
- Parameter meaning of random forest randomforestclassifier in sklearn
- The joint empowerment plan of Baidu PaddlePaddle large enterprise open innovation center was launched! Help Pudong to upgrade its industry intelligently
- Demand and business model analysis -6- five topics
- First build green, then build city
- system()
- Interpreter Files
- How mysterious is "PIP not an internal or external command, nor a runnable program or batch file"
- Unsupported class file major version 60
猜你喜欢
exec函数、shell的实现
Generate API documents using swagger (go language example)
Experience Technology Department of ant group launched the 2023rd school recruitment
Viewpoint sharing | Li Wei, an expert of Gewu titanium intelligent technology products: underlying logic and scenario practice of unstructured data platform
User and group permissions
Since using low code development, the development efficiency has been increased by 10 times
PostgreSQL database replication - background first-class citizen process walreceiver PG_ stat_ wal_ Receiver view
Demand and business model analysis-1-business model canvas
一致性哈希的简单认识
PostgreSQL数据库复制——后台一等公民进程WalReceiver pg_stat_wal_receiver视图
随机推荐
Demand and business model innovation - demand 2- demand basis
Wechat e-book reading applet graduation design completion works (3) background function
Understand Jack Dorsey's web5 from the ppt on page 16
Reading small programs based on wechat e-book graduation design works (7) Interim inspection report
sklearn中随机森林RandomForestClassifier的参数含义
Operating instructions for installing mysql5.7 in centos7
牛客网:三数之和
MySQL installation and Application
Dynamic memory management
Negative remainder problem
What is an index?
Implementation of exec function and shell
Detailed explanation of search tree and hash table
If you master these skills, you can also write a high score resume in the eyes of HR
Demand and business model analysis-1-business model canvas
在 Traefik Proxy 2.5 中使用/开发私有插件(Traefik 官方博客)
Torch network model is converted to onnx format and visualized
Parameter meaning of random forest randomforestclassifier in sklearn
JDBC接口总结
QT knowledge: QT widgets widget class [01]