美文网首页
Vscode 自定义快捷键KeyBinding

Vscode 自定义快捷键KeyBinding

作者: 李伟13 | 来源:发表于2020-09-17 18:08 被阅读0次

    目标

    能够避免在VsCode中使用"↑↓←→"和"Home""End",保护手部健康(假的,因为盲打不熟练打字跨度太大手腕更难受了
    安装一个Tabout插件使用tab跳出括号;

    Step1

    Windows10

    C:\Users\Administrator\AppData\Roaming\Code\User\keybindings.json

    Linux在以下路径

    ~/.config/Code/User/keybindings.json

    Step2

    修改内容为:

    [
        // 光标上下左右移动
        {
            "key": "alt+i",
            "command": "cursorUp"
        },
        {
            "key": "alt+j",
            "command": "cursorLeft"
        },
        {
            "key": "alt+l",
            "command": "cursorRight"
        },
        {
            "key": "alt+k",
            "command": "cursorDown"
        },
        {
            "key": "alt+o",
            "command": "cursorEnd",
        },
        {
            "key": "alt+u",
            "command": "cursorHome",
        },
        // 整行上移下移
        {
            "key": "ctrl+i",
            "command": "editor.action.moveLinesUpAction",
            "when": "editorTextFocus && !editorReadonly"
        },
        {
            "key": "ctrl+k",
            "command": "editor.action.moveLinesDownAction",
            "when": "editorTextFocus && !editorReadonly"
        },
        // 选中上下左右内容
        {
            "key": "shift+alt+i",
            "command": "cursorUpSelect",
            "when": "textInputFocus"
        },
        {
            "key": "shift+alt+k",
            "command": "cursorDownSelect",
            "when": "textInputFocus"
        },
        {
            "key": "shift+alt+j",
            "command": "cursorLeftSelect",
            "when": "textInputFocus"
        },
    
        {
            "key": "shift+alt+l",
            "command": "cursorRightSelect",
            "when": "textInputFocus"
        },
        //从当前到行首选中
        {
            "key": "shift+alt+u",
            "command": "cursorHomeSelect",
            "when": "textInputFocus"
        },
        //从当前到行尾选中
        {
            "key": "shift+alt+o",
            "command": "cursorEndSelect",
            "when": "textInputFocus"
        },
    ]
    

    保存.即可实现在VsCode中对于光标的移动.

    Ps

    我后来还想再实现跳转行号,光标向前移五格这样的操作.那么问题来了,我为什么不去用Vim?

    相关文章

      网友评论

          本文标题:Vscode 自定义快捷键KeyBinding

          本文链接:https://www.haomeiwen.com/subject/licryktx.html