Fix terminal keys

XTerm was changed 3 5 7 years ago, to send a much nicer and much-improved format of control codes when pressing "modified" cursor keys; e.g. shift-left or control-up. This new method makes a lot of sense and is very nice.

However, no applications have been fixed to understand this new scheme, apart from emacs. This means that vim, et al, do not understand the new codes that xterm sends for these keys. A long-term solution would be to fix/replace the terminfo part of libncurses, but given the very core nature of such a system, it will take a long time for a sensible solution to be developed and, more importantly, accepted by its maintainers.

Except, as luck would have it, I have written a library to handle all this mess in an libtermkey. If only someone would actually use it. (Vim, mutt, irssi, readline... I'm looking at you guys...)

Until then, a workaround must be found whereever possible. Find below a big set of map commands in a vim plugin, which fixes the way vim reads modified cursor keys from xterm.