Here's the situation:

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 <, C, R, > are typed, spelling <CR>

a can be any sequence of characters...
<CR> can be any special character denoted with < >...
...yet this behavior persists.

What's going on guys?

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 <, C, R, > after the {.

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

Surly I'm not the only one.

There may be many possible contributing factors to this problem, but it seems like a fundamental problem that others are likely to run into.
I hope this post helps out others, by the likes of them scrolling through various answers that didn't work for me, but work for them.

I could not find any answers on the internet, nor did the "Similar Questions" tool provided by the website as I completed this post.
However, if you find a duplicate, please point me in the right direction! Perhaps I just lack the proper search keywords to find a solution.

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 – Christian Brabandt Jul 17 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. – Christian Brabandt Jul 17 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 Jul 17 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 Jul 19 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 Jul 19 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.