vim-erlang / vim-erlang-runtime

Erlang indentation and syntax for Vim
https://vim-erlang.github.io
101 stars 29 forks source link

Indent closing brackets/parens after commas more sensibly #22

Open hcs42 opened 10 years ago

hcs42 commented 10 years ago

Consider having a list:

[some_long_name,
 some_other_long_name]

The easiest way to add a third element is by moving over the ] character, pressing i, typing a comma and then enter. After the auto-indentation, the code will look like this:

[some_long_name,
 some_other_long_name,
]

It would be more convenient to have this:

[some_long_name,
 some_other_long_name,
 ]

We cannot just say that from now on we align the ] with the beginning of the previous line, because that would mean having incorrect indentations like this one:

[some_long_name,
 some_other_long_name
 ]

The proposal is that when indenting ], we should examine the previous token, and if it is a comma, we could indent the ] line as if it started with e.g. an atom.