mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated plugins
This commit is contained in:
@ -44,7 +44,8 @@ function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() dict " {{{1
|
||||
endfunction " }}}1
|
||||
|
||||
function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1
|
||||
let makeprg = s:GetMakeprg()
|
||||
let buf = bufnr('')
|
||||
let makeprg = s:GetMakeprg(buf)
|
||||
if makeprg ==# ''
|
||||
return []
|
||||
endif
|
||||
@ -65,7 +66,7 @@ function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr('')} })
|
||||
\ 'defaults': {'bufnr': buf} })
|
||||
|
||||
for e in loclist
|
||||
if get(e, 'col', 0) && get(e, 'nr', 0)
|
||||
@ -79,40 +80,41 @@ endfunction " }}}1
|
||||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:GetMakeprg() " {{{2
|
||||
function! s:GetMakeprg(buf) " {{{2
|
||||
return
|
||||
\ g:syntastic_ocaml_use_ocamlc ? g:syntastic_ocaml_use_ocamlc :
|
||||
\ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg() :
|
||||
\ s:GetOtherMakeprg()
|
||||
\ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg(a:buf) :
|
||||
\ s:GetOtherMakeprg(a:buf)
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:GetOcamlcMakeprg() " {{{2
|
||||
function! s:GetOcamlcMakeprg(buf) " {{{2
|
||||
let build_cmd = g:syntastic_ocaml_use_janestreet_core ?
|
||||
\ 'ocamlc -I ' . syntastic#util#shexpand(g:syntastic_ocaml_janestreet_core_dir) : 'ocamlc'
|
||||
let build_cmd .= ' -c ' . syntastic#util#shexpand('%')
|
||||
let build_cmd .= ' -c ' . syntastic#util#shescape(bufname(a:buf))
|
||||
return build_cmd
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:GetOcamlBuildMakeprg() " {{{2
|
||||
function! s:GetOcamlBuildMakeprg(buf) " {{{2
|
||||
return 'ocamlbuild -quiet -no-log -tag annot,' . s:ocamlpp . ' -no-links -no-hygiene -no-sanitize ' .
|
||||
\ syntastic#util#shexpand('%:r') . '.cmi'
|
||||
\ syntastic#util#shexpand(fnamemodify(bufname(a:buf), ':r')) . '.cmi'
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:GetOtherMakeprg() " {{{2
|
||||
function! s:GetOtherMakeprg(buf) " {{{2
|
||||
"TODO: give this function a better name?
|
||||
"
|
||||
"TODO: should use throw/catch instead of returning an empty makeprg
|
||||
|
||||
let extension = expand('%:e', 1)
|
||||
let fname = bufname(a:buf)
|
||||
let extension = fnamemodify(fname, ':e')
|
||||
let makeprg = ''
|
||||
|
||||
if stridx(extension, 'mly') >= 0 && executable('menhir')
|
||||
" ocamlyacc output can't be redirected, so use menhir
|
||||
let makeprg = 'menhir --only-preprocess ' . syntastic#util#shexpand('%') . ' >' . syntastic#util#DevNull()
|
||||
let makeprg = 'menhir --only-preprocess ' . syntastic#util#shescape(fname) . ' >' . syntastic#util#DevNull()
|
||||
elseif stridx(extension,'mll') >= 0 && executable('ocamllex')
|
||||
let makeprg = 'ocamllex -q ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shexpand('%')
|
||||
let makeprg = 'ocamllex -q ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shescape(fname)
|
||||
else
|
||||
let makeprg = 'camlp4o ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shexpand('%')
|
||||
let makeprg = 'camlp4o ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shescape(fname)
|
||||
endif
|
||||
|
||||
return makeprg
|
||||
|
Reference in New Issue
Block a user