I use the shift keys a lot and it is an unnecessary strain on the pinky. The enter
and backspace
functionalities are conveniently located under a dominant finger (ctrl-m and ctrl-h). Similarly:
Is there a way to map the shift function to a dominant finger?
But in the vim spirit I want to get this functionality with a key combination rather than finger acrobatics; e.g., lets use the extremely rare key combination fd
(in insert mode!).
For the alphanumerical keys one could dump an entire list of imaps: fd1 !
, fd2 @
, ..., fda A
etc. into vimrc. I'm hoping there is a better way.
Ideally,
fd
would be mapped to a "sticky shift" that waits for a one letter input, shifts it, then turns off the sticky shift. Is this possible?
Many thanks!
Post mortem
Rich has a function down below which can be modified to have the complete effect. Last night someone wrote a neat solution and then erased it so I will include it here:
imap <expr> fd nr2char(getchar()-32)
This does the trick if all you want to capitalize letters. Otherwise it seems like a good way to do function calls.
Another good suggestion in the comments below is modifying the keyboard at the firmware level using this.
Thanks for the help everyone!
vimrc
; I'll add an answer that does this if no-one comes up with a proper solution.fd
to a function that takes input and converts it if appropriate. Marginally cleaner. I'll write this, too.