1
0
Fork 0
mirror of synced 2024-11-17 14:35:34 -05:00
ultimate-vim/sources_non_forked/syntastic/syntax_checkers/python/python.vim
2014-02-24 22:22:30 -04:00

43 lines
1.3 KiB
VimL

"============================================================================
"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
"
"============================================================================
if exists("g:loaded_syntastic_python_python_checker")
finish
endif
let g:loaded_syntastic_python_python_checker=1
function! SyntaxCheckers_python_python_IsAvailable()
return executable('python')
endfunction
function! SyntaxCheckers_python_python_GetLocList()
let fname = "'" . escape(expand('%'), "\\'") . "'"
let makeprg = syntastic#makeprg#build({
\ 'exe': 'python',
\ 'args': '-c',
\ 'fname': syntastic#util#shescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"),
\ 'filetype': 'python',
\ 'subchecker': 'python' })
let errorformat =
\ '%E File "%f"\, line %l,' .
\ '%C %p^,' .
\ '%C %.%#,' .
\ '%Z%m,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'python',
\ 'name': 'python'})