2

如何修改 VSCode 中 vim 插件的撤销的行为,使其和 VSCode 默认的撤销一致

 2 years ago
source link: https://fanlumaster.github.io/2022/08/29/%E5%A6%82%E4%BD%95%E4%BF%AE%E6%94%B9-VSCode-%E4%B8%AD-vim-%E6%8F%92%E4%BB%B6%E7%9A%84%E6%92%A4%E9%94%80%E7%9A%84%E8%A1%8C%E4%B8%BA%EF%BC%8C%E4%BD%BF%E5%85%B6%E5%92%8C-VSCode-%E9%BB%98%E8%AE%A4%E7%9A%84%E6%92%A4%E9%94%80%E4%B8%80%E8%87%B4/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

如何修改 VSCode 中 vim 插件的撤销的行为,使其和 VSCode 默认的撤销一致

如何修改 VSCode 中 vim 插件的撤销的行为,使其和 VSCode 默认的撤销一致 _

2022年8月29日 下午

502 字

5 分钟

要想达到这个目标,其实我们可以这样做——给 vim 插件单独配置一份 vimrc 配置,然后将 vim 的撤销操作重新映射一下,使其一个单词一个单词的撤销。但是,经过我的试验,发现 vim 插件不能够正确地读取并应用这个配置。

因此,采用了另一种思路,就是直接利用这个 vim 插件在 settings.json 文件中可以设置的配置,将 normal 模式下的 u 给重新映射一下,映射成 VSCode 本身的撤销操作,这样就可以了,

"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [
"u"
],
"commands": [
"undo"
]
},
{
"before": [
"C-r"
],
"commands": [
"redo"
]
}
]

1、https://github.com/vscodevim/vim/issues/1490



About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK