2012-12-01 15:17:46 -05:00
|
|
|
"============================================================================
|
|
|
|
"File: python.vim
|
|
|
|
"Description: Syntax checking plugin for syntastic.vim
|
|
|
|
"Author: Artem Nezvigin <artem at artnez dot com>
|
|
|
|
"
|
|
|
|
" `errorformat` derived from:
|
|
|
|
" http://www.vim.org/scripts/download_script.php?src_id=1392
|
|
|
|
"
|
|
|
|
"============================================================================
|
2013-01-27 15:08:30 -05:00
|
|
|
function! SyntaxCheckers_python_python_IsAvailable()
|
2013-01-23 19:01:30 -05:00
|
|
|
return executable('python')
|
|
|
|
endfunction
|
2012-12-01 15:17:46 -05:00
|
|
|
|
2013-01-27 15:08:30 -05:00
|
|
|
function! SyntaxCheckers_python_python_GetLocList()
|
2012-12-01 15:17:46 -05:00
|
|
|
let l:path = shellescape(expand('%'))
|
|
|
|
let l:cmd = "compile(open(" . l:path . ").read(), " . l:path . ", 'exec')"
|
|
|
|
let l:makeprg = 'python -c "' . l:cmd . '"'
|
|
|
|
|
|
|
|
let l:errorformat =
|
|
|
|
\ "\%A\ \ File\ \"%f\"\\\,\ line\ %l\\\,%m," .
|
|
|
|
\ "\%C\ \ \ \ %.%#," .
|
|
|
|
\ "\%+Z%.%#Error\:\ %.%#," .
|
|
|
|
\ "\%A\ \ File\ \"%f\"\\\,\ line\ %l," .
|
|
|
|
\ "\%+C\ \ %.%#," .
|
|
|
|
\ "\%-C%p^," .
|
|
|
|
\ "\%Z%m," .
|
|
|
|
\ "\%-G%.%#"
|
|
|
|
|
|
|
|
return SyntasticMake({ 'makeprg': l:makeprg, 'errorformat': l:errorformat })
|
|
|
|
endfunction
|
2013-01-23 19:01:30 -05:00
|
|
|
|
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'python',
|
2013-01-27 15:08:30 -05:00
|
|
|
\ 'name': 'python'})
|