Vscode 自定义快捷键KeyBinding

#目标
能够避免在VsCode中使用"↑↓←→"和"Home"“End”(因为实在是有点远
#环境
Windows10+VSCode-x64-1.49.0

Step1

打开以下文件

C:\Users\Administrator\AppData\Roaming\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?

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值