In Vim, how is it possible to replace the remaining of a line with the yanked text? If I press “D”, the yanked text will be replaced with the deleted text.
Also, how is it possible to yank to the end of the line? If I press “Y”, it will yank the whole line.
Press
vto enter visual mode on the starting character of the selection. Then hit$to go to the end of the line. After that, hityto yank the selection.So:
v$yInstead of yanking, use
pto paste. This will paste over the selection. So after you useDto delete some text, do:v$pThis will paste the deleted text over the selection.