Vim: set langmap=e;h 破坏 supertab 插件
我是 Vim 新手,正在尝试设置一些插件。到目前为止我已经安装了 Pathogen、pyflakes 和 supertab。后者似乎不起作用;在插入模式下按 tab
只会写入字符串
。
该问题仅发生在我的 vimrc 中的以下行(为了使用 colemak 布局更好地导航):
set langmap=hjklneiHJKLNEI;kniejhlKNIEJHL
如果没有上面的行,它就可以正常工作。经过进一步的实验,我将范围缩小到 set langmap=e;h
。这一行中断了超级选项卡。
我对 Vim 完全没有经验,根本不知道发生了什么或如何解决它。即使是解决方法也会很有趣。
I am new to Vim and trying to set up some plugins. So far I have installed pathogen, pyflakes and supertab. The latter does not seem to work; pressing tab
while in insert mode simply writes the string <Plug>SuperTabForward
.
The problem only occurs with the following line in my vimrc (for better navigation using colemak layout):
set langmap=hjklneiHJKLNEI;kniejhlKNIEJHL
Without the above line it works just fine. After further experiments I've narrowed it down to set langmap=e;h
. This single line breaks supertab.
I am entirely too inexperienced with Vim to have the faintest idea of what is going on or how to fix it. Even a workaround would be of interest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想出了一个解决方法:编辑
supertab.vim
,用P
替换SuperTab
的实例,这会导致字符串就像SuperTabForward
变为PForward
。我认为它有效是因为这些字符串不再包含
set langmap=hjklneiHJKLNEI;kniejhlKNIEJHL
中涉及的任何字母。有几个问题尚未解决。 langmap 有问题吗?对我来说,似乎明确存在该选项以允许仅影响命令的映射:那么,imap 字符串中存在 langmap 映射字符对我来说毫无意义,即插入模式映射会产生任何影响。如果是这样,它将随机破坏任何使用长 imap 字符串的插件,例如 SuperTab。只是为了说明这是多么奇怪,如果我执行
imap no yes
,则需要编写jo
才能触发它。我不知道其背后的逻辑是如何运作的。I figured out a workaround: Editing
supertab.vim
, replacing instances of<Plug>SuperTab
with<P>P
, which causes strings like<Plug>SuperTabForward
to become<P>PForward
.I reckon it works because those strings no longer include any of the letters involved in
set langmap=hjklneiHJKLNEI;kniejhlKNIEJHL
. Several issues are unresolved still. Is langmap bugged? To me it seems the option exists explicitly to allow mapping that effects only commands:It makes no sense to me what so ever, then, that the presence of a langmap mapped character in an
imap
string, that is an insert mode mapping, makes any difference. If it does, it will randomly break any plugin such as SuperTab that uses longimap
strings. Just to illustrate how strange this is, if I doimap no yes
, writingjo
is necessary to make it trigger. I have no idea how the logic behind that works.我遇到了同样的问题,但这个解决方法不适合我的情况,所以我发布了自己的问题,有人制作了一个补丁来修复它:
Vim langmap中断插件 (bépo)
https://groups.google.com/forum/#!msg/vim_dev/QnNwLWhJ744/1qNcD7d9OvgJ(请参阅最后一条消息)
此补丁引入了一个新设置:
langnoremap
,其中设置后,可防止 langmap 影响此类映射。它可能需要更多的测试,并且可能不会很快包含在 vim 中,但它似乎工作得很好!
I had the same problem, but this workaround didn't fit my case, so I posted my own question and someone made a patch that fixes it:
Vim langmap breaks plugin (bépo)
https://groups.google.com/forum/#!msg/vim_dev/QnNwLWhJ744/1qNcD7d9OvgJ (see the last message)
This patch introduces a new setting:
langnoremap
which, when set, preventslangmap
from affecting such mappings.It may need some more testing and may not be included in vim very soon, but it seems to work quite well!