I'm yank-ing occurrences of MyText into a buffer B:
:g/MyText/yank B
But it always appends to the buffer instead of overwriting it. After a while the B register contains all the lines I've yanked previously. How can I overwrite it instead of appending it?
In vi, we had the "edit buffer", which is what Vim now calls buffer, and "buffers", which Vim now calls "registers". This is clearer that way.
Note that the register is
b, notB. You use the name of the register,bin this case, to yank into it:and you use the uppercase variant to append to it:
The Vim tutor doesn't really mention registers and both the reference manual and the user manual are pretty clear about all that so I'm not sure where and how you got it backward.
:help registers::help 10.1: