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-02-21 10:50:41 -05:00
|
|
|
if exists("g:loaded_syntastic_python_python_checker")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let g:loaded_syntastic_python_python_checker=1
|
|
|
|
|
2013-10-28 07:53:33 -04:00
|
|
|
function! SyntaxCheckers_python_python_GetLocList() dict
|
2013-04-12 06:14:07 -04:00
|
|
|
let fname = "'" . escape(expand('%'), "\\'") . "'"
|
2013-05-31 14:05:45 -04:00
|
|
|
|
2013-04-12 06:14:07 -04:00
|
|
|
let makeprg = syntastic#makeprg#build({
|
|
|
|
\ 'exe': 'python',
|
|
|
|
\ 'args': '-c',
|
2013-07-04 14:04:20 -04:00
|
|
|
\ 'fname': syntastic#util#shescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"),
|
2013-10-28 07:53:33 -04:00
|
|
|
\ 'checker': self })
|
2013-05-31 14:05:45 -04:00
|
|
|
|
2013-04-12 06:14:07 -04:00
|
|
|
let errorformat =
|
|
|
|
\ '%E File "%f"\, line %l,' .
|
2013-04-12 06:29:47 -04:00
|
|
|
\ '%C %p^,' .
|
2013-04-12 06:14:07 -04:00
|
|
|
\ '%C %.%#,' .
|
|
|
|
\ '%Z%m,' .
|
|
|
|
\ '%-G%.%#'
|
2013-05-31 14:05:45 -04:00
|
|
|
|
|
|
|
return SyntasticMake({
|
|
|
|
\ 'makeprg': makeprg,
|
|
|
|
\ 'errorformat': errorformat })
|
2012-12-01 15:17:46 -05:00
|
|
|
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'})
|