Last Updated: February 25, 2016
·
633
· guyparton

Add character to beginning of line VIM

I use VIM as my primary text editor. When editing a file, there is sometimes a need to add text or characters to the begining of a line. Here are some examples -

Add char to beginning of line in file

:%s/^/a/g

Add char to beginning of specific line

:3 s/^/a/g

Add char to beginning of range of lines

:2,4 s/^/a/g