当前位置:网站首页>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
边栏推荐
- Demand and business model analysis-1-business model canvas
- Detailed explanation of IO flow basic knowledge -- file and IO flow principle
- Overview of object detection
- Niuke net: somme des trois nombres
- Process accounting, process time, daemon
- Programming tool download address
- QT -- how to get the contents of selected cells in qtableview
- The latest Ningxia construction safety officer simulation question bank and answers in 2022
- Test prerequisites: recommend a special cross platform app performance test tool!
- 【splishsplash】自定义导出器
猜你喜欢

牛客網:三數之和

Demand and business model analysis-2-business model types

2022年最新宁夏建筑安全员模拟题库及答案

Axure RP 9 for MAC (interactive product prototyping tool) Chinese version

torch 网络模型转换onnx格式,并可视化

Wechat e-book reading applet graduation design works (1) development outline

Centos7 installing PHP

In 2022, FISCO bcos MVP recognized that the channel was open and invited you to become an open source leader

Demand and business model innovation-4-strategy

Installation of xv6 system
随机推荐
JDBC接口总结
What is a hash index?
exec函数、shell的实现
How mysterious is "PIP not an internal or external command, nor a runnable program or batch file"
Theory + practice will help you master the dynamic programming method
Using / developing private plug-ins in traifik proxy 2.5 (traifik official blog)
Login to MySQL
Learning summary in March
Alipay payment Episode 12: Crazy God and Feige Alipay payment configuration code (free resources, no thanks for taking them away)
[games101] class note 8 - shading (shading frequency, graphics pipeline, texture mapping)
Reading small programs based on wechat e-book graduation design works (7) Interim inspection report
Solve NPM compilation times node_ modules/optipng-bin/vendor/optipng ENOENT
Understand Jack Dorsey's web5 from the ppt on page 16
Macro definitions and functions
2 R programming
Implementation of exec function and shell
In 2022, FISCO bcos MVP recognized that the channel was open and invited you to become an open source leader
标量、向量、数组和矩阵
What does MySQL full value match mean
Detailed explanation of SQL exists usage