An editing pattern I frequently run into is the following: I want to yank a piece of text inside quotes or brackets, and replace that piece of text inside another pair of quotes/brackets.
For example, if I want to copy the the class name
foo bar and paste that somewhere else:
<span class="foo bar"> <div class="this-should-be-replaced-with-foo-and-bar">
What I know is this: If I move inside the span's class, I use
yi" to yank the text inside the quotes.
Now I have this in my register, so I should be able to replace the class content of the div with it. But I can't find a handy way of doing this.
If I use
ciw this ends up overwriting my register with content to change, so I loose my yanked text.
The best thing I can come up with is moving to the first quote of the div's class, hitting
p, then deleting to the next quote with
Usually I screw up my position though, and I paste it somewhere inside the quotes merging the two strings, and it is messing things up.
I'm hoping there's some way to do a "replace the inner text with my yanked content please" combination to make this easier.