vim Inserting text Insert text into multiple lines at once


Press Ctrl + v to enter into visual block mode.

Use / / j / k to select multiple lines.

Press Shift + i and start typing what you want.

After you press Esc, the text will be inserted into all the lines you selected.

Remember that Ctrl+c is not 100% equivalent to Esc and will not work in this situation!

There are slight variations of Shift + i that you can press while in visual block mode:

c or sDelete selected block and enter insert mode
CDelete selected lines (from cursor until end) and enter insert mode
RDelete selected lines and enter insert mode
AAppend to selected lines, with the column at the end of the first line

Also note that pressing . after a visual block operation will repeat that operation where the cursor is!