Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get ocamlmerlin autocomplete in vim

I'm trying to get autocompletion for OCaml. I like using Vim and I found this plugin:

https://github.com/the-lambda-church/merlin

I installed it using OPAM and added the required lines to load it to my .vimrc

I made sure that OPAM bin folder (which contains ocamlmerlin) is in my .profile file and checked that I can access it from the terminal and for vim I printed the PATH variable using "Ctrl-r =$PATH" and it shows that it contains OPAM bin folder.

It still doesn't work, I have no clue what else to do to make it work. I get syntax highlighting but that exists without merlin anyway. I want autocompletion to work.

If I press Ctrl-N to show completion suggestion I get "normal" vim completion which is basically just a list of words that are mentioned in the document.

Checking the startup log file, I can see that Vim did indeed load merlin:

chdir(/home/incraved/.opam/system/share/ocamlmerlin/vim/plugin)
fchdir() to previous dir
sourcing "/home/incraved/.opam/system/share/ocamlmerlin/vim/plugin/merlin.vim"
finished sourcing /home/incraved/.opam/system/share/ocamlmerlin/vim/plugin/merlin.vim
Searching for "/home/incraved/.opam/system/share/ocamlmerlin/vimbufsync/plugin/**/*.vim"

Any ideas?

like image 771
SpaceMonkey Avatar asked Oct 01 '22 21:10

SpaceMonkey


1 Answers

Ctrl-N is the default completion; its sources are configured by the 'complete' option, but cannot include custom sources.

The Merlin plugin uses Omni completion, which is triggered with Ctrl-X Ctrl-O; see :help compl-omni.

like image 199
Ingo Karkat Avatar answered Oct 05 '22 13:10

Ingo Karkat