如何在 vim-airline 的 operator-pending 模式下显示重映射键而不是原始键?

How to display remapped key instead of original key in operator-pending mode in vim-airline?

一年前就发现了Vim,现在越来越上瘾

我重新映射了我的法语 dvorak-like bépo 布局的每个键,以坚持正常模式的 qwerty 布局,如本页 "Reconfiguration totale des touches" 所述:https://bepo.fr/wiki/Vim,主要是因为我学到了Vim 冒险游戏。

效果很好:

例如,yr 重映射为 cl:该命令将字符向右剪切并进入插入模式。

但是,vim 状态行在显示 c:

之前显示 y 一秒钟

我更改了我的映射:

noremap y c

对此:

map <nowait> y c

没有成功。

任何人都知道是否可以立即显示重新映射的操作员挂起键,即 "c" 在我的情况下?

这与vim-航空公司或任何其他插件无关。

由于 showcmd 标准选项,显示了挂起的运算符。据我所知,除了完全禁用它 (set noshowcmd) 或修补 Vim 的源代码外,没有办法改变它。

与其重新映射每个组合键,更简单的解决方案是使用 langmap。这提供了显示重新映射的命令键的额外好处。

来自:h langmap

This option allows switching your keyboard into a special language
mode.  When you are typing text in Insert mode the characters are
inserted directly.  When in Normal 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.

测试一下:

:set langmap=éw 在正常模式下将 é 重新映射到 w

:set showcmd 在状态行中显示 w 而不是 é