Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 13 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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