有没有办法让IdeaVIM遵守我的.vimrc文件中的映射? [英] Is there a way to get IdeaVIM to honor the mappings from my .vimrc file?

查看:225
本文介绍了有没有办法让IdeaVIM遵守我的.vimrc文件中的映射?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近(再次)大范围地进入了vim,现在我的.vimrc文件中有大量自定义项.我意识到,在IDEA插件的上下文中,并不是所有内容都有意义,但是如果选择并尊敬将jj重新映射为Esc之类的东西,我会真的喜欢它.有没有办法做到这一点?无需手动调整IDEA键盘图中的所有内容.

I've recently gotten into vim in a big way (again), and I now have a ton of customization in my .vimrc file. I realize that not everything in there would make sense in the context of an IDEA plugin, but I'd really like it if things like remapping jj to Esc were picked up and honored. Is there a way to do that? Without needing to manually tweak all that stuff in IDEA's keymap, that is.

谢谢.

推荐答案

更新:是的!请参阅下面的答案 .

Update: Yes! See answer below.

简短的回答:没有.

我也一直尝试这样做,因为多年来我已经习惯了相当复杂的.vimrc.

I've been trying to do this too especially because I have quite a complex .vimrc that I've become used to over the years.

无论如何,有一种解决方法(之类). IdeaVim设置存储在主文件夹(在Windows中为C:\Users\<user_name>)内.IntelliJIdea10/config/keymaps文件夹中名为vim.xml的文件中.您可以编辑XML以添加所需的内容.例如,我添加了以下几行以通过点击F2而不是键入:w!来保存文件:

Anyway, there is a workaround (sort of). IdeaVim settings are stored in a file called vim.xml in the .IntelliJIdea10/config/keymaps folder inside your home folder (C:\Users\<user_name> on Windows). You can edit the XML to add stuff that you want. For instance, I added the following lines to save a file by hitting F2 instead of typing :w!:

<action id="SaveAll">
<keyboard-shortcut first-keystroke="F2"/>
</action>

但是,我看不到如何添加函数或vim设置(这通常是我通常使用.vimrc的方式)之类的东西.

However, I don't see how we can add things like functions or vim settings (which is what I'd typically use a .vimrc for).

建议.这可能解释了为什么不使用.vimrc的原因(强调我的意思):

P.S. This might explain why a .vimrc is not used (emphasis mine):

出于好奇,该插件正在 书面,未提及 VIM源代码(除了 正则表达式处理).我是 基本上使用优秀的VIM 文档和VIM本身作为 参考以验证正确的行为.
来源: http://ideavim.sourceforge.net/

For the curious, the plugin is being written without any reference to the VIM source code (except for the regular expression handling). I'm basically using the excellent VIM documentation and VIM itself as a reference to verify correct behavior.
Source: http://ideavim.sourceforge.net/

这篇关于有没有办法让IdeaVIM遵守我的.vimrc文件中的映射?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆