Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Vim6 and O'Caml.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-10-06 (10:53)
From: Markus Mottl <markus@m...>
Subject: Re: [Caml-list] Vim6 and O'Caml.
On Sat, 06 Oct 2001, Jeremy Fincher wrote:
> I've tried the new vim6 indent files, but it doesn't seem to apply
> the same rules that emacs applies, which I'm both accustomed to, and
> which almost all the source code I've seen is writte in.

It actually isn't capable of correctly indenting OCaml-code. The reason
is simple: you'd need a complete parser and pretty-printer to do so. This
is an awful lot of work and slows down some operations considerably.

Currently, the indent file for OCaml does an approximate job: it
only considers the current and the last line to compute a suitable
shiftwidth. This works remarkably well in the majority of cases.

> Surely all the source code I've seen written hasn't been written
> in emacs, so I assume there's some way to make vim indent code like
> emacs does.  Does anyone know how to do so?

You can also program Vim (though not in Lisp). Considering the richness
of builtin functions in Emacs and the still large amount of Lisp-code
required to implement automatic indentation (~ 1500 LOCS), I wouldn't
dare to do the same for Vim. Anybody want to give it a go? ;)

Markus Mottl

Markus Mottl                                   
Austrian Research Institute
for Artificial Intelligence        
Bug reports:  FAQ:
To unsubscribe, mail  Archives: