Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My numpad works in iterm2 (bash), but it inserts characters instead of numbers in insert mode for vim.

How can I get vim to recognise the correct escape codes.

I have tried editing the escape codes as suggested here without any luck:

share|improve this question

4 Answers 4

up vote 44 down vote accepted

Looks like the answer is to go into Preferences->Profiles->Keys and load preset of: xterm with numeric keypad.

share|improve this answer
I didn't have this preset, so in my answer I explained how you can add these shortcuts yourself. – rednaw Jul 13 at 9:05
It appears that the preset no longer exists in iTerm 2.1.1 – scarver2 Aug 14 at 17:28
Recently did a new OS install. The preset is still there in iTerm 2.1.1. – J0hnG4lt Oct 2 at 16:10

For me the solution was disabling VT100 Application Keypad-Mode in Preferences > Profiles > Advanced.

share|improve this answer

You can add global keyboard shortcuts in Preferences -> Keys and map the numpad characters to "Send Text" actions to send the text they are supposed to send.

iTerm2 keys preferences

share|improve this answer
For the Enter key, choose the Send Hex Codes action and enter 0x0D. – scarver2 Aug 14 at 17:34

but it removes some colors in my vim.

if you just need it some times, just type:

:set term=ansi

in VIM

Best regards

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.