Sharing tips on how to configure vi/vim/neovim

The editor can support you when coding.
I use neovim.
My current config settings are

set rtp^="/usr/home/x/.opam/4.13.1+options/share/ocp-indent/vim"
let g:opamshare = substitute(system('opam var share'),'\n$','','''')
     execute "set rtp+=" . g:opamshare . "/merlin/vim"

I.e. ocp-ident & merlin

Feel free to share tips to configure vi/vim/neovim for beautify code, hint code,indent code,compile code, give library hints.


Instead of hard-coding paths and calling out to opam in your config scripts, I find it more flexible and overall simpler to use opam exec to run your editor, eg opam exec -- vim. That way ocp-indent, merlin, etc will be in the PATH and you can simplify the configuration scripts to look there for any required tools.



Can i use kwrite with lsp ?

I just found kate editor has a working lsp server plugin.

So does neovim which is what I use instead of the Merlin integration. It is somewhat less powerful than what Merlin allows because the protocol supports less than what Merlin can do but in practice it is very useful to use LSP because all the other plugins that support LSP also then magically support the OCaml LSP.

1 Like