1

I'm looking for a way to replace the text

print("This is a test")

by

print("**************")

i.e. i want to overwrite every character of a text object (the string inside quotes) or up to a movement command by the same replacement character (asterisk in this case).

What would be the quickest/easiest way to do that?

3

You can do it with visual selection and than the r command. Like:

vi"r*

-> Visual select the part within the quotes and replace all chars with a *.

For movements I don't know a direct way, but you can do it also via selection:

v3wr*

-> Visual select three words and replace all selected chars with *.

| improve this answer | |
  • Thanks so much! I didn't know that r in visual mode will replace everything selected, cool. – fschoenm May 5 at 12:02
  • 1
    @fschoenm makes it really easy to create borders: yypVr-, for example – D. Ben Knoble May 5 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.