I've been using paredit.vim for editing Clojure files. It's quite successful in managing all those parentheses in a sane way. I'm looking for a similar way for editing function calls in other programming languages. Specifically I'm looking for three capabilities :
- Changing order of function parameters by moving a parameter to left or right,
- Deleting a parameter,
- When one of the parameters is a function call (there is a nested list of parameters) ability to move one parameter up and down in nesting level. Or in other words, ability to move the parentheses of the inner function call left and right.
An example to the third item with paredit.vim command adapted to function arguments:
f(1, 2, g(3, 4), 5) ^ cursor
> turns this into
f(1, 2, g(3, 4, 5))
First two items I want can be provided by defining a function argument as a text object. vim-argumentative and a couple of other plugins I've came across provides these items by defining function parameters as text objects.
However the third item is a bit tricky. I could not find any plugin that provides this. And I could not figure out how defining function parameters as text objects might help achieving this at all.
Using paredit.vim is not an option, since paredit knows only about S-expressions of Lisp family, not comma separated function syntax.
Does anybody know how to achieve this, preferably with a plugin, or a way that can be put into a plugin?