I want to map Ctrl-M to Ctrl-N in insert mode. If I simply do imap <C-M> <C-N>
then Ctrl-M does start to behave just like Ctrl-N, but then hitting Enter does the same as well. I want pressing Return to keep inserting new lines, and at the same time make Ctrl-M insert the next keyword completion match just like Ctrl-N does. Is that possible?
EDIT: I managed to modify Vim's source code to unconditionally treat Ctrl-M as Ctrl-N without affecting Return. While doing so I also realized that indeed there is no way to do that without source code change, as the distinction between what has actually been pressed - Enter or Ctrl-M, appears to vanish much too early in key-press processing. It happens in platform-dependent UI modules, and the portable code part in key-press handling already has no idea if Ctrl-M or Return was actually pressed that resulted in key code 13.
My modifications were in GUI modules for FreeBSD (GTK) and Windows, as those are the platforms I use gvim on most often.
P.S. If anyone ever wants to achieve the same, please feel free to drop me a note.
P.P.S. To all who have provided answers to this question: thank you very much! Your comments helped me a lot.