how can i search and replace a function call, but without the arguments of the function?
For short, i will search and replace from foobar(arg1, arg2) to foobar: arg1, arg2;
My goal is to keep the arg1, arg2.
How can i solve this? Is there a best practice?
Use following command:
:%s/\v(\w+)\(([^()]*)\)/\1: \2;/g
NOTE This does not work if there nested function call.
See a demo.
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