Joshua Fricke
Joshua Fricke

Reputation: 391

VIM duplicates text I type

I have found that occasionally when I am hitting esc to enter back into normal mode with VIM after typing some text, the text I just typed will be duplicated 2 or more times.

I'd love to know what is causing this so I can avoid it.

Using VIM within iTerm2 on OSX 10.7.3 if that helps.

Upvotes: 2

Views: 445

Answers (2)

cHao
cHao

Reputation: 86534

If you type a number before you hit I, whatever you insert will be repeated that many times. For example, if you say 3IstuffEsc, you'll end up with stuffstuffstuff.

Upvotes: 6

Johannes Weiss
Johannes Weiss

Reputation: 54081

That usually happens if you hit a number key (0-9) by accident before you went to insert mode. Try 9iAbEsc. That will give you

AbAbAbAbAbAbAbAbAb

But it's all correct: It tells vim to insert Ab 9 times. It's as with every vim command, if you place a number N before the command, vim repeats the action N times.

Upvotes: 8

Related Questions