mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated plugins
This commit is contained in:
31
sources_non_forked/syntastic/syntax_checkers/python/codec.py
Normal file
31
sources_non_forked/syntastic/syntax_checkers/python/codec.py
Normal file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
from sys import argv, exit
|
||||
|
||||
import codecs
|
||||
import re
|
||||
import os
|
||||
|
||||
|
||||
if len(argv) != 2:
|
||||
exit(1)
|
||||
|
||||
try:
|
||||
with open(argv[1]) as fle:
|
||||
text = fle.readlines()
|
||||
|
||||
if text:
|
||||
match = re.match(r"#\s*coding\s*:\s*(?P<coding>\w+)", text[0])
|
||||
if match:
|
||||
text = codecs.lookup(match.groupdict()["coding"]).incrementaldecoder().decode(
|
||||
''.join(text).encode('utf-8')).encode('utf-8')
|
||||
|
||||
if isinstance(text, list):
|
||||
text = ''.join(text).encode('utf-8')
|
||||
|
||||
compile(text, argv[1], 'exec', 0, 1)
|
||||
except SyntaxError as err:
|
||||
print('%s:%s:%s: %s' % (err.filename, err.lineno, err.offset, err.msg))
|
||||
except Exception as err:
|
||||
print('%s:%s:%s: %s' % (os.path.abspath(argv[1]), 1, 0, err))
|
@ -69,4 +69,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -60,4 +60,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -32,4 +32,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -2,8 +2,6 @@
|
||||
"File: pep257.vim
|
||||
"Description: Docstring style checking plugin for syntastic.vim
|
||||
"============================================================================
|
||||
"
|
||||
" For details about pep257 see: https://github.com/GreenSteam/pep257
|
||||
|
||||
if exists('g:loaded_syntastic_python_pep257_checker')
|
||||
finish
|
||||
@ -60,4 +58,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -9,8 +9,6 @@
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
"
|
||||
" For details about pep8 see: https://github.com/jcrocholl/pep8
|
||||
|
||||
if exists("g:loaded_syntastic_python_pep8_checker")
|
||||
finish
|
||||
@ -47,4 +45,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -75,4 +75,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -33,4 +33,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -71,4 +71,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -71,4 +71,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -95,4 +95,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -15,10 +15,14 @@ if exists("g:loaded_syntastic_python_python_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_python_python_checker = 1
|
||||
|
||||
if !exists('g:syntastic_python_python_use_codec')
|
||||
let g:syntastic_python_python_use_codec = 0
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:compiler = expand('<sfile>:p:h') . syntastic#util#Slash() . 'compile.py'
|
||||
let s:base_path = expand('<sfile>:p:h', 1) . syntastic#util#Slash()
|
||||
|
||||
function! SyntaxCheckers_python_python_IsAvailable() dict
|
||||
if !executable(self.getExec())
|
||||
@ -32,7 +36,9 @@ function! SyntaxCheckers_python_python_IsAvailable() dict
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_python_python_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ 'exe': [self.getExec(), s:compiler] })
|
||||
let compiler = s:base_path . (g:syntastic_python_python_use_codec ? 'codec.py' : 'compile.py')
|
||||
call self.log('using compiler script', compiler)
|
||||
let makeprg = self.makeprgBuild({ 'exe': [self.getExec(), compiler] })
|
||||
|
||||
let errorformat = '%E%f:%l:%c: %m'
|
||||
|
||||
@ -52,4 +58,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
Reference in New Issue
Block a user