• Entire .vimrc:
inoremap a <CR>
  • Action: user types ia to enter insert mode and type a
  • Expected result: a carriage return is entered into the document
  • Actual result: the characters <CR> are typed

I've discovered that a can be any sequence of characters, and <CR> can be any special character denoted with <>, and this behavior still persists.

I swear it wasn't doing this a few days ago.


Specifically, I'm trying to include in my .vimrc:

inoremap {<CR> {<CR>}<Esc>ko

but it did not work.

To debug, I tried

inoremap { {<CR>}<Esc>ko

so Vim did not have to listen for any enter keys.

When Vim typed out {<CR>}<Esc>ko in my document, I became aware of the nature of the issue. I believe Vim never activated the initial map because it did not receive the set of characters <CR> after the {.

Netrw also stopped receiving the enter key and Vim just goes to the next line when I intend to select a directory.

About my setup

I'm operating a relatively fresh install of Arch Linux, running off of a bootable USB flash drive. The USB flash drive is plugged into a standard Dell latitude E5510 laptop with Windows 7 on the hard drive, though it is not being used. However, when I use the Windows 7 on the hard drive and use Vim, this problem does not occur. The problem occurs both in the system's console, and in XTerm in i3wm, whether the "VT220 Keyboard" setting is turned on or off, whether "Old Function Keys" is on or off.

NeoFetch output

  • 2
    check your 'cpo' settings, escpecially look for :h cpo-< and :h cpo-k Commented Jul 17, 2019 at 6:21
  • 4
    Those flags do not need to be there (and there are not, if you start from vim --clean). So make sure to remove those flags and then you need to rerun your mapping commands, because those settings apply when the mapping is defined. Commented Jul 17, 2019 at 8:18
  • 1
    @ChristianBrabandt Well, that was easy. Added "set nocp" to .vimrc. THANKYOU!!! I'm relatively new to the website, so should you make an official "answer," or should I?
    – ei2
    Commented Jul 17, 2019 at 19:20
  • 2
    Welcome to Vi&Vim SE. +1 for posting a (first?) question with plenty of details and for having spent time looking for a solution on your own. If I had a suggestion for future questions it would be to "trim the fat" a bit. What I mean by that is to be a little less conversational and a little more succinct without losing any of the important details. I actually don't mind your style but you want to keep as many eyeballs on your question as you can. Cheers.
    – B Layer
    Commented Jul 19, 2019 at 18:59
  • 2
    Okay, so I should have clicked on your profile first....you've been hear for a little while and this is your second question. Lol. The rep points threw me. Everything else I wrote stands, though! :)
    – B Layer
    Commented Jul 19, 2019 at 19:09

1 Answer 1


As mentioned in the comments, you need to make sure cpoptions does not contain the k and < flags before defining your mappings (this explains why netrw broke too).

The likely culprit is that vim was running in compatible mode (this should not be the case if you have a .vimrc file, but it's possible to do some funky things with the invocation to end up in compatible mode). I do not recommend putting set nocompatible in your .vimrc though.

Instead, I would investigate why compatible was set, or at least why cpoptions had those flags.

A simple trick to discover if they were set from a file is :verbose set compatible? cpoptions?.

Your Answer

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

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