OCaml, VIM, Repl

I’m currently following https://github.com/ocaml/merlin/wiki/vim-from-scratch for my OCaml / Merlin / VIM setup.

One thing I’m missing right now is OCaml REPL <-> VIM integration. I’m looking for something where:

  1. we start a OCaml REPL from some project
  2. we can type directly into the REPL
  3. we can send current VIM buffer to REPL
  4. we can send last OCaml to REPL

Any pointers?

I use https://github.com/jpalardy/vim-slime together with tmux for sending vim buffer contents to utop. I.e. I manually start utop within a tmux session, then configure vim-slime for that session, and send stuff from vim to tmux with <c-c><c-c>. vim-slime works also for other terminal multiplexers, see the docs.
I don’t understand your point 4.

Both neovim and vim now have terminal emulators integrated into them, though I hear neovim’s is a little more stable. You might want to look into this, as it’d allow you to use vim’s regular copy-paste to copy into the REPL.

I haven’t used it but it seems vim-slime can also target the terminal emulators in new vim and in neovim versions – i guess then it mainly provides a useful shortcut for copy and paste and perhaps some automatic appending of ;; etc.

After working with Toploop for awhile, I think that ;; is just a limitation of the terminal UI. if you can distinguish between Enter and Shift + Enter, you can make ;; optional.

@jeremiedimino mentioned that there is a workaround to automatically insert ;;.

If you use Tuareg, you can just type Sift-return to evaluate your phrase.

yeah. That’s basically what I’m saying. because the terminal can’t distinguish between different combinations, ;; is needed