# Ocaml Tools and Editors

**URL:** <https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964>\
**Category:** Learning\
**Created:** [November 28, 2018, 1:28am UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964 "2018-11-28T01:28:23Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![G4143](https://avatars.discourse-cdn.com/v4/letter/g/a88e57/32.png) [@G4143](https://discuss.ocaml.org/u/G4143)\
**Post date:** [November 28, 2018, 1:28am UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/1 "2018-11-28T01:28:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![perry](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/perry/32/518_2.png) [@perry](https://discuss.ocaml.org/u/perry)\
**Post date:** [November 28, 2018, 3:08pm UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/2 "2018-11-28T15:08:15Z")

</div>

> [@G4143](#):
>
> I’m wondering what the community uses for editors and tools.

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

---

<div class="post-metadata">

**Author:** ![hcarty](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/hcarty/32/1824_2.png) [@hcarty](https://discuss.ocaml.org/u/hcarty)\
**Post date:** [November 28, 2018, 3:52pm UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/3 "2018-11-28T15:52:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![G4143](https://avatars.discourse-cdn.com/v4/letter/g/a88e57/32.png) [@G4143](https://discuss.ocaml.org/u/G4143)\
**Post date:** [November 28, 2018, 10:36pm UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/4 "2018-11-28T22:36:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kakadu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kakadu/32/1204_2.png) [@Kakadu](https://discuss.ocaml.org/u/Kakadu)\
**Post date:** [November 28, 2018, 10:57pm UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/5 "2018-11-28T22:57:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![G4143](https://avatars.discourse-cdn.com/v4/letter/g/a88e57/32.png) [@G4143](https://discuss.ocaml.org/u/G4143)\
**Post date:** [November 28, 2018, 10:59pm UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/7 "2018-11-28T22:59:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![perry](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/perry/32/518_2.png) [@perry](https://discuss.ocaml.org/u/perry)\
**Post date:** [November 29, 2018, 12:40am UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/8 "2018-11-29T00:40:48Z")

</div>

> [@G4143](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![bbutterfield](https://avatars.discourse-cdn.com/v4/letter/b/e56c9b/32.png) [@bbutterfield](https://discuss.ocaml.org/u/bbutterfield)\
**Post date:** [November 29, 2018, 11:10pm UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/9 "2018-11-29T23:10:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rdavison](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/rdavison/32/4321_2.png) [@rdavison](https://discuss.ocaml.org/u/rdavison)\
**Post date:** [November 30, 2018, 5:55am UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/10 "2018-11-30T05:55:35Z")

</div>

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.

> <https://github.com/rdavison/dotfiles/blob/master/.config/nvim/init.vim>

---

<div class="post-metadata">

**Author:** ![edwin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/edwin/32/627_2.png) [@edwin](https://discuss.ocaml.org/u/edwin)\
**Post date:** [November 30, 2018, 7:53pm UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/11 "2018-11-30T19:53:13Z")

</div>

You can try [deoplete-ocaml](https://github.com/copy/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](https://github.com/edwintorok/xs-opam-dev)

---

<div class="post-metadata">

**Author:** ![bsansouci](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/bsansouci/32/41_2.png) [@bsansouci](https://discuss.ocaml.org/u/bsansouci)\
**Post date:** [December 4, 2018, 6:42pm UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/12 "2018-12-04T18:42:14Z")

</div>

I mostly write Reason these days and use Sublime with the LSP plugin and [reason-language-server](https://github.com/jaredly/reason-language-server), both of which would work when writing OCaml. Works pretty well.

---

<div class="post-metadata">

**Author:** ![Khady](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/khady/32/469_2.png) [@Khady](https://discuss.ocaml.org/u/Khady)\
**Post date:** [December 5, 2018, 3:53am UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/13 "2018-12-05T03:53:03Z")

</div>

RLS supports the ocaml syntax now?

---

<div class="post-metadata">

**Author:** ![dudelson](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dudelson/32/167_2.png) [@dudelson](https://discuss.ocaml.org/u/dudelson)\
**Post date:** [December 20, 2018, 1:52am UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/14 "2018-12-20T01:52:40Z")

</div>

I know I’m a little late to the party but I would like to put in a good word for vscode. I don’t use vscode as my primary editor (that’s spacemacs + tuareg), but I took it for a spin recently and I was able to get first-class OCaml/Reason support as well as vim keybindings in under a minute with vscode’s one-click extensions. I was very impressed by the polish and would definitely recommend for enthusiasts who don’t want to screw around with configuration too much.

---

<div class="post-metadata">

**Author:** ![RogerT](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@RogerT](https://discuss.ocaml.org/u/RogerT)\
**Post date:** [December 20, 2018, 8:29am UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/15 "2018-12-20T08:29:11Z")

</div>

> [@dudelson](#):
>
> I was able to get first-class OCaml/Reason support as well as vim keybindings in under a minute with vscode’s one-click extensions.

I had to setup an OCaml editor for a person who is used to vscode-like tools.  
I could quickly get basics features (autocomplete, error reporting and jump). But I was not able to get evaluation of OCaml expressions which is the minimum feature for a REPL.  
Can you evaluate OCaml expressions in vscode?  
In between, we chosed to have a try for him with [ocaml-top](https://www.typerex.org/ocaml-top.html) which is fine to do the REPL job (but this tool intended for education has no editing features such as search-replace, files tree, debug-compile, etc. ). It’s great for beginners who wants to focus on the OCaml language without being exposed to emacs/vim learning.

What is your setup?

Concerning debugging and compilation, I know that these features are not available. But maybe there is an easy tweak for that?

As @bobbypriambodo promoted vscode in his [article about Dune](https://medium.com/@bobbypriambodo/starting-an-ocaml-app-project-using-dune-d4f74e291de8), maybe he can tell to all of us more about that?

---

<div class="post-metadata">

**Author:** ![dudelson](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dudelson/32/167_2.png) [@dudelson](https://discuss.ocaml.org/u/dudelson)\
**Post date:** [December 22, 2018, 1:57am UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/16 "2018-12-22T01:57:39Z")

</div>

Unfortunately I cannot say a lot on this subject since I use vscode very rarely (only when I break emacs really hard). I took a quick look around just now and it seems like it’s possible since vscode 0.8.0, which added debugging features which would allow utop to be integrated with vscode. There’s even [this deprecated plugin](https://github.com/hackwaly/vscode-ocaml) which claims to have utop integration. Unfortunately the [official ocaml/reason plugin](https://github.com/reasonml-editor/vscode-reasonml) does not appear to have support for this feature, and it looks like the [currently recommended strategy](https://github.com/reasonml-editor/vscode-reasonml/issues/43) is to invoke the repl via the embedded terminal. I imagine this setup is good enough for the majority of users.

---

<div class="post-metadata">

**Author:** ![RogerT](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@RogerT](https://discuss.ocaml.org/u/RogerT)\
**Post date:** [December 22, 2018, 8:19pm UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/17 "2018-12-22T20:19:27Z")

</div>

> [@dudelson](#):
>
> it looks like the [currently recommended strategy](https://github.com/reasonml-editor/vscode-reasonml/issues/43) is to invoke the repl via the embedded terminal.

It looks more like a workaround than a strategy.  
As @freebroccolo says in the page you mentioned [Support for connected rtop session. #43](https://github.com/reasonml-editor/vscode-reasonml/issues/43)

> a REPL integration will never work well without support from the build system or quite a bit of manual intervention from the user (load the right packages via topfind/Findlib).

Maybe the Dune team could give us their opinion about that?

There is an article about a projected OCaml IDE at JS but focused on github integration [[Jane Street Tech Blog - Putting the I back in IDE: Towards a Github Explorer](https://blog.janestreet.com/putting-the-i-back-in-ide-towards-a-github-explorer/)]([http://Putting](http://Putting) the I back in IDE: Towards a Github Explorer).

There is [typerex](http://www.typerex.org) that claims to be an _OCaml programming studio_ but this is a set of (used) tools and not an IDE as suggested by the word _studio_.

I had a try a few years ago with the now old [OcaIDE](http://www.algo-prog.info/ocaide/index.php) plugin for Eclipse that was interesting. It has module and members completion, code outline, type pop-ups, information pop-ups, hyperlinks, help on expected parameters, files tree, errors markers in the editor and in the files tree/explorer, module browser and integrated toplevel.

---

<div class="post-metadata">

**Author:** ![s.t.s](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@s.t.s](https://discuss.ocaml.org/u/s.t.s)\
**Post date:** [July 2, 2019, 1:32am UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/18 "2019-07-02T01:32:15Z")

</div>

Try to remap your keyboard to dvorak, and to change the locations of control and alt keys. This works really well with regular physical keyboard. Also, check out [http://ergoemacs.org/emacs/emacs\_kb\_shortcuts\_pain.html](http://ergoemacs.org/emacs/emacs_kb_shortcuts_pain.html), on the site mentioned earlier by by @Kakadu.

---

<div class="post-metadata">

**Author:** ![XVilka](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/xvilka/32/5334_2.png) [@XVilka](https://discuss.ocaml.org/u/XVilka)\
**Post date:** [July 2, 2019, 4:05am UTC](https://discuss.ocaml.org/t/ocaml-tools-and-editors/2964/19 "2019-07-02T04:05:10Z")

</div>

I am working on upstreaming some OCaml and Dune syntax improvements into the mainline Vim and Neovim, see [vim-ocaml issue #33](https://github.com/rgrinberg/vim-ocaml/issues/33). So any feedback is appreciated.

Update: all changes that can be upstreamed (are part of the Vim) are now upstreamed.
