Created
September 22, 2010 20:32
-
-
Save oriolgual/592515 to your computer and use it in GitHub Desktop.
Map your number to their correspondeing Shift+Number. Feel free to add more layouts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Add it to your local vimrc | |
" Toggle it with Shift+n | |
let g:numberlock = 0 | |
" Tried with inoremap 1 <S-1> but it wasn't working, so we'll have to set different layouts | |
" Anyone knows how to fix it? | |
let g:numberlock_layout = 'us' | |
nnoremap <silent><F4> :call NumberLock()<CR> | |
function! NumberLock() | |
if g:numberlock | |
let g:numberlock = 0 | |
iunmap 1 | |
iunmap 2 | |
iunmap 3 | |
iunmap 4 | |
iunmap 5 | |
iunmap 6 | |
iunmap 7 | |
iunmap 8 | |
iunmap 9 | |
iunmap 0 | |
elseif g:numberlock_layout == 'us' | |
let g:numberlock = 1 | |
inoremap 1 ! | |
inoremap 2 @ | |
inoremap 3 # | |
inoremap 4 $ | |
inoremap 5 % | |
inoremap 6 ^ | |
inoremap 7 & | |
inoremap 8 * | |
inoremap 9 ( | |
inoremap 0 ) | |
elseif g:numberlock_layout == 'uk' | |
let g:numberlock = 1 | |
inoremap 1 ! | |
inoremap 2 " | |
inoremap 4 $ | |
inoremap 5 % | |
inoremap 6 ^ | |
inoremap 7 & | |
inoremap 8 * | |
inoremap 9 ) | |
inoremap 0 ) | |
elseif g:numberlock_layout =~ 'es\|pt' | |
let g:numberlock = 1 | |
inoremap 0 = | |
inoremap 1 ! | |
inoremap 2 " | |
inoremap 3 # | |
inoremap 4 $ | |
inoremap 5 % | |
inoremap 6 & | |
inoremap 7 / | |
inoremap 8 ( | |
inoremap 9 ) | |
endif | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment