sponsor Vim development Vim logo Vim Book Ad

advanced Tip #503: PuTTY numeric keypad mappings

 tip karma   Rating 37/12, Viewed by 1439 

created:   July 3, 2003 6:03      complexity:   advanced
author:   Michael Metzger      as of Vim:   5.7

Purpose: Add support for {rhs} of keyboard numeric keypad while in vim insert mode and using PuTTY as a SSH terminal connection.

What to do: Add these mappings to your _vimrc or _gvimrc.  PuTTY's default terminal type is xterm.  Check your settings or just echo $TERM at the command prompt on most unix systems to verify xterm type.  

Code to add to _vimrc:
:imap ^[Oq 1
:imap ^[Or 2
:imap ^[Os 3
:imap ^[Ot 4
:imap ^[Ou 5
:imap ^[Ov 6
:imap ^[Ow 7
:imap ^[Ox 8
:imap ^[Oy 9
:imap ^[Op 0
:imap ^[On .
:imap ^[OQ /
:imap ^[OR *
:imap ^[Ol +
:imap ^[OS -

Any questions about vim and PuTTY please send to [email protected].

Michael Metzger

 rate this tip  Life Changing Helpful Unfulfilling 

<<View character class | syntax check >>

Additional Notes

[email protected], July 3, 2003 7:55
You might also want to include the mappings for the normal mode as well.  For example, going to a specific line
#+shift G will not work unless you put these additional mappings in _vimrc.

:map ^[Oq 1
:map ^[Or 2
:map ^[Os 3
:map ^[Ot 4
:map ^[Ou 5
:map ^[Ov 6
:map ^[Ow 7
:map ^[Ox 8
:map ^[Oy 9
:map ^[Op 0
[email protected], July 8, 2003 7:14
Sadly, this does not work for me (vim v6.1.265, TERM=xterm). Using these mappings, vim resorts to the regular behaviour of inserting a new character on the previous line.
[email protected], July 12, 2003 7:39
Additionally, those of you that are having issues with the keypad can remap it using the following command sequence in your vimrc file:

:imap ^[0A <Up>
:imap ^[0A <Down>
:imap ^[0A <Left>
:imap ^[0A <Right>

These settings also seemed to correct the quirk of the mode text (or whatever it is properly called: --INSERT--) not showing up at the bottom of the screen when in insert mode.
Anonymous, July 30, 2003 8:18
Maybe a simpler way to do this in PuTTY's settings: Set "Disable application keypad mode" under Terminal-->Features.
[email protected], September 24, 2003 4:51
I'm using :
: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>OQ /
:imap <Esc>OR *
:imap <Esc>Ol +
:imap <Esc>OS -
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge Logo