I actually use Atom (with some community packages, especially for merlin). Opening multiple windows seems hurt memory, but otherwise it’s fine (on my 8G RAM machine). I experienced large memory usage (gigabytes) by merlin. Does anyone have similar experience?
My own OCaml setup in Emacs was taken pretty cleanly from the setup described in “Real World OCaml” plus various install messages when using opam to install the packages. Nothing much special.
For those who want an emacs setup, I highly recommend using opam-user-setup
. It will setup everything you need in emacs using the available tools very easily, including graceful handling of switches, merlin, and the various other utilities.
Just to add another +1 for emacs, tuareg, merlin.
Adding to this, it also works wonderfully for vim/neovim
Since it hasn’t been mentioned so far, let me also add annot to this list of tools.
Annot is a small and fast tool that just lookup types in ocaml compiler produced .annot files. It’s very easy to integrate with vi and emacs and is very lightweight.
The value of autocompletion, colorization, autoformatting may be debatable, but when programming with a language like OCaml that can infer quite complex types from far away, being able to see the actual type of any expression is very helpful when trying to figure out an error message. Annot does only this and does it well.
If you have Vim8 or Neovim it is worth trying out deoplete-ocaml: it is an asynchronous completion plugin (does not block typing) using merlin that can also show the ocamldoc during completion.
My full setup can be seen in my dotfiles, but to summarize:
When in Emacs I use Spacemacs with the ocaml layer.
When in Neovim:
- ALE for seeing warnings/errors from merlin
- Denite for fuzzy filename search (“Ctrl-P” like), git grep output viewing
- deoplete+deoplete-ocaml for completion and ocamldoc viewing
- neoformat with ocp-indent (and experimenting with ocamlformat)
- lightline+vim-fugitive for status line, LargeFile for log files, gruvbox for colorscheme
- some custom keymappings and conditionals in .vimrc to disable features that are not available (e.g. don’t load merlin if there is no python3, use 24-bit RGB colours when available, use ripgrep only if available etc.)
In my terminal I also use:
- tig for exploring git history
- tmux for managing remote sessions, it also support passing through 24-bit RGB colours, so a terminal Vim looks almost exactly the same as the GUI Vim
- Z shell
- ripgrep for searching
- git with diff-highlight, histogram diff algorithm, diff3 conflict style
- ssh with ControlMaster multiplexing
- Source Code Pro font (OTF), with xfce4-terminal or mate-terminal emulator
I was somewhat undecided between Vim8 and Neovim (all of the above plugins work with a recent Vim 8 too, if you install some compatibility plugins): what finally made me switch to Neovim was that it is available in CentOS 7 (via EPEL), which means I can use my usual setup for remote work too.
Visual Studio Code is good too, but its Vim emulation is somewhat slow.
Try the deprecated vscode-ocaml, IIRC it integrated better with ocp-indent, the new plugin (vscode-reasonml) could only indent whole files.
Yup, the best environment. I use Aquamacs on OS X, and the stock GNU emacs on Linux. Both are great for OCaml programming when the extensions are installed.
When I typing OCaml, VScode could not indent automatically, with my config as follows:
"reason.path.ocamlmerlin": "/Users/taki/.opam/4.05.0/bin/ocamlmerlin",
"editor.formatOnSave": true,
"editor.formatOnType": true,
"reason.diagnostics.tools": [
"merlin",
],