In VIM, if, for example, I have the text
http://a.com
http://b.com
is it possible to find all lines (the whole line) and replace it with something before and after it, such as:
<a href="http://a.com">http://a.com</a>
<a href="http://b.com">http://b.com</a>
Note that the text from every line is repeated. Once for the href and another for the text.
:%s:.*:<a href="&">&</a>:
Same as in ed/sed/perl...
Another less ex
and more vim
-like way would be: if you know how to do it once for a line, record it as a macro and then run :%normal @m
where m
is that macro.
Like (in normal mode): qmS<a href="<Ctrl-R>""><Ctrl-R>"</a><Esc>q
to record the macro.