3

In vim, the numerical Enter ⎆ key behaves differently from the carriage Return ⏎ key.

Is there any practical reason why the numerical Enter ⎆ behaves like that?

Can the numerical Enter ⎆ be made to behave like the carriage Return ⏎ key (including in combination with Shift ⇧ and if so, how?

5
  • 3
    I think inoremap <kEnter> <enter> should work. Check :help keycodes
    – Tommy A
    Jul 7, 2016 at 21:19
  • 1
    Maybe I'm the only one, but I'm really not sure what your question is. Do you have two enter keys on your keyboard? What is a "numerical Enter key?" From Tommy A's doc it seems that both <Enter> and <Return> evaluate to <CR>, so I'm not sure how they could be different. Can you please give us a bit more info?
    – Tumbler41
    Jul 8, 2016 at 5:35
  • Both keys behave exactly the same.
    – romainl
    Jul 8, 2016 at 6:18
  • For what it's worth, on a cygwin setup <c-v><enter> gives ^M while <c-v><num enter> gives ^[OM but I don't see any difference in their behavior... I needed you might want to create mappings using <c-v><key> to get the behavior you want. For example something like nnoremap ^[OM ^[
    – statox
    Jul 8, 2016 at 7:58
  • 1
    Yet another case of messed up termcap / terminfo entry. See the discussion here for suggestions. Jul 8, 2016 at 8:17

1 Answer 1

2

Since this issue was affecting only the normal mode, it was solved by adding the following lines at the very bottom of my .vimrc configuration file:

nmap <kEnter> <CR>
nmap <S-kEnter> <S-CR>

Apparently, some plugin had messed up the default behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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