Using numpad in Vi (Vim) via PuTTY

VimPutty

Vim Problem Overview


The numberpad does not work properly when using Vim through PuTTY. Instead of numbers I get

y
x
w
v
u
t
s
r
q

Vim Solutions


Solution 1 - Vim

The answer is in Numpad in PuTTY while using vi [Cialug]:

> In the configuration, go to Terminal->Features and check "Disable > application keypad mode". Save the settings and enjoy a numeric pad > that works!

Solution 2 - Vim

I have always used this set of mappings to interpret the escape sequences as numbers when $TERM=xterm

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 -

I think this was my original source.

Solution 3 - Vim

And for Mac, the answer is in a comment by HaPsantran on this same page and there is a similar answer by nfechner with German screenshots in this answer.

For Mac, go to your Terminal application. Select Preferences, Profiles, Advanced and deselect Allow VT100 application keypad mode.

enter image description here

Solution 4 - Vim

If using SSH through a terminal you can just go to

Edit -> Num Lock (third from bottom)

It needs to have a checkmark to the left of it.

Solution 5 - Vim

The previous answers by kirby, michael-berkowski, and pykler are great.

I had this issue in Vim on macOS's terminal. Checking TerminalPreferencesProfilesKeyboard showed that "Clear (Keypad)" was mapped to "Num Lock". Pressing clear fixed the issue for me.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPyklerView Question on Stackoverflow
Solution 1 - VimPyklerView Answer on Stackoverflow
Solution 2 - VimMichael BerkowskiView Answer on Stackoverflow
Solution 3 - VimKirbyView Answer on Stackoverflow
Solution 4 - VimkavakavaView Answer on Stackoverflow
Solution 5 - VimDaveView Answer on Stackoverflow