Browse thread
New Ocaml indentation for VIm
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | David Baelde <david.baelde@e...> |
| Subject: | Re: [Caml-list] New Ocaml indentation for VIm |
Olivier Grisel wrote:
> I have just tried it for a few seconds and I found the following
> identation a bit too wide:
>
> let f = function
> | [] -> foo
> | x::l -> bar
That was a known issue, I had a (not so visible) page on my website
about that. It was the "relative vs. incremental dilemn"... With a naive
implementation, I couldn't base the indentation of line 2 on the
beginning of line 1, so I based it on the keyword "function". Here is an
idea of what you get if you base the indentation on the beginning of the
line of the base keyword, without taking care:
let _ =
something first_arg second_one (if a then
foo bar
else
bar foo)
This week I was away from the network, but kept coding a bit... I tried
to figure out what tuareg does (cannot read that amount of elisp), and
did the same in OMLet. I will release it soon on vim.org. I also added
customization. The current implementation base the indentation on the
beginning of the line, or the last "(", "[" or "{" before the keyword,
on the same line, if there's one. As far as I've tried, it's a good trick.
The 4 spaces proposed by S. Luther a nice compromise between the strict
old indentation and the tricky and meaningless (but nice) new
indentation. But I think it would require more work for me, and for the
script, which is already so slow... And I don't think people want it so
much.
Regarding integration of omlet with the official ocaml support, as far
as I'm concerned I think it could be done within a few months, when
OMLet will be considered stable. But Markus Mottl didn't give me his
advice. There's only a very minor issue about code annotations, because
I don't like being warned that my VIm is not compiled with python
support everytime I open a OCaml file, and I'd like to find a good
solution without Python. Also, I didn't work at all on .mll and .mly
support.
Packaging omlet separately is OK. Samuel Mimram could do that. I would
just suggest to wait a bit.
Hope you'll like release 0.7!
--
David