Skip to content

Instantly share code, notes, and snippets.

@fgolemo
Created January 29, 2018 08:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgolemo/24c5d7bdb8482c44f9740ed6a4fc9215 to your computer and use it in GitHub Desktop.
Save fgolemo/24c5d7bdb8482c44f9740ed6a4fc9215 to your computer and use it in GitHub Desktop.
How to enable OCaml support in Atom text editor

How to install OCaml support for Atom editor on Debian/Ubuntu systems

Install Atom (obviously).

Assuming you are on a Debian/Ubuntu system install these system packages:

sudo apt-get install ocaml-core opam ocp-indent

Then install merlin and initialize it: (no sudo here)

opam install merlin
opam user-setup install

And finally within Atom either use the graphical package installer on the settings page and install the following packages:

  • ocaml-merlin
  • ocaml-indent
  • language-ocaml
  • repl

...or if you prefer to do this with one line on the shell, try:

apm install ocaml-merlin ocaml-indent language-ocaml repl

Syntax highlighting and linting should work out of the box. In order to run OCaml code right within Atom,

  • open an OCaml file
  • press CTRL+y CTRL+o to open an OCaml interpreter (like a live OCaml session)
  • select the pieces of code you want to run with your mouse
  • press CTRL+y CTRL+s to copy the selected pieces of code into the OCaml interpreter and run them.
  • if you want to run the entire file you can press CTRL+y CTRL+f (only after opening the interpreter)
@HydrolienF
Copy link

language-ocaml is broke. Is there any fix ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment