本文介绍了如何将 vim(键绑定)与 Visual Studio Code vim 扩展一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我刚开始使用 Visual Studio Code,觉得它真的很棒.还安装了 vim 扩展,但我正在努力将 映射到另一个键.

I just started using Visual Studio Code and think it's really great.Also installed the vim extension, but I'm struggling with mapping to a another key.

通常我有这个:

:imap jj <Esc>

我可以看到 VS Code 有一个 keybindings.json 文件.我试过这个:

And I can see that VS Code has a keybindings.json file. I tried this:

[{
    "key": "jj",
    "command": "vim.Esc",
    "when": "editorTextFocus"
}]

还有一个settings.json文件,所以我试了一下:

Also there is a settings.json file, so I tried:

{
  "vim.keyboardLayout": "en-US (QWERTY)",
    "vim.insertModeKeyBindings": {
        "j": "vim.Esc"
    }
}

也没有用.那么有谁知道如何将 vim 扩展与 VS Code 一起使用,我可以将 jj 映射到 Esc 或其他东西到 Esc 吗?

Also did not work. So does anyone know how to use the a vim extension with VS Code where I can map jj to Esc or something else to Esc perhaps?

推荐答案

将以下内容添加到 settings.json(打开命令面板并搜索用户设置"):

Add the following to settings.json (open the Command Pallete and search for "User Settings"):

"vim.insertModeKeyBindings": [
     {
         "before": ["j", "j"],
         "after": ["<esc>"]
     }
]

应该可以.

这篇关于如何将 vim(键绑定)与 Visual Studio Code vim 扩展一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:09