Invert the number row keys for faster typing
From Vim Tips Wiki
created September 7, 2006 · complexity basic · author Peter Hodge · version 5.7
In many languages you will use '!@#$%^&*()_' far more often than you use '1234567890-' so you will find yourself pressing SHIFT quite often, but this is not necessary. You can reverse the function of the number row keys so that typing a number key gives you the symbol instead of the number, and SHIFT-Number-Key can be used to type the number. This will save you a lot of time leaning on the SHIFT key, especially for '(' and ')' and '_', which are more common than their non-SHIFT characters '9' and '0' and '-'.
Just add these commands to your vimrc
" map each number to its shift-key character inoremap 1 ! inoremap 2 @ inoremap 3 # inoremap 4 $ inoremap 5 % inoremap 6 ^ inoremap 7 & inoremap 8 * inoremap 9 ( inoremap 0 ) inoremap - _ " and then the opposite inoremap ! 1 inoremap @ 2 inoremap # 3 inoremap $ 4 inoremap % 5 inoremap ^ 6 inoremap & 7 inoremap * 8 inoremap ( 9 inoremap ) 0 inoremap _ -
This is very frustrating for the first month or two when you will frequently press SHIFT when you don't need to, or forget to press SHIFT when you do. After a few months your typing speed should be noticeably faster and more relaxed as you are no longer holding the SHIFT key down all day.
This tip could make you quite crazy if you use other programs, say Word. Other than that, it would be very cool typing parenthesis without pressing shift!
If you are used to typing numbers on the numpad with NumLock on, just map each number to its shift-key character, leaving shift-number keys as is.
This way, you can keep typing shift-key characters with Shift, until you get used to the new easiest typing style.
I tried putting this in my .vimrc, but then went back and pulled it out when I realized a flaw. The change only applies within the Vim buffer. Once I got to the command line (for example, entering ":q!", what I actually entered was ":q1") since the remapping did not extend outside the Vim buffer.
Well, if you're brave you could do it system-wide:
xmodmap - <<EOF keycode 10 = 1 exclamdown onesuperior exclamdown onesuperior keycode 11 = 2 quotedbl at twosuperior at twosuperior keycode 12 = 3 numbersign sterling threesuperior sterling threesuperior keycode 13 = 4 dollar keycode 14 = percent 5 onehalf cent onehalf cent keycode 15 = ampersand 6 yen fiveeighths yen fiveeighths keycode 16 = slash 7 braceleft division braceleft division keycode 17 = parenleft 8 bracketleft guillemotleft bracketleft guillemotleft keycode 18 = parenright 9 bracketright guillemotright bracketright guillemotright keycode 19 = 0 equal braceright degree braceright degree EOF
This is what I'm experimenting with now. Since I actually use at least 1,2,3 fairly often, only swapped half the row ^^ Not sure how it'll work out though
This tip is for US-QWERTY only. Other "national keyboards" have different symbols on the number keys, and some have the numbers "shifted" with punctuation marks and/or accented letters on the "unshifted" side of the same keys — my fr-BE is an example, but fr-FR, though also an AZERTY keyboard, has different symbols on the "unshifted" digits.
Of course, the inoremaps at top can be adapted mutatis mutandis to any keyboard which has "unshifted" digits (those with "shifted" digits don't need them); it's much less obvious what regards the xmodmap solution, because of the esoteric key names — and also, of course, it works for X11 but not for Windows, and I don't know about the Mac. — Tonymec 23:47, 25 May 2009 (UTC)