How to map Ctrl+A and Ctrl+Shift+A differently?

Gvim doesn’t do it because vim cannot do it (under normal circumstances). Sorry, but that’s just how it is.


However…

Some terminals (e.g., xterm and iterm2) can be configured to send an arbitrary escape sequence for any combination of keys.

For example, add the following to .Xresources for xterm to send <Esc>[65;5u for CtrlShiftA. You can then map that in Vim to <C-S-a>. (65 is the decimal Unicode value for shift-a and 5 is the bit for the ctrl modifier. The u in this case stands for “unicode”.)

! .Xresources
XTerm*vt100.translations: #override Ctrl ~Meta Shift <Key>a: string(0x1b) string("[65;5u")

iTerm and [u]rxvt can also be configured to do this (examples not provided).

More info: http://www.leonerd.org.uk/hacks/fixterms/

Leave a Comment