Something that I find myself doing often is yanking the text between two parenthesis and pasting that over another pair of parenthesis. For example:
foo(int a, int b, int c)
bar(int d, int e)
becomes
foo(int a, int b, int c)
bar(int a, int b, int c)
Is there a quick way in Vim to yank the text from foo and paste it over the text in bar?
One way would be yi)
inside foo's arguments and "_di)P
within bar's arguments.
yi)
yanks the text inside the parentheses
"_di)P
uses the null register to delete the text inside the parentheses and pastes the text, vi)p
also works and avoids the null register
The only thing changing is the function name though, so you could also just yank the line and use cw
(change word) to change foo to bar.