greduan
greduan

Reputation: 4938

Vim: Have a paste operator (similar to c, d or y)

I'd like to have an operator-pending mapping for paste that works in a way similar to how d or c work.

Something so that I can do pi" which would mean "paste inside quotes".

Is there already a plugin for this or would I have to make one? If there isn't I'll make it, but I was curious in case I could save myself some work. :)

Of course I would make it using Kana's vim-operator-user if I do make it myself.

Thanks for your help. :)

Upvotes: 0

Views: 138

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172510

I need this so often, I wrote a plugin to simplify and allow maximum speed: ReplaceWithRegister.

This plugin offers a two-in-one gr command that replaces text covered by a {motion} / text object, entire line(s) or the current selection with the contents of a register; the old text is deleted into the black-hole register, i.e. it's gone. It transparently handles many corner cases and allows for a quick repeat via the standard . command. Should you not like it, its page has links to alternatives.

Upvotes: 3

Related Questions