I've been searching hard, but not finding terribly useful results for
the following problem. The problem is this: most of my labmates use
emacs and specific java formatting rules (simple in emacs). I need to
duplicate said rules (and have succeeded for most), but I'm not sure
how to automatically indent argument lists and nested bracket
structures. Switch-case also screws up when brackets are involved.
e.g. say I write
------------------------------------------------------
double[][] gpsToMeters = {{1,2,3},
{1,2,3},
{1,2,3},
{1,2,3}};
------------------------------------------------------
or
------------------------------------------------------
functionCallWithManyArguments(abc,
def,
ghi);
------------------------------------------------------
(hopefully spaces indented sufficiently)
I want the inner brackets to be vertically aligned, as well as the
first character in the argument list. According to my labmate, the
relevant operator in emacs is 'arglist-cont-nonempty'. I have tried
searching with many queries suggesting the same idea, for vim, but I'm
coming up dry and could really use some advice. I could hand-indent,
if I remember, but that seems pretty unnecessary.
Below are images showing the formatting results. The order is {guide
1, vim 1, guide 2, vim 2}
http://i.imgur.com/cxmfq.png
http://i.imgur.com/nEiAK.png
http://i.imgur.com/rGiFw.png
http://i.imgur.com/uRJCc.png
I hope you can help! Thanks for your time.
-chardson
No comments:
Post a Comment