How do I get the numpad to work in vim using iterm2 on osx with term=xterm?
Solution 1
Looks like the answer is to go into Preferences->Profiles->Keys and load preset of: "xterm with Numeric Keypad".
Solution 2
For me the solution was disabling VT100 Application Keypad-Mode
in Preferences > Profiles > Advanced
.
Solution 3
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.
Solution 4
but it removes some colors in my vim.
if you just need it some times, just type:
:set term=ansi
in VIM
Best regards
Related videos on Youtube
J0hnG4lt
Updated on September 18, 2022Comments
-
J0hnG4lt over 1 year
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: http://code.google.com/p/iterm2/issues/detail?id=702
-
gitaarik almost 9 yearsI didn't have this preset, so in my answer I explained how you can add these shortcuts yourself.
-
scarver2 over 8 yearsIt appears that the preset no longer exists in iTerm 2.1.1
-
scarver2 over 8 yearsFor the
Enter
key, choose theSend Hex Codes
action and enter0x0D
. -
J0hnG4lt over 8 yearsRecently did a new OS install. The preset is still there in iTerm 2.1.1.
-
crazyGuy over 8 yearsThis solution works only on the native terminal, but not with iTerm
-
ecmanaut about 8 yearsWorks in iTerm 2.1.4 too, though I also had to add a new shortcut to insert hex key code 0xd for NumPad's Enter key to work. (Weirdly not detected as the Num-⏎ key already registered, but as ⏎ on its own, when set up.)
-
KLaw about 8 yearsWorks for me. I'm using iTerm2 Build 2.1.4.
-
J0hnG4lt about 5 yearsLatest beta, preset's gone (again?).