OMLet
Distributed by vim.org, announced on Freshmeat.
Fans of both Caml and Vim will be happy to hear that Emacs is no more the only editor with a decent indentation for their favorite language. Try OMLet, and please feedback! Here is an example of what it does, and here is a more realistic one.
OMLet is already packaged in Debian's ocaml-tools,
in the unstable version. And it will be distributed soon directly
with VIm as the default OCaml mode.
Contents
News
- 0.13 Modeline support!
Important
Please make sure that the following line is in your
~/.vimrc, otherwise
indentation won't be loaded automatically:
filetype plugin indent on
Customization
OMLet indentation can be customized by setting a few variables.
This setting is usually done by adding a line like
let variable = value in your .vimrc.
For the general variables, only the existence of a binding
is taken into account, not the value:
ocaml_foldingturns on the folding;no_plugin_maporno_ocaml_mapsavoids the plugin to define key bindings.
For indentation, the value matters:
omlet_indentis the default indentationomlet_indent_structis the indentation of a value/type/method in its struct/classomlet_indent_letafter alet..in. Alet..inis not indented if it is after another one.omlet_indent_matchafter amatch..with.omlet_indent_functionafter afunction- If you need more, just ask...
I also recently added omlet_middle_comment, a boolean
(0/1) for choosing whether or not you want * at every new
line in your comments. Auto indentation still has problems with this,
but reindenting works.
Here is a commented example:
Working with other people
If you work with somebody else using OMLet, it is a good idea to add an OCaml modeline to your files. Then, OMLet's customization will be the same for everybody. Also, it would be very nice if somebody write an OCaml modeline parser for Emacs/Tuareg. Here is the OCaml modeline syntax:
For example:
The available parameters are default,
let, match,
fun, struct, and you guess their meaning.
Omlet indents with spaces,
so if you want a full compatibility with emacs's
tuareg-mode,
it is recommended to use space-only indentation with emacs:
(setq-default indent-tabs-mode nil)
Misc tips
Key mappings are prefixed by <LocalLeader>,
which defaults to '\'.
If you find something like '.' or ',' more accessible,
customize your .vimrc:
let maplocalleader="."
If you've been using emacs for a while, you might be a
tab
addict.
Adding the following line to your .vimrc will make
tab
run indentation
when hit in insert mode
(C-f is the default for that in VIm):
autocmd FileType omlet set indentkeys+=,!^I
I also recommend using otags in order to have tags working on OCaml projects.
Why expand tabs ?
Soon...
