If your line starts without any trailing spaces:
Hello World
Normal mode:
Y p V r =
gives:
Hello World
Explanation
Y β Yankees whole line e.g. Y Y
p β insert row
V β select the whole line in the visual line mode r β replace the whole selection with the following character
= β character to replace the rest
If the string has leading spaces, for example:
Hello World
Using:
Y p V $ r =
Donation:
Hello World
We use the visual selection of V $ at the end of the line, instead of using V to select everything on the line.
If you have a trailing space, you can use the g _ movement to jump to the last character without spaces.
source share