2

If I have this vimrc:

set nocompatible
nnoremap <C-m> ^^

When I try to open a file from the quickfix window by pressing enter nothing happens.

If I comment out the last line, so the vimrc is this:

set nocompatible
" nnoremap <C-m> ^^

Then the quickfix window works as expected.

Note that those two lines are the entire vimrc file. No plugins are being loaded either.

I've had the above mapping in my vimrc for over a decade and have always had strange issues with the quickfix window. I finally figured out what's causing it but I'm still stumped, what's going on here?

2

I figured this out, and decided to just remove the mapping.

It's happening because (at least in my environment, using vim in a terminal over SSH) there's no distinction between <C-m> and <CR>, they're one and the same to vim. If I remap <C-m> in normal mode, I'm also remapping <CR> in normal mode. I don't tend to press enter in normal mode so I didn't notice, except in the quickfix window.

I could modify the mapping to not apply in the quickfix window as suggested in the comments, but in this case I just removed the mapping, as it seems like an all around bad idea.

| improve this answer | |

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