Suppose I wanted to map the command :!python % <ENTER>
to pressing the keys Alt Gr
and j
together?
AltGr is interpreted by your keyboard driver, so Vim isn't aware of it in terms of a modifier key. However, there are two ways getting the key code for AltGr-j. In insert mode:
The result depends on your keyboard layout. If you just get j
then you're out of luck.
Due to the way that the keyboard input is handled internally, many key combinations cannot be used, even in GVIM. This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.
A basic rule is: If the key combination yields a visible character in command-line mode, it can be mapped. But in particular for AltGr, it may be the same mapping as Alt, depending on what your OS returns when it's combined with the other key.
Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8
But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With