简体   繁体   中英

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

I have discovered Vim a year ago and I am getting more and more addicted to it.

I remapped every key of my french dvorak-like bépo layout to stick to the qwerty layout for the normal mode, as described in "Reconfiguration totale des touches" on this page: https://bepo.fr/wiki/Vim , essentially because I learnt with Vim Adventures game.

It works very well:

For instance, yr remaps as cl : the command cuts the character to the right and enter insertion mode.

However, the vim status line displays y for one second before displaying c:

在 nvim 状态行中显示 y 而不是 c

I changed my mapping from:

noremap y c

to this:

map <nowait> y c

without success.

Anyone knows if it is possible to display a remapped operator-pending key immediately, ie "c" in my case?

This has nothing to do with vim-airline or any other plugin.

The pending operator is shown due to showcmd standard option. AFAIK, there's no way to change this, except to disable it completely ( set noshowcmd ), or to patch Vim's source code.

Instead of remapping every key combination, a simpler solution is to use langmap . This provides the additionnal benefit to show the remapped command key.

From :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.

To test it:

:set langmap=éw remaps é to w in normal mode.

:set showcmd displays w instead of é in the status line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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