I would like to write a char as many times as the length of the previous line
Starting point:
This is a line and I want to write a char under it.
I want to write char =
as many times as the length of this line. This is the result I would like to obtain:
This is a line and I want to write a char under it.
===================================================
How I can achieve this result with the most reduced key/commands combination?
I suspect there is something shorter but the following works with the cursor starting over the initial line:
Yp:s/./=/g
It duplicates the line (Yp
), then replaces each character on the new line with an =
(:s/./=/g
)
An even shorter version from Doktor OSwaldo
YpVr=
Duplicates the line, selects it and replaces all characters with =
And, if you are using this a lot, it'll be even shorter as a macro.
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