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
Written by Guy Parton
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#