VSCode快捷鍵大全

最近從Sublime3切換到VScode,總結下快捷鍵。windows

官方地址:https://code.visualstudio.com...編輯器

簡單的配置ide

{
    "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頁,而不是替換已有的

}

一、通用

Ctrl+Shif+P , F1 打開命令面板 Ctrl+P 快速打開
Ctrl+Shift+N 打開新實例窗口 Ctrl+Shift+W 關閉窗口實例函數

二、基礎編輯

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 更改文件語言類型 ui

三、導航

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焦點調試

四、搜索和替換

Ctrl+F , Ctrl+H , F3/SHift+F3
Alt+Enter 選中全部匹配搜索的code

五、多光標,選擇,多行編輯

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 列頁選擇orm

六、編輯器管理

Ctrl+W, Ctrl+F4 關閉當前編輯器 , Ctrl+K Ctrl+W關閉全部
Ctrl+Shift+T 從新打開上一次關閉的編輯器
Ctrl+K F 關閉目錄
Ctrl+ 分割編輯器
Ctrl+1/2/3 轉移編輯器焦點到不一樣編輯組
Ctrl+K (Ctrl+)左/右 轉移編輯器焦點到左右組
Shift+F10顯示上下文菜單ip

七、文件管理

Ctrl+N 新建文件,Ctrl+O 打開文件
Ctrl+S , Ctrl+Shift+S , Ctrl+K S 保存,另存爲,保存全部
Ctrl+K P 複製文件路徑
Ctrl+K R 在資源管理器中打開文件
Ctrl+K O 在新窗口打開文件

八、顯示

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

九、調試

F9 設置斷點
F5 開始/繼續
Shift+F5 中止
F11/Shift+F11 step into/out
F10 step over
Ctrl+K Ctrl+I show hover

十、終端集成

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"
    }
]
相關文章
相關標籤/搜索