I am using Vim to edit Erlang code. I'm used to the fact that (most Erlang programmers do this) to make Erlang code indented by the area of ββthe brackets in which they are located. For example, C often has padding on the same tab width inside braces:
int main(void) { printf("hello, world\n"); return 0; }
In Erlang, this usually refers to indentation based on a parenthesis start column:
?assertError({bad_options, [{foo, bar}, bad_option]}, lhttpc:request("http://localhost/", get, [], <<>>, 1000, [bad_option, {foo, bar}])).
(The above example is indented to get a point, not subjective beauty).
Tab width will be used if the block is launched in a new line:
?assertError( {bad_options, [{foo, bar}, bad_option]}, lhttpc:request( "http://localhost/", get, [], <<>>, 1000, [bad_option, {foo, bar}] ) ).
Relevant parts of my .vimrc:
set expandtab " Spaces for tabs " set tabstop=4 " Tab width 4 " set shiftwidth=4 set smarttab set autoindent " Enable filetype plugin " filetype plugin on filetype indent on
Is there a way to indent this in Vim, and if so, how?