[ANN] vim-ocaml - new home

Dear Vim & Neovim users,

I would like to announce that I’ve officially moved the vim-ocaml repository under the control of the OCaml organization on github. Please direct your bug reports and pull requests to this repository. This move is done not because vim-ocaml is being neglected, on the contrary, there’s an active team of maintainers that recently expanded. I simply want to take this opportunity to draw more Vim & Noevim users to this project, as I suspect many users aren’t aware of recent efforts.

Cheers,

Rudi.

19 Likes

I should note that both latest Vim and NeoVim updated their OCaml syntax files based on this repository.

2 Likes

I haven’t found where are the explantations about where to install these last files.

Edit: I copied the directories into ~/.vim, it seems to work.

In my ~/.vim/syntax/ I have 2 syntax for ocpbuild.vim and ocpbuildroot.vim that it seem I wrote in 2013. I never used it since then, so I don’t know if it’s still up to date. Do you think it would deserve a pull request to vim-ocaml ?

I tryed to follow the explanations to install ocp-indent, I get the following error:

Error detected while processing FileType Auto commands for "ocaml":
E484: Can't open file /home/blue_prawn/.opam/default/share/vim/syntax/ocp-indent.vim

Does ocpbuild have any users anymore? I suppose there’s no harm if there are.

I tryed to follow the explanations to install ocp-indent, I get the following error:

Do you have ocp-indent installed through opam?

based on:
https://opam.ocaml.org/packages/ocp-build/
Statistics: Installed 2138 times last month.

yes
I created an empty file for ~/.opam/default/share/vim/syntax/ocp-indent.vim and it seems to fix.

I don’t know which instructions you are referring to (by the way, beware that this doc is outdated), but firstly, a more correct path would be ~/.opam/default/share/ocp-indent/vim/syntax/ocp-indent.vim, with the package’s name under the share directory. Secondly, a Vim file named syntax/ocp-indent.vim usually means «the syntax highlighting for the language named “ocp-indent”». That’s probably not what you want.

For ocp-indent and Merlin installed via opam, I simply have the following in my vimrc file:

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

" plugin “ocp-indent” (indenting tool):
execute 'set rtp^=' . g:opamshare . '/ocp-indent/vim'
" plugin “merlin” (IDE for OCaml):
execute 'set rtp^=' . g:opamshare . '/merlin/vim'

No need for auto-commands, the loading mechanism of Vim will do the right thing based on file names.

1 Like

In case anyone else is wondering which updates have been merged into upstream Vim, the relevant PRs are this one and that one. It dates as far back as OCaml 4.02, released 2014. It was about time!

By the way, I published some concealment bindings for OCaml. They are activated with <LocalLeader>c. Feel free to add more, provide any ideas or take this code wherever you like. For example, I was searching for any suitable mathematical symbol for [@@deriving ...] substitution but didn’t come with any.

One of the most annoying problems is the inability of [Neo]Vim to conceal something as a string, not a character, e.g. conceal int64 with ℤ64 or something like that. I opened an issue in Vim to track this suggestion (add cstr operator in addition to cchar).