vscode 自定義快捷鍵

cliter發表於2024-06-28

ctrl+k ctrl+s 開啟快捷鍵列表,標籤頁最右邊可開啟自定義快捷鍵的檔案。
image

內容可參考 Key Bindings for Visual Studio Code

例如:

// Place your key bindings in this file to override the defaults
[
    // 刪除到頭
    // 刪除到尾
    {
        "key": "ctrl+shift+backspace",
        "command": "runCommands",
        "args": {
            "commands": [
                "cursorHomeSelect",
                "deleteLeft"
            ]
        },
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+delete",
        "command": "runCommands",
        "args": {
            "commands": [
                "cursorEndSelect",
                "deleteLeft"
            ]
        },
        "when": "textInputFocus && !editorReadonly"
    }
]
  1. 快速輸入 key:快捷鍵列表頁面搜尋欄右邊有個 record keys 按鈕,輸入按鍵快速生成對應文字
  2. 快速輸入 command:快捷鍵列表頁面,右鍵需要的快捷鍵命令,選擇 copy command id

相關文章