FooSoft/vim-argwrap

The way to wrap arguments with surrounding spaces

Closed this issue · 3 comments

Is there an option to do that:

Before:

var a = {
    b:2
};

After:

var a = { b: 2 };

Nor:

var a = {b:2}

I like the idea about being able to pad the insides of curly braces -- I imagine that this should be generalized as people might have the same expectations for array declarations, as in [ a, b ,c ]. I will add it in the near future.

As for adding the space after the "b" in "b:2", I'm not sure that has much to do with argument wrapping, it's more of a standards thing. For completeness you would have to support other operators, such as =, +, -, etc. and at that point you are doing much more than simply wrapping arguments : )

The extension doesn't change anything within the actual arguments themselves, so if you "b:2" will wrap/unwrap as "b:2" and "b: 2" will do so as "b: 2", if that makes any sense at all : )

@FooSoft thanks for the quick response. I understand your points. So it would be enough to pad the insides of curly (or other type) braces.

Thanks.

@FelikZ this feature has been added. Please sync to the new version and refer to the README for instructions on how to make use of it.