Typing source code is easier for me when the numbers row above the letters (the numrow) is permanently shifted, giving me access to the symbols at a single keypress, without pressing Shift
. The numbers themselves are available when pressing Shift
of course. To achieve this, I use the following in my configuration:
nnoremap 1 !
nnoremap 2 @
nnoremap 3 #
nnoremap 4 $
" etc...
vnoremap 1 !
vnoremap 2 @
vnoremap 3 #
vnoremap 4 $
" etc...
onoremap 1 !
onoremap 2 @
onoremap 3 #
onoremap 4 $
" etc...
" the inverse maps not included here
This works great normally, but I have a problem. The command for 'select everything inside parantheses', namely vi)
, isn't working as expected, because I still have to press Shift
for )
, otherwise Vim will receive the command vi0
, which isn't what I want.
What I want is to press vi0
but have the 0
mapped to )
without shifting. Unfortunately, onoremap 0 )
didn't have any effect. How can I achieve this?
:loadkeymap
command and the'keymap'
option. That's a better fit for what you're trying to do. (I can turn this into an answer if it works for you.)keymap
only works for insert mode. Does it work in normal and visual modes?onoremap i0 i)
actually works, but fordi0
. Forvi0
, I neededvnoremap i0 i)
and it worked. Please post your comment as an answer so I can accept it.