Super User is a question and answer site for computer enthusiasts and power users. 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

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.

share|improve this question
up vote 19 down vote accepted

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.

share|improve this answer
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .