VS Code 配置刪除左邊單詞快捷鍵(同Sublime 和 Atom)

VS Code 中刪除一行的快捷鍵默認是 cmd + shift + k,或者使用簡介 cmd + x,對於一個長期使用 Sublime 和 Atom 的程序猿來講,在VS Code 上刪除行,特別是 刪除光標左邊單詞的 的操做是十分不習慣的(一度想要爲此放棄VS Code...),百度上折騰了一大圈,最後仍是本身動手修改了快捷鍵,這下寫代碼舒坦了,貼一下快捷鍵的配置過程。json

 

1. cmd + K + S,呼出快捷鍵配置界面,以下測試

2. 輸入要修改的快捷鍵(支持模糊搜索),這裏我要修改的是 deleteLeftthis

3. 選擇相關的快捷鍵,點擊 Keybinding 對應的快捷鍵,會彈出修改框spa

4. 在輸入框中輸入想要改爲的快捷鍵,在右邊會自動生成對應的快捷鍵 json 文件(會覆蓋默認快捷鍵)3d

5. 保存 keybinding.json 文件,回到代碼中測試,大功告成。code

 

固然,直接把下面的配置文件複製到 keybinding.json 中而後保存也是能夠的。blog

// Place your key bindings in this file to overwrite the defaults
[
    {
        "key": "cmd+backspace",
        "command": "deleteLeft",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "ctrl+backspace",
        "command": "-deleteLeft",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "ctrl+h",
        "command": "-deleteLeft",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "shift+backspace",
        "command": "-deleteLeft",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "cmd+backspace",
        "command": "deleteWordLeft",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "alt+backspace",
        "command": "-deleteWordLeft",
        "when": "textInputFocus && !editorReadonly"
    }
]

 

相關文章
相關標籤/搜索