I am editing restructuredtext files. I often need to put some charactors like \"=-`~\" in one line, and I want the length of the line match the previous line. How should I
If your line starts without any trailing whitespace:
Hello World
Normal Mode:
YpVr=
Gives:
Hello World
===========
Explanation
Y -> Yank entire line, like yy
p -> paste the line
V -> select whole line in visual line mode
r -> replace all of select with next character
= -> the character to replace the others
If you line has leading whitespace, eg:
Hello World
Use:
Ypv$r=
Giving:
Hello World
===========
We use v$ visual selection to the end of the line, rather than using V to select everything on the line.
If you had trailing whitespace you can use the g_ movement to get to the last non whitespace character.