diff --git a/CHANGES.md b/CHANGES.md index 67bccef0fc..820fcac998 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,8 @@ merlin NEXT_VERSION - Add a "heap_mbytes" field to Merlin server responses to report heap usage (#1717) - Add cache stats to telemetry (#1711) - Add a query_num field to the `ocamlmerlin` responses to detect server crashes (#1716) + + editor modes + - vim: load merlin under the ocamlinterface and ocamllex filetypes (#1340) merlin 4.13 =========== diff --git a/vim/merlin/dune b/vim/merlin/dune index 40c3348604..e9c55d1788 100644 --- a/vim/merlin/dune +++ b/vim/merlin/dune @@ -13,9 +13,12 @@ (ftdetect/merlin.vim as vim/ftdetect/merlin.vim) (ftplugin/merlin.vim as vim/ftplugin/merlin.vim) (ftplugin/ocaml.vim as vim/ftplugin/ocaml.vim) + (ftplugin/ocamlinterface.vim as vim/ftplugin/ocamlinterface.vim) + (ftplugin/ocamllex.vim as vim/ftplugin/ocamllex.vim) (ftplugin/omlet.vim as vim/ftplugin/omlet.vim) (ftplugin/reason.vim as vim/ftplugin/reason.vim) (plugin/merlin.vim as vim/plugin/merlin.vim) (syntax_checkers/ocaml/merlin.vim as vim/syntax_checkers/ocaml/merlin.vim) + (syntax_checkers/ocamlinterface/merlin.vim as vim/syntax_checkers/ocamlinterface/merlin.vim) (syntax_checkers/omlet/merlin.vim as vim/syntax_checkers/omlet/merlin.vim) (syntax/merlin.vim as vim/syntax/merlin.vim))) diff --git a/vim/merlin/ftplugin/ocamlinterface.vim b/vim/merlin/ftplugin/ocamlinterface.vim new file mode 100644 index 0000000000..2e33e14808 --- /dev/null +++ b/vim/merlin/ftplugin/ocamlinterface.vim @@ -0,0 +1,2 @@ +" Activate merlin on current buffer +call merlin#Register() diff --git a/vim/merlin/ftplugin/ocamllex.vim b/vim/merlin/ftplugin/ocamllex.vim new file mode 100644 index 0000000000..2e33e14808 --- /dev/null +++ b/vim/merlin/ftplugin/ocamllex.vim @@ -0,0 +1,2 @@ +" Activate merlin on current buffer +call merlin#Register() diff --git a/vim/merlin/syntax_checkers/ocamlinterface/merlin.vim b/vim/merlin/syntax_checkers/ocamlinterface/merlin.vim new file mode 100644 index 0000000000..e5702ac482 --- /dev/null +++ b/vim/merlin/syntax_checkers/ocamlinterface/merlin.vim @@ -0,0 +1,23 @@ +" Enable Syntastic support +" Make sure syntax_checkers directory is on runtime path, then set +" :let g:syntastic_ocamlinterface_checkers=['merlin'] + +function! SyntaxCheckers_ocamlinterface_merlin_IsAvailable() + if !exists("*merlin#SelectBinary") + return 0 + endif + try + let l:path = merlin#SelectBinary() + return executable(l:path) + catch + return 0 + endtry +endfunction + +function! SyntaxCheckers_ocamlinterface_merlin_GetLocList() + return merlin#ErrorLocList() +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'ocamlinterface', + \ 'name': 'merlin'})