1

Currently, the numpad does the usual things(input numbers and so on). numlock does nothing.

I wonder if you can differentiate numbers/char entered on the numpad from those typed on the main section of the keyboard.

I am on MacOS if relevant(VimR).

  • See :h terminal-key-codes – Matt Aug 6 at 5:54
3

There are special keys <k0> to <k9> and <kPlus>, <kMinus>, <kDivide>, <kMultiply>, <kEnter>, and <kPoint>, which can be mapped separately, e.g.,

inoremap <k0> Zero
inoremap <k1> One
...

I checked this with GVim running on Windows 7; the behavior on macOS might be different.

  • Didn't work for me neither in Vimr nor in neovim on terminal(iTerm). – eyal karni Aug 7 at 18:58
  • 1
    @eyalkarni Can you check if in insert mode <ctrl-k> followed by one of the keypad numbers shows you a special key notation? If yes, you can use this notation on the left side of your mapping. Strangely, on my computer this didn't work (only a normal digit with SpecialKey-highlighting was temporarily shown), but with the 'showcmd' option set ^k5 (for example) was shown in the last line of the screen. This means the key is recognized as a special key, but I don't know how to determine the notation for the left side of the mapping from this information. – Jürgen Krämer Aug 8 at 6:41
  • I don't get any modifier in <c-k>. Supposedly, because my keyboard isn't really supported in macos. – eyal karni Aug 10 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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