When I use most commands, they take effect instantly. When I use the O command, however, I see the "O" replace the current character for a about a second, then the current character returns, and a new line is inserted and opened.

I have no such problem with the o command (open a new line below and insert).

If it makes a difference, I'm using vim from bash, in the Gnome Terminal on Ubuntu 10.04.


If the previous key pressed was ESC, this is because there are keys that can generate escape sequences beginning with ESC O. For example depending on the cursor key mode, the up arrow key may generate the escape sequence ESC O A.

If it sees a partial escape sequence, vim will wait for a short timeout to see if another character is received that matches one of the escape sequences defined for your terminal type. If not it will treat the characters as separate keystrokes. You can test this by entering a capital A while waiting for the line to open to see if it treats it as an up arrow instead.

There are some vim settings that can be used to control this. :set ttimeoutlen=100 will change the escape sequence timeout to 100ms. :set noesckeys will completely disable recognition of keys sending an escape sequence when in insert mode. Also, vi-compatible mode will not have this issue because esckeys is off in that mode – that is why vim -u NONE works.

  • Just to clarify, my "experiment" with the 140k line file was in full vim mode with my standard complement of of plug-ins and filetypes. I can see where you might have concluded that I'd used -u NONE but we still lack confirmation from the OP. – msw Jul 8 '10 at 7:49
  • wow! that was mildly irritating for a while but I've never thought about it. makes perfect sense now. Esc O A indeed works just like up-arrow. – Vitaly Kushner Aug 30 '10 at 3:17
  • 2
    :set noesckeys probably isn't what you want - set it and then press the arrow keys in insert mode, even if you don't plan on using them, you don't want them to do that! noesckeys also doesn't speed things up outside of insert mode. ttimeoutlen is definitely the way to go – JonnyRaa Oct 23 '17 at 10:08

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.