I have the following text:
Lang1
Lang2
Lang3
Now I want to replace all the text in each line with a pattern like:
{ DisplayName: DispName(Lang1), Value: Lang1 },
{ DisplayName: DispName(Lang1), Value: Lang2 },
{ DisplayName: DispName(Lang1), Value: Lang3 },
Now, how can I achieve this by substituting the vim command, I can get: :%s/*$/\{\ DisplayName\:\ DispName\(Lang1\)\,\ Value\:\ Lang1\}\,/to replace each line Lang1, and then replace the individual 1s with 2, 3, 4, etc. But I do not want for this. I want one alternative team to select a pattern and repeat it. How to achieve this?
source
share