This is my text:
xxx
yyy
zzz
I would like it to be this text instead:
xxx = C.xxx
yyy = C.yyy
zzz = C.zzz
Is this possible to do in Vim?
You can also use the simpler form:
:%s/.*/& = C.&
Type this:
:%s/\(.*\)/\1 = c.\1/g
Breakdown:
%
- work on all lines\(.*\)
- capture all the characters in a group ("group 1")s/PATTERN/REPLACEMENT/g
- do a string substitution\1
in the replace pattern - refer to the matched groupSelect the text, then press :
and type
s/\(.*\)/\1 = C.\1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With