Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapping <kEnter> in Vim on Windows

Tags:

vim

I am finding that I cannot map the keypad-Enter key differently from the standard Enter key. I only observe this in Windows (XP and 7), both console and GUI versions of Vim 7.3.540, with no plugins.

To demonstrate this, I tried the following maps:

  • nnoremap <kEnter> :echo "kEnter"<CR> -- this is not triggered by Enter or keypad-Enter
  • nnoremap <Enter> :echo "Enter"<CR> -- this is triggered by both Enter and keypad-Enter

So, is it possible to map <Enter> and <kEnter> to do different things in Windows, or are my attempts futile?

like image 697
Prince Goulash Avatar asked May 02 '26 19:05

Prince Goulash


1 Answers

Looks like a bug to me. Seems to be working fine on Linux. On Windows, the keypad enter key doesn't have a separate virtual key code (MSDN), but the two keys can be differentiated using the scan code. Vim probably doesn't do this.

I'm looking at this Autohotkey script that I made (screenkey.ahk) and I can see that it can tell apart Enter from NumpadEnter.

So I can only speculate that this is Vim bug.

like image 156
mihai Avatar answered May 04 '26 12:05

mihai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!