Vim Tips Wiki
(Change to TipImported template + severe manual clean)
(Move categories to tip template)
Line 9: Line 9:
 
|version=5.7
 
|version=5.7
 
|rating=19/28
 
|rating=19/28
  +
|category1=
  +
|category2=
 
}}
 
}}
 
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 alot of time leaning on the SHIFT key, especially for '(' and ')' and '_', which are more common than their non-SHIFT characters '9' and '0' and '-'.
 
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 alot of time leaning on the SHIFT key, especially for '(' and ')' and '_', which are more common than their non-SHIFT characters '9' and '0' and '-'.

Revision as of 09:31, 25 April 2008

Tip 1323 Printable Monobook Previous Next

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 alot 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.

Comments

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.