Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 down vote accepted

< 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.

share|improve this answer
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. – Khaja Minhajuddin Jun 21 '12 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. – Splinter of Chaos Jun 21 '12 at 12:45
Thanks, it all makes sense now. I ended up mapping <C-n> for this. – Khaja Minhajuddin Jun 21 '12 at 13:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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