vim insert text at the the beginning of multiple lines code example
Example 1: vim insert text at the the beginning of multiple lines
:%s!^!text_to_insert!
1. Press ESC to ensure youre in command mode
2. Use CTRL+v to enter visual block mode
3. Move Up / Down to select the rows you want to prepend text to
4. Press SHIFT+i and type the text you want to insert (it will only
show up on the current row for now)
5. Press ESC, wait ~1 second and the inserted text will appear on
every line
Example 2: vim insert text before every line
:'<,'>s!^!//!