I use ocamldoc-style comment, but vim is annoying me because it indents the comment when it should not.
For instance, with the following code:
(**
* {[
If I open a new line when being of the second line of the above code, vim will indent the code so it will look like:
(**
* {[
*
So I need to remove 4 spaces everytime.
I tried using ocp-indent
, but the result is the same.
What can I do to not have the four additional spaces when I open a new line in a ocamldoc comment?
Thanks.
I found that I can get the desired behavior by editing the ocaml indent file.
I updated the line 208:
if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|parser\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$'
to:
if lline =~ '\(:\|=\|->\|<-\|(\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|parser\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$'
(I removed the \[
pattern from this regular expression.)
This change has the effect of not indenting after a [
outside of the comment as well, but I don't mind this side effect.
I'll let this question opened a few days to see if there is a better solution.