Skip to content

Commit

Permalink
Change ocaml provider, closes #320
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerun committed Mar 4, 2019
1 parent b4cb586 commit 521220f
Show file tree
Hide file tree
Showing 19 changed files with 1,350 additions and 408 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
- [nix](https://github.com/LnL7/vim-nix) (syntax, indent, compiler, ftplugin)
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
- [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin)
- [ocaml](https://github.com/rgrinberg/vim-ocaml) (syntax, indent, compiler, ftplugin)
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin)
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin)
Expand Down
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ PACKS="
nim:zah/nim.vim:_BASIC
nix:LnL7/vim-nix
objc:b4winckler/vim-objc
ocaml:jrk/vim-ocaml
ocaml:rgrinberg/vim-ocaml
octave:vim-scripts/octave.vim--
opencl:petRUShka/vim-opencl
perl:vim-perl/vim-perl
Expand Down
59 changes: 59 additions & 0 deletions compiler/ocaml.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ocaml') != -1
finish
endif

" Vim Compiler File
" Compiler: ocaml
" Maintainer: Markus Mottl <[email protected]>
" URL: http://www.ocaml.info/vim/compiler/ocaml.vim
" Last Change:
" 2017 Nov 26 - Improved error format (Markus Mottl)
" 2013 Aug 27 - Added a new OCaml error format (Markus Mottl)
" 2013 Jun 30 - Initial version (Marc Weber)
"
" Marc Weber's comments:
" Setting makeprg doesn't make sense, because there is ocamlc, ocamlopt,
" ocamake and whatnot. So which one to use?
"
" This error format was moved from ftplugin/ocaml.vim to this file,
" because ftplugin is the wrong file to set an error format
" and the error format itself is annoying because it joins many lines in this
" error case:
"
" Error: The implementation foo.ml does not match the interface foo.cmi:
" Modules do not match case.
"
" So having it here makes people opt-in


if exists("current_compiler")
finish
endif
let current_compiler = "ocaml"

let s:cpo_save = &cpo
set cpo&vim

CompilerSet errorformat =
\%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:,
\%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d\ %.%#,
\%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m,
\%+EReference\ to\ unbound\ regexp\ name\ %m,
\%Eocamlyacc:\ e\ -\ line\ %l\ of\ \"%f\"\\,\ %m,
\%Wocamlyacc:\ w\ -\ %m,
\%-Zmake%.%#,
\%C%m,
\%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
\%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
\%D%*\\a:\ Entering\ directory\ `%f',
\%X%*\\a:\ Leaving\ directory\ `%f',
\%D%*\\a[%*\\d]:\ Entering\ directory\ '%f',
\%X%*\\a[%*\\d]:\ Leaving\ directory\ '%f',
\%D%*\\a:\ Entering\ directory\ '%f',
\%X%*\\a:\ Leaving\ directory\ '%f',
\%DEntering\ directory\ '%f',
\%XLeaving\ directory\ '%f',
\%DMaking\ %*\\a\ in\ %f

let &cpo = s:cpo_save
unlet s:cpo_save
49 changes: 49 additions & 0 deletions ftdetect/polyglot.vim
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,55 @@ au BufRead,BufNewFile *.nix set filetype=nix
augroup end
endif

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
augroup filetypedetect
" ocaml, from jbuild.vim in rgrinberg/vim-ocaml
au BufRead,BufNewFile jbuild,dune,dune-project set ft=jbuild
augroup end
endif

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
augroup filetypedetect
" ocaml, from oasis.vim in rgrinberg/vim-ocaml
au BufNewFile,BufRead _oasis set filetype=oasis
augroup end
endif

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
augroup filetypedetect
" ocaml, from ocaml.vim in rgrinberg/vim-ocaml
au BufRead,BufNewFile *.ml,*.mli,*.mll,*.mly,.ocamlinit,*.mlt,*.mlp,*.mlip,*.mli.cppo,*.ml.cppo set ft=ocaml
augroup end
endif

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
augroup filetypedetect
" ocaml, from ocamlbuild_tags.vim in rgrinberg/vim-ocaml
au BufNewFile,BufRead _tags set filetype=ocamlbuild_tags
augroup end
endif

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
augroup filetypedetect
" ocaml, from omake.vim in rgrinberg/vim-ocaml
au! BufRead,BufNewFile OMakefile,OMakeroot,*.om,OMakeroot.in set ft=omake
augroup end
endif

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
augroup filetypedetect
" ocaml, from opam.vim in rgrinberg/vim-ocaml
au BufNewFile,BufRead opam,*.opam set filetype=opam
augroup end
endif

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
augroup filetypedetect
" ocaml, from sexplib.vim in rgrinberg/vim-ocaml
au BufRead,BufNewFile *.sexp set ft=sexplib
augroup end
endif

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'opencl') == -1
augroup filetypedetect
" opencl, from opencl.vim in petRUShka/vim-opencl
Expand Down
16 changes: 16 additions & 0 deletions ftplugin/jbuild.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ocaml') != -1
finish
endif

if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin=1

set lisp

" Comment string
setl commentstring=;\ %s
setl comments=:;

setl iskeyword+=#,?,.,/
7 changes: 7 additions & 0 deletions ftplugin/oasis.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ocaml') != -1
finish
endif


setlocal comments=:#
setlocal commentstring=#\ %s
Loading

0 comments on commit 521220f

Please sign in to comment.