VSCode快捷键大全

最近从Sublime3切换到VScode,总结下快捷键。

官方地址:https://code.visualstudio.com…

简单的配置

{
    "files.autoSave": "off", //禁用自动保存
    "workbench.iconTheme": "vs-minimal",
    "explorer.autoReveal": false,    //禁止资源管理器在打开文件时自动显示并选择它们,类似于禁用Eclipse的link editor
    "workbench.editor.enablePreviewFromQuickOpen": false, //使Ctrl+P打开的文件使用新的tab页,而不是替换已有的
    "workbench.editor.enablePreview": false  //使得鼠标左键打开的文件使用新的tab页,而不是替换已有的

}

1、通用

Ctrl+Shif+P , F1 打开命令面板 Ctrl+P 快速打开
Ctrl+Shift+N 打开新实例窗口 Ctrl+Shift+W 关闭窗口实例

2、基础编辑

Ctrl+X 剪切 Ctrl+C 复制
Alt+下/上 移动行 shift+Alt+上/下 复制行
Ctrl+Shift+K 删除行 ,改成Ctrl+D
Ctrl+(Shift)+Enter 插入行
Ctrl+Shift+ 跳转到匹配的括号
Ctrl+[/] 行缩进
Ctrl+Shift+[/] 代码折叠
Ctrl+/ 行注释,Shift+Alt+A 块注释 ,改成Ctrl+shif+/
Alt+Z 是否换行(word wrap)

Ctrl+空格键 智能提示 ,改成Alt+/
Ctrl+Shift+Space 参数提示,Tab 自动补全
Ctrl+K Ctrl+I 显示悬停(类似于鼠标hover悬停,一般用于触发提示)
Shift+Alt+F 格式化文档(改成Ctrl+Shift+F),Ctrl+K Ctrl+F 格式化选中代码
F12 跳转定义,Alt+F12 查看定义 分别改成F3,Alt+F3
Ctrl+K F12 在侧边打开定义
Ctrl+. 快速修复
Shift+F12 显示引用
F2 重命名变量
Ctrl+K M 更改文件语言类型

3、导航

Ctrl+T 显示所有变量、函数名等 #
Ctrl+G 跳转行
Ctrl+P 打开文件
Ctrl+Shift+O 跳转到变量、函数等@
Ctrl+Shift+M 显示终端、错误等程序面板
F8 跳转到下一个错误或警告,改成Ctrl+,
Shift+F8 跳转到上一个错误或警告, 改成ctrl+shift+,
Ctrl+Shift+Tab 切换编辑器,我改成了Ctrl+E
Alt+左/右 向前/后
Ctrl+M 切换tab焦点

4、搜索和替换

Ctrl+F , Ctrl+H , F3/SHift+F3
Alt+Enter 选中所有匹配搜索的

5、多光标,选择,多行编辑

Ctrl+I 选中当前行
Alt+Click 插入多个光标
Ctrl+Alt+上/下 插入多个光标 ,改成Ctrl++Shift+Alt+上/下
Ctrl+U 撤销上一次光标操作
Shift+Alt+I 在选中的所有行末尾插入光标
Ctrl+Shift+L , Ctrl+F2 都可以选中文中所有和当前的选择或单词同名的,重构重命名时很方便
Shift+Alt+左/右 缩小、扩大选择区块
Shift+Alt+鼠标拖拽 , Ctrl+Shift+Alt+方向键 列选择
Ctrl+Shift+Alt+PgUp/PgDown 列页选择

6、编辑器管理

Ctrl+W, Ctrl+F4 关闭当前编辑器 , Ctrl+K Ctrl+W关闭所有
Ctrl+Shift+T 重新打开上一次关闭的编辑器
Ctrl+K F 关闭目录
Ctrl+ 分割编辑器
Ctrl+1/2/3 转移编辑器焦点到不同编辑组
Ctrl+K (Ctrl+)左/右 转移编辑器焦点到左右组
Shift+F10显示上下文菜单

7、文件管理

Ctrl+N 新建文件,Ctrl+O 打开文件
Ctrl+S , Ctrl+Shift+S , Ctrl+K S 保存,另存为,保存所有
Ctrl+K P 复制文件路径
Ctrl+K R 在资源管理器中打开文件
Ctrl+K O 在新窗口打开文件

8、显示

F11 全屏
Shift+Alt+1 改变编辑器布局
Ctrl+ =/- 放大或缩小
Ctrl+B 开关侧边栏

Ctrl+Shift+E 焦点放到Explorer
Ctrl+Shift+F 焦点放到搜索,改成ctrl+alt+f
Ctrl+Shift+G 焦点放Git
Ctrl+Shift+D 焦点放到Debug
Ctrl+Shift+X 焦点放到扩展
Ctrl+Shift+H replace in files

9、调试

F9 设置断点
F5 开始/继续
Shift+F5 停止
F11/Shift+F11 step into/out
F10 step over
Ctrl+K Ctrl+I show hover

10、终端集成

Ctrl+` 显示集成的终端
Ctrl+Shift+` 创建新的终端
Ctrl+Shift+C 复制选中
Ctrl+Shift+V 粘贴到终端
Ctrl+↑ / ↓ Scroll up/down
Shift+PgUp / PgDown Scroll page up/down
Ctrl+Home / End Scroll to top/bottom

针对Window快捷键冲突和Eclipse习惯改造自定义的部分

// 将键绑定放入此文件中以覆盖默认值
[{
        "key": "alt+/",
        "command": "editor.action.triggerSuggest",
        "when": "editorHasCompletionItemProvider && editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+d",
        "command": "editor.action.deleteLines",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+/",
        "command": "editor.action.blockComment",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+f",
        "command": "editor.action.formatDocument",
        "when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly"
    },
    {
        "key": "f3",
        "command": "editor.action.goToDeclaration",
        "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "alt+f3",
        "command": "editor.action.goToImplementation",
        "when": "editorHasImplementationProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    { "key": "ctrl+e", "command": "workbench.action.openPreviousRecentlyUsedEditorInGroup" },
    {
        "key": "ctrl+,",
        "command": "editor.action.marker.next",
        "when": "editorFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+,",
        "command": "editor.action.marker.prev",
        "when": "editorFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+alt+up",
        "command": "editor.action.insertCursorAbove",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+shift+alt+down",
        "command": "editor.action.insertCursorBelow",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+alt+f",
        "command": "search.action.focusActiveEditor",
        "when": "searchInputBoxFocus && searchViewletVisible"
    }
]
    原文作者:xbynet
    原文地址: https://segmentfault.com/a/1190000009519736
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞