I have the mapping shown below, in my ~/.vimrc. However, this mapping also hijacks the Enter key. So, whenever I hit Enter it executes the tabedit % command. I am using gvim 7.3

nnoremap <C-m> :tabedit %<CR>

Can anyone fix this so that it doesn't hijack the Enter key.

1 Answer 1


< C-m> maps to the enter key (C-M and CR both do); it's not hijacking it, you're telling it to run :tabedit % every time you hit enter. I would suggest a different mapping.

See :h key-notation for more information.

  • How come? the vim documentation says that <C-...> is the control-key so <C-m> should map to Ctrl+M shouldn't it? I tried changing the mapping to use <C-x> and it doesn't seem to have that issue anymore. But I am still confused. Jun 21, 2012 at 12:30
  • Control+M also acts as an enter key, but it's not the only redundancy. Control+[ corresponds with ESC. Control+I, tab. See :h key-notation. Jun 21, 2012 at 12:45
  • Thanks, it all makes sense now. I ended up mapping <C-n> for this. Jun 21, 2012 at 13:39

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.