Vim: set langmap=e;h 破坏 supertab 插件

发布于 2024-12-11 19:13:32 字数 412 浏览 0 评论 0原文

我是 Vim 新手,正在尝试设置一些插件。到目前为止我已经安装了 Pathogen、pyflakes 和 supertab。后者似乎不起作用;在插入模式下按 tab 只会写入字符串 SuperTabForward

该问题仅发生在我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暖伴 2024-12-18 19:13:32

我想出了一个解决方法:编辑 supertab.vim,用

P 替换 SuperTab 的实例,这会导致字符串就像 SuperTabForward 变为

PForward

我认为它有效是因为这些字符串不再包含 set langmap=hjklneiHJKLNEI;kniejhlKNIEJHL 中涉及的任何字母。有几个问题尚未解决。 langmap 有问题吗?对我来说,似乎明确存在该选项以允许仅影响命令的映射:

When you are typing text in Insert mode the characters are
inserted directly.  When in command mode the 'langmap' option takes
care of translating these special characters to the original meaning
of the key.  This means you don't have to change the keyboard mode to
be able to execute Normal mode commands.

那么,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:

When you are typing text in Insert mode the characters are
inserted directly.  When in command mode the 'langmap' option takes
care of translating these special characters to the original meaning
of the key.  This means you don't have to change the keyboard mode to
be able to execute Normal mode 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 long imap strings. Just to illustrate how strange this is, if I do imap no yes, writing jo is necessary to make it trigger. I have no idea how the logic behind that works.

倥絔 2024-12-18 19:13:32

我遇到了同样的问题,但这个解决方法不适合我的情况,所以我发布了自己的问题,有人制作了一个补丁来修复它:

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, prevents langmap 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文