Suppose I got this function call:
cook("rice", kitchen->pot);
After writing that, I notice parameter order is wrong, I should have done
cook(kitchen->pot, "rice");
To fix that, I could do:
1: move cursor over "rice": $b 2: delete a ": da" 3: move to (: % 4: paste "rice": p 5: insert new ,: a, 6: find and delete spare ,: f,x
But im using VIM! We edit code faster with vim, any ideas?
Your answers are really helpful, but I just found a solution by myself:
:s/\v(\w+\()([^,]+)(,\s*)([^\),]+)/\1\4\3\2
That will work with most kinds of parameters, and specially for my php-like function calls.