简体   繁体   中英

Remap modifiers key in vim

I had remapped my capslock to the hyper key as mod3 using xmodmap. Here is the result of xmodmap

shift       Shift_L (0x32),  Shift_R (0x3e)
lock      
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3        Hyper_L (0x42),  Hyper_L (0xcf)
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

So is it possible to remap this mod3 key in vim as a leader.

No, unfortunately not. Vim only understands Shift , Ctrl , and Alt modifiers (see :help key-notation ), and you only can use modifiers in combination with regular keys , eg <Ca> as Ctrl + A .

In the terminal, Vim wouldn't even register the keypress of the sole modifier key; no event would be sent to it. In GVIM, this would be technically possible, but Vim uses a unified input model that deliberately ignores some GUI capabilities ( :help design-not ).

This applies to mappings as well as to the Leader key. You need to choose a non-modifier key, or a modifier + key combination.

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