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?
m` : set a mark in the current cursor position. o<Esc>p : create a new line below and paste the text in this line. O<Esc>P : create a new line above and paste the text in this line.
Yank the content of the first pair of parentheses:
yib
Visually select the content of the second pair of parentheses and put:
vibp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With