refactor out some duplication of /dev/null logic

This commit is contained in:
Martin Grenfell 2012-10-23 22:37:11 +01:00
parent 3e58e495ac
commit 0765f97dd3
4 changed files with 21 additions and 15 deletions

View File

@ -0,0 +1,18 @@
if exists("g:loaded_syntastic_util_autoload")
finish
endif
let g:loaded_syntastic_util_autoload = 1
let s:save_cpo = &cpo
set cpo&vim
function! syntastic#util#DevNull()
if has('win32')
return 'NUL'
endif
return '/dev/null'
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -42,12 +42,8 @@ else
end
function! SyntaxCheckers_less_GetLocList()
let devnull = '/dev/null'
if has('win32')
let devnull = 'NUL'
endif
let makeprg = s:check_file . ' ' . g:syntastic_less_options . ' ' .
\ shellescape(expand('%')) . ' ' . devnull
\ shellescape(expand('%')) . ' ' . syntastic#util#DevNull()
let errorformat = '%m in %f:%l:%c'
return SyntasticMake({ 'makeprg': makeprg,

View File

@ -24,12 +24,8 @@ if !executable("rst2pseudoxml.py")
endif
function! SyntaxCheckers_rst_GetLocList()
let devnull = '/dev/null'
if has('win32')
let devnull = 'NUL'
endif
let makeprg = 'rst2pseudoxml.py --report=2 --exit-status=1 ' .
\ shellescape(expand('%')) . ' ' . devnull
\ shellescape(expand('%')) . ' ' . syntastic#util#DevNull()
let errorformat = '%f:%l:\ (%tNFO/1)\ %m,
\%f:%l:\ (%tARNING/2)\ %m,

View File

@ -14,11 +14,7 @@ if !executable("tsc")
endif
function! SyntaxCheckers_typescript_GetLocList()
let devnull = '/dev/null'
if has('win32')
let devnull = 'NUL'
endif
let makeprg = 'tsc ' . shellescape(expand("%")) . ' --out ' . devnull
let makeprg = 'tsc ' . shellescape(expand("%")) . ' --out ' . syntastic#util#DevNull()
let errorformat = '%f (%l\,%c): %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction