vscode: Visual Studio Code 常用快捷鍵


 

原文轉自https://blog.csdn.net/p358278505/article/details/74221214

 

按 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

 

 

 

 

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

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

 

主命令框

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

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

在 Ctrl+P 窗口下還可以:

  • 直接輸入文件名,跳轉到文件
  • ? 列出當前可執行的動作
  • ! 顯示 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.json

// 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 自定義配置參考:

{
    "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"
    ]
}

 

此文來自於: https://www.cnblogs.com/bindong/p/6045957.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM