News for hackers. Stuff that matters.
Re:A Vim Guide for Advanced Users by aaimtts on Saturday February 27, 2021 @12:35PM (#26286437)
This is very useful, thank you! How would you go about pasting the "replace" part though?

I could only think of this rather awkward sequence:

1. Yank to named register

2. Search

3. "cgn"

4. Ctrl-R to paste from named register

5. Repeat

This is actually the biggest gripe I have with vim, even after almost 10 years of constant use. Vim always seems to overwrite the default register when I don't want it to. This makes replacing multiple bits of text with one pasted value awkward. I feel like I'm missing some essential shortcut or configuration that everybody else knows. It can't just be named registers, right?

Re:A Vim Guide for Advanced Users by tvrg on Saturday February 27, 2021 @12:44PM (#26286527)
You can slightly simplify your workflow using the yank register 0.

1. Yank using y without specifying a register

...

4. CTRL-R 0

Deletes and changes don't touch the 0-register. It always contains your last (unnamed) yank.