Repeating characters in VIM insert mode

Escnic Esc Esc.

E.g. Esc4iJEsc Esc will output JJJJ.


If you are OK with leaving INSERT mode only once (at the end), this sequence works:

Ctrl+o 80i- Esc

  • Ctrl+o is used to issue normal commands without leaving INSERT mode,
  • 80 the repetition,
  • i to insert,
  • - the character you want to insert,
  • Esc to leave INSERT mode.

Another one without EVER leaving INSERT mode:

Ctrl+o :norm 8ia Return


<ESC> 
<the number of times you want to repeat>
i 
<the char you want to repeat> 
<ESC>

for example: <ESC>12ia<ESC> will insert 12 a's.

Through single repeat:

  1. Press: i # to enter into Insert mode
  2. Press: -
  3. Press: Esc
  4. Press: 80.

It will output: 80 -, like this:

---------------------------------------------------------------------------------

More details about single repeat: :help .

Tags:

Vim