本文主要是介绍【转】23个常用的VSCode快捷键(动图演示),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
尽管我们经常使用 VS Code中的许多快捷方式,但是我们有可能会忘记它们。 这里用可视化制作了一些GIF,以便更好地记住它们,希望对你有所帮助。
VSCode中的每个命令也可以通过使用CTRL + SHIFT + P
和搜索查询的命令提示符来执行。 但是知道直接快捷键速度会更快。
1. CTRL+,
打开用户设置
![](https://img-blog.csdnimg.cn/img_convert/1af943e290d618921492a19f77421406.png)
偶尔需要调整用户首选项,这是直接打开它们的方式。
2. CTRL+K
CTRL+S
:显示快捷键
![](https://img-blog.csdnimg.cn/img_convert/3bf6870207a10260dcc1fdcfbe74cd13.png)
这是VSCode中的快捷方式的完整列表。 还可以下载下来Windows[PDF]和MacOS [PDF]。
3.CTRL+R
:切换工作区
![](https://img-blog.csdnimg.cn/img_convert/2a6596d90d4fb0342fefa975b2a80206.png)
![](https://img-blog.csdnimg.cn/img_convert/ed1b83b316607153fbe8da04099e5025.gif)
这将打开最近工作区的列表,并且是切换到另一个文件夹或项目的超快速方法。 请注意,如果在VS Code工作区中打开了一个终端,这会关闭当前的终端会话。
4. ALT + Z
: 切换自动换行
![](https://img-blog.csdnimg.cn/img_convert/8799384b381692cd331640bed68c6795.png)
![](https://img-blog.csdnimg.cn/img_convert/319475cce1be245268974a37f517df6d.gif)
当我们希望看到完整的行而无需水平滚动时,它是一个方便的小帮手。
5. CTRL + G
:转到行
![](https://img-blog.csdnimg.cn/img_convert/4e4f1161c18456c1c9e4ee69e9cf5557.png)
6. CTRL + P
:转到文件
![](https://img-blog.csdnimg.cn/img_convert/0af1680c6cb1e1b3a3b407eef39d7f1c.png)
7. F8
:转到下一个错误或警告
![](https://img-blog.csdnimg.cn/img_convert/770d0e4ee8c2dbfa778554143ad5f6c9.png)
![](https://img-blog.csdnimg.cn/img_convert/6f76d7fae11b0d949b2e337e26924237.gif)
这是单键调试,还可以使用SHIFT+F8转到以前的错误或警告。
8. CTRL + TAB
:切换选项卡
![](https://img-blog.csdnimg.cn/img_convert/c6473f4c34e76d3a93dcb0717540e26c.png)
不用鼠标切换已打开文件的最快方法。
9. SHIFT + ALT + I
: 在选定的每行末尾插入光标
![](https://img-blog.csdnimg.cn/img_convert/3f1f0de879c03e398168f0d021430db4.png)
![](https://img-blog.csdnimg.cn/img_convert/94ec53ece40ab4803427c13579f533bb.gif)
这对于在选定区域中快速创建多个光标很有用。
10. CTRL+L
: 选择当前行
![](https://img-blog.csdnimg.cn/img_convert/5bab2e131b7fc636700ae0d513e83563.png)
![](https://img-blog.csdnimg.cn/img_convert/db37fbbe3dff24d6a1bc5c2f93e0861f.gif)
11. CTRL + SHIFT + L
:选择所有出现的当前选择
![](https://img-blog.csdnimg.cn/img_convert/7c53804bfba8121282f61a926ff6568e.png)
![](https://img-blog.csdnimg.cn/img_convert/30b60b51daf9bc865ac57d6b5e0dd57f.gif)
该快捷方式确实节省了时间,因为不必在整个文件中按CTRL + D
。
12. CTRL + F2
:选择所有出现的当前单词
![](https://img-blog.csdnimg.cn/img_convert/729847cdef163028356a4a85e6840692.png)
![](https://img-blog.csdnimg.cn/img_convert/ea5a5985d4f0ae5b938790827fda0bf6.gif)
有了它,甚至不必选择任何东西,只需将光标放在要选择所有出现的单词上。
13. CTRL + SHIFT + SPACE
: 触发参数提示
![](https://img-blog.csdnimg.cn/img_convert/716fa3f7110be72009d2f8775bc973f3.png)
![](https://img-blog.csdnimg.cn/img_convert/e925d73987b7a12642584d6899155b33.gif)
如果我们不记得参数顺序,也不想通过查看文档来打断我们的流程,可以使用此命令。
14. SHIFT + ALT + F
: 格式化文档
![](https://img-blog.csdnimg.cn/img_convert/d8d5de43fc95593c2c6ac5c512020f18.png)
15. CTRL + K
CTRL + F
:格式选择的代码
![](https://img-blog.csdnimg.cn/img_convert/1a27553246e3f6dc38c61017720d0d1e.png)
![](https://img-blog.csdnimg.cn/img_convert/557afd264ed20a93e23f60fb5a559d43.gif)
16. F12
:转到定义
![](https://img-blog.csdnimg.cn/img_convert/ec02b27842cdbf559664e88df31420ca.png)
![](https://img-blog.csdnimg.cn/img_convert/1521142cfa0ce3d625c850a6514046bc.gif)
17. ALT+F12
: 查看定义
![](https://img-blog.csdnimg.cn/img_convert/c2a30587a916792e15aed3420c5d271f.png)
![](https://img-blog.csdnimg.cn/img_convert/219cccee3702427e00ee7f8d6e7fd13a.gif)
这只显示了变量或函数的相应定义,而不需要移动光标。
18. F2
: 重命名变量
![](https://img-blog.csdnimg.cn/img_convert/74e32f363ec77de2bf9724f58e20de36.png)
![](https://img-blog.csdnimg.cn/img_convert/64a15ba52900fedeae05a54700e3cc07.gif)
19. CTRL + K
CTRL + X
: 删除尾部空格
![](https://img-blog.csdnimg.cn/img_convert/1382ab5359d3094eacc856a4df2ca019.png)
![](https://img-blog.csdnimg.cn/img_convert/d330607f73d19437dc1ca9fc6cae489c.gif)
20. CTRL + K
R
: 在资源管理器中显示活动文件
![](https://img-blog.csdnimg.cn/img_convert/182ed167ce7d3188a9b1da5482dbd00a.png)
21. CTRL + SHIFT + H
: 替换为文件
![](https://img-blog.csdnimg.cn/img_convert/0c86b59184d8bbc2db2843e6faf92475.png)
22. CTRL + K
V
=在右侧打开Markdown预览
![](https://img-blog.csdnimg.cn/img_convert/22deb3895b899947a312165483aa0d60.png)
![](https://img-blog.csdnimg.cn/img_convert/645e9374c952c9f2d6b74b9599f41025.gif)
23. Ctrl + K
Z
: 进入Zen模式
![](https://img-blog.csdnimg.cn/img_convert/dc79e71e4e6bac0334ed6c283f8ee106.png)
![](https://img-blog.csdnimg.cn/img_convert/19db30ce5fd472b2cb9cf315d56d693b.gif)
英文原文地址:https://dev.to/devmount/23-lesser-known-vs-code-shortcuts-as-gif-80
为了保证的可读性,本文采用意译而非直译。
推荐教程:vscode教程
这篇关于【转】23个常用的VSCode快捷键(动图演示)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!