vscode之經常使用快捷鍵


原文章地址: vscode: Visual Studio Code 經常使用快捷鍵

官方快捷鍵說明:Key Bindings for Visual Studio Code

 

主命令框

F1 或 Ctrl+Shift+P: 打開命令面板。在打開的輸入框內,能夠輸入任何命令,例如:javascript

  • 按一下 Backspace 會進入到 Ctrl+P 模式
  • 在 Ctrl+P 下輸入 > 能夠進入 Ctrl+Shift+P 模式

在 Ctrl+P 窗口下還能夠:html

  • 直接輸入文件名,跳轉到文件
  • ? 列出當前可執行的動做
  • ! 顯示 Errors或 Warnings,也能夠 Ctrl+Shift+M
  • : 跳轉到行數,也能夠 Ctrl+G 直接進入
  • @ 跳轉到 symbol(搜索變量或者函數),也能夠 Ctrl+Shift+O 直接進入
  • @ 根據分類跳轉 symbol,查找屬性或函數,也能夠 Ctrl+Shift+O 後輸入:進入
  • # 根據名字查找 symbol,也能夠 Ctrl+T

經常使用快捷鍵

編輯器與窗口管理

  1. 打開一個新窗口: Ctrl+Shift+N
  2. 關閉窗口: Ctrl+Shift+W
  3. 同時打開多個編輯器(查看多個文件)
  4. 新建文件 Ctrl+N
  5. 文件之間切換 Ctrl+Tab
  6. 切出一個新的編輯器(最多 3 個) Ctrl+\,也能夠按住 Ctrl 鼠標點擊 Explorer 裏的文件名
  7. 左中右 3 個編輯器的快捷鍵 Ctrl+1 Ctrl+2 Ctrl+3
  8. 3 個編輯器之間循環切換 Ctrl+
  9. 編輯器換位置, Ctrl+k而後按 Left或 Right

代碼編輯

格式調整

  1. 代碼行縮進 Ctrl+[ 、 Ctrl+]
  2. Ctrl+C 、 Ctrl+V 複製或剪切當前行/當前選中內容
  3. 代碼格式化: Shift+Alt+F,或 Ctrl+Shift+P 後輸入 format code
  4. 上下移動一行: Alt+Up 或 Alt+Down
  5. 向上向下複製一行: Shift+Alt+Up 或 Shift+Alt+Down
  6. 在當前行下邊插入一行 Ctrl+Enter
  7. 在當前行上方插入一行 Ctrl+Shift+Enter

光標相關

  1. 移動到行首: Home
  2. 移動到行尾: End
  3. 移動到文件結尾: Ctrl+End
  4. 移動到文件開頭: Ctrl+Home
  5. 移動到定義處: F12
  6. 定義處縮略圖:只看一眼而不跳轉過去 Alt+F12
  7. 移動到後半個括號: Ctrl+Shift+]
  8. 選擇從光標到行尾: Shift+End
  9. 選擇從行首到光標處: Shift+Home
  10. 刪除光標右側的全部字: Ctrl+Delete
  11. 擴展/縮小選取範圍: Shift+Alt+Left 和 Shift+Alt+Right
  12. 多行編輯(列編輯):Alt+Shift+鼠標左鍵Ctrl+Alt+Down/Up
  13. 同時選中全部匹配: Ctrl+Shift+L
  14. Ctrl+D 下一個匹配的也被選中 (在 sublime 中是刪除當前行,後面自定義快鍵鍵中,設置與 Ctrl+Shift+K 互換了)
  15. 回退上一個光標操做: Ctrl+U

重構代碼

  1. 找到全部的引用: Shift+F12
  2. 同時修改本文件中全部匹配的: Ctrl+F12
  3. 重命名:好比要修改一個方法名,能夠選中後按 F2,輸入新的名字,回車,會發現全部的文件都修改了
  4. 跳轉到下一個 Error 或 Warning:當有多個錯誤時能夠按 F8 逐個跳轉
  5. 查看 diff: 在 explorer 裏選擇文件右鍵 Set file to compare,而後須要對比的文件上右鍵選擇 Compare with file_name_you_chose

查找替換

  1. 查找 Ctrl+F
  2. 查找替換 Ctrl+H
  3. 整個文件夾中查找 Ctrl+Shift+F

顯示相關

  1. 全屏:F11
  2. zoomIn/zoomOut:Ctrl +/-
  3. 側邊欄顯/隱:Ctrl+B
  4. 顯示資源管理器 Ctrl+Shift+E
  5. 顯示搜索 Ctrl+Shift+F
  6. 顯示 Git Ctrl+Shift+G
  7. 顯示 Debug Ctrl+Shift+D
  8. 顯示 Output Ctrl+Shift+U

其餘

  • 自動保存:File -> AutoSave ,或者 Ctrl+Shift+P,輸入 auto

修改默認快捷鍵

打開默認鍵盤快捷方式設置:
File -> Preferences -> Keyboard Shortcuts,或者:Alt+F -> p -> k前端

修改 keybindings.jsonvue

// Place your key bindings in this file to overwrite the defaults [     // ctrl+space 被切換輸入法快捷鍵佔用     {         "key": "ctrl+alt+space",         "command": "editor.action.triggerSuggest",         "when": "editorTextFocus"     },     // ctrl+d 刪除一行     {         "key": "ctrl+d",         "command": "editor.action.deleteLines",         "when": "editorTextFocus"     },     // 與刪除一行的快捷鍵互換     {         "key": "ctrl+shift+k",         "command": "editor.action.addSelectionToNextFindMatch",         "when": "editorFocus"     },     // ctrl+shift+/多行註釋     {         "key":"ctrl+shift+/",         "command": "editor.action.blockComment",         "when": "editorTextFocus"     },     // 定製與 sublime 相同的大小寫轉換快捷鍵,需安裝 TextTransform 插件     {         "key": "ctrl+k ctrl+u",         "command": "uppercase",         "when": "editorTextFocus"     },     {         "key": "ctrl+k ctrl+l",         "command": "lowercase",         "when": "editorTextFocus"     } ]

前端開發必備插件

  • PostCSS Sorting
  • stylelint
  • stylefmt
  • ESLint
  • javascript standard format
  • beautify
  • Babel ES6/ES7
  • Debugger for Chrome
  • Add jsdoc comments
  • javascript(ES6) code snippets
  • vue
  • weex
  • Reactjs code snippets
  • React Native Tools
  • Npm Intellisense
  • Instant Markdown
  • Markdown Shortcuts
  • TextTransform

自定義設置參考

vscode 自定義配置參考:java

{     "editor.fontSize": 18,     "files.associations": {         "*.es": "javascript",         "*.es6": "javascript"     },     // 控制編輯器是否應呈現空白字符     "editor.renderWhitespace": true,     // 啓用後,將在保存文件時剪裁尾隨空格。     "files.trimTrailingWhitespace": true,     // File extensions that can be beautified as javascript or JSON.     "beautify.JSfiles": [         "",         "es",         "es6",         "js",         "json",         "jsbeautifyrc",         "jshintrc"     ] }


======================

很是全的VsCode快捷鍵


    
按 Press 功能 Function
Ctrl + Shift + P,F1 顯示命令面板 Show Command Palette
Ctrl + P 快速打開 Quick Open
Ctrl + Shift + N 新窗口/實例 New window/instance
Ctrl + Shift + W 關閉窗口/實例 Close window/instance

基礎編輯 Basic editing

按 Press 功能 Function
Ctrl+X 剪切行(空選定) Cut line (empty selection)
Ctrl+C 複製行(空選定)Copy line (empty selection)
Alt+ ↑ / ↓ 向上/向下移動行 Move line up/down
Shift+Alt + ↓ / ↑ 向上/向下複製行 Copy line up/down
Ctrl+Shift+K 刪除行 Delete line
Ctrl+Enter 在下面插入行 Insert line below
Ctrl+Shift+Enter 在上面插入行 Insert line above
Ctrl+Shift+\ 跳到匹配的括號 Jump to matching bracket
Ctrl+] / [ 縮進/縮進行 Indent/outdent line
Home 轉到行首 Go to beginning of line
End 轉到行尾 Go to end of line
Ctrl+Home 轉到文件開頭 Go to beginning of file
Ctrl+End 轉到文件末尾 Go to end of file
Ctrl+↑ / ↓ 向上/向下滾動行 Scroll line up/down
Alt+PgUp / PgDown 向上/向下滾動頁面 Scroll page up/down
Ctrl+Shift+[ 摺疊(摺疊)區域 Fold (collapse) region
Ctrl+Shift+] 展開(未摺疊)區域 Unfold (uncollapse) region
Ctrl+K Ctrl+[ 摺疊(未摺疊)全部子區域 Fold (collapse) all subregions
Ctrl+K Ctrl+] 展開(未摺疊)全部子區域 Unfold (uncollapse) all subregions
Ctrl+K Ctrl+0 摺疊(摺疊)全部區域 Fold (collapse) all regions
Ctrl+K Ctrl+J 展開(未摺疊)全部區域 Unfold (uncollapse) all regions
Ctrl+K Ctrl+C 添加行註釋 Add line comment
Ctrl+K Ctrl+U 刪除行註釋 Remove line comment
Ctrl+/ 切換行註釋 Toggle line comment
Shift+Alt+A 切換塊註釋 Toggle block comment
Alt+Z 切換換行 Toggle word wrap

導航 Navigation

按 Press 功能 Function
Ctrl + T 顯示全部符號 Show all Symbols
Ctrl + G 轉到行... Go to Line...
Ctrl + P 轉到文件... Go to File...
Ctrl + Shift + O 轉到符號... Go to Symbol...
Ctrl + Shift + M 顯示問題面板 Show Problems panel
F8 轉到下一個錯誤或警告 Go to next error or warning
Shift + F8 轉到上一個錯誤或警告 Go to previous error or warning
Ctrl + Shift + Tab 導航編輯器組歷史記錄 Navigate editor group history
Alt + ←/→ 返回/前進 Go back / forward
Ctrl + M 切換選項卡移動焦點 Toggle Tab moves focus

搜索和替換 Search and replace

按 Press 功能 Function
Ctrl + F 查找 Find
Ctrl + H 替換 Replace
F3 / Shift + F3 查找下一個/上一個 Find next/previous
Alt + Enter 選擇查找匹配的全部出現 Select all occurences of Find match
Ctrl + D 將選擇添加到下一個查找匹配 Add selection to next Find match
Ctrl + K Ctrl + D 將最後一個選擇移至下一個查找匹配項 Move last selection to next Find match
Alt + C / R / W 切換區分大小寫/正則表達式/整個詞 Toggle case-sensitive / regex / whole word

多光標和選擇 Multi-cursor and selection

按 Press 功能 Function
Alt +單擊 插入光標 Insert cursor
Ctrl + Alt +↑/↓ 在上/下插入光標 Insert cursor above / below
Ctrl + U 撤消上一個光標操做 Undo last cursor operation
Shift + Alt + I 在選定的每一行的末尾插入光標 Insert cursor at end of each line selected
Ctrl + I 選擇當前行 Select current line
Ctrl + Shift + L 選擇當前選擇的全部出現 Select all occurrences of current selection
Ctrl + F2 選擇當前字的全部出現 Select all occurrences of current word
Shift + Alt + → 展開選擇 Expand selection
Shift + Alt + ← 縮小選擇 Shrink selection
Shift + Alt + (拖動鼠標) 列(框)選擇 Column (box) selection
Ctrl + Shift + Alt +(箭頭鍵) 列(框)選擇 Column (box) selection
Ctrl + Shift + Alt + PgUp / PgDown 列(框)選擇頁上/下 Column (box) selection page up/down

豐富的語言編輯 Rich languages editing

按 Press 功能 Function
Ctrl + 空格 觸發建議 Trigger suggestion
Ctrl + Shift + Space 觸發器參數提示 Trigger parameter hints
Tab Emmet 展開縮寫 Emmet expand abbreviation
Shift + Alt + F 格式化文檔 Format document
Ctrl + K Ctrl + F 格式選定區域 Format selection
F12 轉到定義 Go to Definition
Alt + F12 Peek定義 Peek Definition
Ctrl + K F12 打開定義到邊 Open Definition to the side
Ctrl + . 快速解決 Quick Fix
Shift + F12 顯示引用 Show References
F2 重命名符號 Rename Symbol
Ctrl + Shift + . /, 替換爲下一個/上一個值 Replace with next/previous value
Ctrl + K Ctrl + X 修剪尾隨空格 Trim trailing whitespace
Ctrl + K M 更改文件語言 Change file language

編輯器管理 Editor management

按 Press 功能 Function
Ctrl+F4, Ctrl+W 關閉編輯器 Close editor
Ctrl+K F 關閉文件夾 Close folder
Ctrl+\ 拆分編輯器 Split editor
Ctrl+ 1 / 2 / 3 聚焦到第1,第2或第3編輯器組 Focus into 1st, 2nd or 3rd editor group
Ctrl+K Ctrl+ ←/→ 聚焦到上一個/下一個編輯器組 Focus into previous/next editor group
Ctrl+Shift+PgUp / PgDown 向左/向右移動編輯器 Move editor left/right
Ctrl+K ← / → 移動活動編輯器組 Move active editor group

文件管理 File management

按 Press 功能 Function
Ctrl+N 新文件 New File
Ctrl+O 打開文件... Open File...
Ctrl+S 保存 Save
Ctrl+Shift+S 另存爲... Save As...
Ctrl+K S 所有保存 Save All
Ctrl+F4 關閉 Close
Ctrl+K Ctrl+W 關閉全部 Close All
Ctrl+Shift+T 從新打開關閉的編輯器 Reopen closed editor
Ctrl+K 輸入保持打開 Enter Keep Open
Ctrl+Tab 打開下一個 Open next
Ctrl+Shift+Tab 打開上一個 Open previous
Ctrl+K P 複製活動文件的路徑 Copy path of active file
Ctrl+K R 顯示資源管理器中的活動文件 Reveal active file in Explorer
Ctrl+K O 顯示新窗口/實例中的活動文件 Show active file in new window/instance

顯示 Display

按 Press 功能 Function
F11 切換全屏 Toggle full screen
Shift+Alt+1 切換編輯器佈局 Toggle editor layout
Ctrl+ = / - 放大/縮小 Zoom in/out
Ctrl+B 切換側欄可見性 Toggle Sidebar visibility
Ctrl+Shift+E 顯示瀏覽器/切換焦點 Show Explorer / Toggle focus
Ctrl+Shift+F 顯示搜索 Show Search
Ctrl+Shift+G 顯示Git Show Git
Ctrl+Shift+D 顯示調試 Show Debug
Ctrl+Shift+X 顯示擴展 Show Extensions
Ctrl+Shift+H 替換文件 Replace in files
Ctrl+Shift+J 切換搜索詳細信息 Toggle Search details
Ctrl+Shift+C 打開新命令提示符/終端 Open new command prompt/terminal
Ctrl+Shift+U 顯示輸出面板 Show Output panel
Ctrl+Shift+V 切換Markdown預覽 Toggle Markdown preview
Ctrl+K V 從旁邊打開Markdown預覽 Open Markdown preview to the side

調試 Debug

按 Press 功能 Function
F9 切換斷點 Toggle breakpoint
F5 開始/繼續 Start/Continue
Shift+F5 中止 Stop
F11 / Shift+F11 下一步/上一步 Step into/out
F10 跳過 Step over
Ctrl+K Ctrl+I 顯示懸停 Show hover

集成終端 Integrated terminal

按 Press 功能 Function
Ctrl+` 顯示集成終端 Show integrated terminal
Ctrl+Shift+` 建立新終端 Create new terminal
Ctrl+Shift+C 複製選定 Copy selection
Ctrl+Shift+V 粘貼到活動端子 Paste into active terminal
Ctrl+↑ / ↓ 向上/向下滾動 Scroll up/down
Shift+PgUp / PgDown 向上/向下滾動頁面 Scroll page up/down
Ctrl+Home / End 滾動到頂部/底部 Scroll to top/bottom
相關文章
相關標籤/搜索