Setup vim for ReasonML development

Amirali Esmaeili
Sanjagh
Published in
2 min readNov 30, 2019

I came up with a fairly easy setup for reasonml development inside (neo)vim including syntax highlighting and lsp features (aka ide like features such as autocomplete, go to defintion, formatter etc.), it works great for bucklescript projects.

TLDR

Syntax Highlight

Simply install reasonml-editor/vim-reason-plus using your favourite plugin manager, note that don’t go over language server installation we we’ll cover that in this article.

Language Server

Although you can use any of lsp plugins available out there with combination of manual reason-language-server installation i highly encourage you install use coc.nvim.

coc.nvim

In my opinion it’s the best lsp plugin for vim, somehow vscode’s backend for vim. It’s extensible, fast, actively maintained and yes there’s a ReasonML extension for coc.nvim based on reason-vscode. Installing coc.nvim is easy checkout its repo for instructions.

coc-reason

After you’ve installed coc.nvim it’s time to setup coc-reason. Inside your (neo)vim run this command: :CocInstall coc-reason installation should be fast since it does’nt include reason-language-server binary, instead first time you open a reaosn file it will download the appropriate binary based on your platform. (Other features like updating lsp binary will be available soon, feel free to open issue on github or contact me directly if you had problems)

Bonus

coc.nvim’s wiki is great. there are docs on how to debug, how to map coc features, list of extensions etc. You may have problems with native development in this case use jordwalke/vim-reasonml. Happy Vimming!

--

--