Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactor out some duplication of /dev/null logic

  • Loading branch information...
commit 0765f97dd386f46279dd47be745f73940a53e425 1 parent 3e58e49
@scrooloose authored
View
18 autoload/syntastic/util.vim
@@ -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
6 syntax_checkers/less.vim
@@ -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
6 syntax_checkers/rst.vim
@@ -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
6 syntax_checkers/typescript.vim
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.