> Greetings all,
>
> 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.
For Java, C, C++, etc., the relevant option on Vim is 'cinoptions'
which controls the behavior of 'cindent'. 'cindent' is designed for C
code, but also used in Java, C++, and other similar languages. :help
'cinoptions-values' and :help 'cinoptions' will allow you to find what
you need.
No comments:
Post a Comment