vs code vim copy paste delete

vs code 安装 vim 插件 后输入效率大大提高,可是vim的d y p这几个命令使用起来可没那么爽。老是打破ctrl+c ctrl+v ctrl+x的习惯。每次删除都会修改剪贴板。

那么能不能让vim直接调用vs code 的copy , paste , delete line命令呢,答案是可以的。

设置如下

File=>Preferences=>Settings

"vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["d","d"],
            "commands":["editor.action.deleteLines"],
            "when":"textInputFocus && !editorReadonly"
        },
        {
            "before":["y"],
            "commands":["editor.action.clipboardCopyAction"],
            "when":"textInputFocus"
        },
        {
            "before":["y","y"],
            "commands":["editor.action.clipboardCopyAction"],
            "when":"textInputFocus"
        },
        {
            "before":["p"],
            "commands":["editor.action.clipboardPasteAction"],
            "when":"textInputFocus && !editorReadonly"
        }
    ],
    "vim.visualModeKeyBindingsNonRecursive":[
        {
            "before":["y"],
            "commands":["editor.action.clipboardCopyAction"],
            "when":"textInputFocus"
        },
        {
            "before":["y","y"],
            "commands":["editor.action.clipboardCopyAction"],
            "when":"textInputFocus"
        },
        {
            "before":["x"],
            "commands":["deleteRight"],
            "when":"textInputFocus"
        },
    ]

使用起来爽爽的

参考文章

https://stackoverflow.com/questions/11993851/how-to-delete-not-cut-in-vim

https://github.com/VSCodeVim/Vim/#key-remapping

File=>Preferences=>Keyboard Shortcuts

你可能感兴趣的:(Visual,Studio,Code,Vim,vs,code)