Skip to content
Kakadu edited this page Oct 6, 2016 · 6 revisions

Atom for OCaml

Atom, made by the GitHub company, is a fast-growing and promising text editor with IDE features and increasing support for OCaml. One of its interesting features is that it can mimic vi, in a more convenient and modern GUI. It can also easily integrate the OCamlMakefile-based build process.

Installing Atom

Download and install Atom from atom.io first. You can choose one of the following two options to enable Merlin integration.

Facebook's nuclide package

Install the nuclide package to get ocamlmerlin integration. For the installation process, you can use the GUI (settings (Ctrl+,) -> install) or the local CLI package manager:

apm install nuclide

Currently Nuclide is going through a package reorganization phase, so its setting page is a bit messy. For your OCaml purpose, feel free to disable everything except Enable the "nuclide-ocaml" feature toward the bottom. You might also need to manually specify the ocamlmerlin path near the middle: nuclide-ocaml: Path to Merlin Executable.

Nuclide supports linting, autocompletion and hyperclick (alt-click on a variable to see its type). The downside is that you need to install a big package with lots of unneeded features if you want Merlin support only.

The ocaml-merlin package

The installation procedure is the same as for any other package.

apm install ocaml-merlin

This package supports linting, autocompletion, showing types, code navigation, destructing patterns (almost all Merlin's features).

Other useful packages

Ocaml related: language-ocaml ocaml-indent linter (required by nuclide and ocaml-merlin)
Other: minimap minimap-linter vim-mode ex-mode build build-make script

Configuration

Some configuration can be done on the package's settings page. For more advanced Merlin settings, such as seeing the other modules and provide their autocompletes inside your current module's file, use the conventional .merlin file at the root of your project.