Ocaml Tools and Editors


I just got back into Ocaml(not a ‘real’ programmer but an enthusiast ) and I’m wondering what the community uses for editors and tools.

Myself, I use Vim with merlin/ocp-indent/ocp-browser and utop and opam and OcamlBrowser but I’m curious what others use and if there are any problems with the tools or any compatibility issues between tools.

Also… Does everyone else have problems deciding when and where to make types abstract and concrete in functors?


Emacs + Tuareg + Merlin (+ ocp-indent) have done very well for me.


Your setup sounds reasonable. I use vim for editing with merlin, ocp-indent (automatic indentation while typing), ocamlformat (formatting via neoformat). utop + ocp-browser for exploring APIs. dune to build. All via opam of course! The combination works very well for me. I haven’t run into any major compatibility issues between these tools.

The current default ocp-indent indentation and ocamlformat indentation don’t line up perfectly but both tools are configurable enough to work around those differences and ocamlformat has a lot of new formatting configuration options coming which should make the two line up even more when configured to do so.


I tried (I mean really tried) to use Emacs and just couldn’t grasp the fundamentals of that editor. I think its beyond my modest means.


There is ergomacs which changes hotkeys to be more standart… And Evil mode which sets hotkeys to be more like vim


Its too late… I’ve been adsorbed into the Vim collective.


I never understand this kind of claim, which I see made in both directions. I know both editors and there’s very little difference in learning curve. If you can learn emacs you can learn vi, and if you can learn vi you can learn emacs.


Yes, but once you’ve absorbed vi it’s difficult (for me at least) to absorb emacs (both keyboard memory and general philosophy). The main thing I miss from when I attempted my experiments using emacs is slime. There’s probably an equivalent in vi but I doubt it would be as seamlessly integrated.


I use neovim and I’ve uploaded my config to my dotfiles repo. Not sure if it’s helpful to others, I had a bit of trouble getting the autocomplete stuff to work using ncm2 but it works great now.


You can try deoplete-ocaml with Vim 8/NeoVim: its main benefit is that completion is asynchronous and does not block you from typing.
If you just want to try it out without configuring many things see my docker container: https://github.com/edwintorok/xs-opam-dev


I mostly write Reason these days and use Sublime with the LSP plugin and reason-language-server, both of which would work when writing OCaml. Works pretty well.


RLS supports the ocaml syntax now?