I know this is not new information at all, but every time I have to insert some text at some specific index for a group of consecutive strings I have to google something like “column insert VIM” (surprisingly, the title of this post) and search through the first 5 results for the correct solution. Well, the one I happen to understand, anyway…
So, here’s how it’s done:
- move the cursor to the uppermost character (if you’re selecting lines the way down, bottom if you’re going up) before which you want to insert text
- enter Visual Block Mode by pressing
Ctrl+v
(unless you mapped the paste action to it, in which case you probably already know how to column insert) - select the column using the arrow keys
- press
Shift+i
(switching into Insert Mode) - type the text you want to insert (will be displayed only on the first line)
- press
esc
two times - ?????
- Profit!
In case you want to delete text, follow steps 1 through 3 and simply select all text you wish to delete, then press x
and you’re done!