I find myself wanting to use vim one-handed now and again. Practicality aside, I want to define a function along the lines of:
function! GetControlKey()
echo "Control? "
let key = nr2char(getchar())
execute "normal! " . key
endfunction
that I can map to another key combination <Leader>,
maybe, that will allow me to get the keycode for a character, then mask it with whatever constant vim uses internally for key -> Control-key conversion. Then use normal!
to emit the keypress, so I don't have to stretch my hand to reach the control key as often. Does vim use the same technique as other software (ControlMask,ShiftMask in Xlib) or does it use something specific to vim?
I am aware that Sticky shift - or getting <shift> with letter combinations discusses a similar concept, but that uses subtraction to get lowercase->uppercase ascii conversion. I have tried bitwise &-ing the pairs for different keys echo and(char2nr('<C-f>'),char2nr('f'))
to try and get an idea of which bits are toggled between the two, but this doesn't produce a consistent result when doing the same thing for other characters (a, e, g etc.).