简体   繁体   English

是否有用于 eclipse 的 vim 插件让我将 jj 重新映射到 Esc?

[英]Is there a vim plugin for eclipse that let me remap jj to Esc?

I am looking for an eclipse plugin that gives me basic vim commands.我正在寻找一个 eclipse 插件,它为我提供基本的 vim 命令。

I don't expect to much but I'm so used to 'jj' for escape that this feature is essential for me.我不抱太大希望,但我已经习惯了“jj”来逃避,所以这个功能对我来说是必不可少的。 'jj' should work like in vim: Leave insert mode but don't insert any characters. 'jj' 应该像在 vim 中一样工作:离开插入模式但不插入任何字符。

I'm considering我在考虑

  • viplugin插件
  • vrapper vrapper
  • viable可行的
  • vimplugin插件
  • eclim生态系统

but didn't find much information if it is possible to remap anything to ESC.但如果可以将任何内容重新映射到 ESC,则没有找到太多信息。

With viplugin it seems possible to do that, but when remapping 'jj' it still inserts 'jj'.使用 viplugin 似乎可以做到这一点,但是在重新映射 'jj' 时它仍然插入 'jj'。 Eclim should support it, but it's probably to heavy. Eclim 应该支持它,但它可能太重了。

You can customize vrapper's behaviour with a vimrc-like file: ~/.vrapperrc .您可以使用类似 vimrc 的文件来自定义 vrapper 的行为: ~/.vrapperrc It works like ~/.vimrc syntax-wise but you are quite limited in what you can put there.它的工作原理类似于~/.vimrc语法,但是您可以放置​​的内容非常有限。

inoremap jj <ESC>

does exactly what you want, though, just like in Vim.但是,就像在 Vim 中一样,完全按照您的意愿行事。

What worked for me:什么对我有用:

  1. Make sure your .vrapperrc is in what Eclipse has as your user director.确保您的 .vrapperrc 位于 Eclipse 中作为您的用户目录。 A quick google gave this:一个快速的谷歌给出了这个:

"If you go to Help > About > Installation Details > Configuration tab, can you check if the directory listed next to user.home is the one your .vrapperrc is in?" “如果您转到“帮助”>“关于”>“安装详细信息”>“配置”选项卡,您能否检查 user.home 旁边列出的目录是否是您的 .vrapperrc 所在的目录?

  1. Add this line to the .vrapperrc:将此行添加到 .vrapperrc:

imap jj <ESC>

'inoremap' didn't seem to work for me, but that might have been because of some other issue. 'inoremap' 似乎对我不起作用,但这可能是因为其他一些问题。

  1. Restart Eclipse and profit.重新启动 Eclipse 并获利。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM