Problem with num keypad in vi(m) ?

Thursday, December 31 2015 @ 12:16 PM UTC

Contributed by: Admin

You connect to your Linux box thru PuTTY or Mac's Terminal application and numeric keypad doesn't work as you expected, entering meta key instead of the expected values (0,1,… ,+,-, …) ? Here is the solution…

create or edit if it already exists a .vimrc file in the user account and insert the following lines:


imap <Esc>Oq 1
imap <Esc>Or 2
imap <Esc>Os 3
imap <Esc>Ot 4
imap <Esc>Ou 5
imap <Esc>Ov 6
imap <Esc>Ow 7
imap <Esc>Ox 8
imap <Esc>Oy 9
imap <Esc>Op 0
imap <Esc>On .
imap <Esc>OR *
imap <Esc>OQ /
imap <Esc>Ol +
imap <Esc>OS -
nmap <Esc>Oq 1
nmap <Esc>Or 2
nmap <Esc>Os 3
nmap <Esc>Ot 4
nmap <Esc>Ou 5
nmap <Esc>Ov 6
nmap <Esc>Ow 7
nmap <Esc>Ox 8
nmap <Esc>Oy 9
nmap <Esc>Op 0
nmap <Esc>On .
nmap <Esc>OR *
nmap <Esc>OQ /
nmap <Esc>Ol +
nmap <Esc>OS -
smap <Esc>Oq 1
smap <Esc>Or 2
smap <Esc>Os 3
smap <Esc>Ot 4
smap <Esc>Ou 5
smap <Esc>Ov 6
smap <Esc>Ow 7
smap <Esc>Ox 8
smap <Esc>Oy 9
smap <Esc>Op 0
smap <Esc>On .
smap <Esc>OR *
smap <Esc>OQ /
smap <Esc>Ol +
smap <Esc>OS -
cmap <Esc>Oq 1
cmap <Esc>Or 2
cmap <Esc>Os 3
cmap <Esc>Ot 4
cmap <Esc>Ou 5
cmap <Esc>Ov 6
cmap <Esc>Ow 7
cmap <Esc>Ox 8
cmap <Esc>Oy 9
cmap <Esc>Op 0
cmap <Esc>On .
cmap <Esc>OR *
cmap <Esc>OQ /
cmap <Esc>Ol +
cmap <Esc>OS -

0 comments



http://www.macosxguru.net/article.php?story=20151231121619781