Do you use merlin with vim on Windows?


I’m writing a new “Up and Running with OCaml” page for, and I really want to make sure all the instructions work on Windows.

The only thing still eluding me is getting merlin working with Vim on the recommended fdopen Windows distribution:

I have been to the oracle, but they do not know:

So, does anyone have a success report? Presently I am following the instructions printed when merlin is installed via opam. The ocamlmerlin executable is in the path. But :MerlinTypeOf, for example, just says “unknown command”. These instructions work fine for me on OS X and Linux.

I am using the vim installed by the cygwin installer, and running it from the OCaml64 window installed by the fdopen Windows OCaml Installer.

Thanks for any pointers.

1 Like

Yes, I’m using merlin :

$ ocamlmerlin -version
The Merlin toolkit version v3.3.6-1-g70c8cff3-dirty, for Ocaml 4.10.0

You have to remember that merlin is installed as a window program, even if you are using cygwin : the path shall be given in the windows format.

This is an extract of my vimfile related to ocaml :

if has('gui_win32')
  let $PATH .= ";D:/bin/cygwin/usr/local/bin/"
  let $PATH .= ";".substitute(system('opam config var bin'),'\n$','','''')
  set pythonthreedll=python38.dll

  let s:opamshare = substitute(system('opam config var share'),'\n$','','''')

  if isdirectory(s:opamshare) && isdirectory(s:opamshare . "/merlin/")
  execute "set rtp+=" . s:opamshare . "/merlin/vim"

I’ve been annoyed this a bug which open hundred pop-ups when I save the editor. There is a branch which correct this bug but has not been merge yet.

Note that I did not update my configuration to the last ocaml version, and can’t be sure that the whole toolchain still works.


I have got to the bottom of this, with help from your instructions, and from the very useful “Troubleshooting” section here:

The problem is that cygwin vim is not compiled with +python!

More info here: