mirror of
https://github.com/amix/vimrc
synced 2025-07-13 14:55:01 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@ -27,9 +27,12 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict
|
||||
\ '%A%f:%l: %t%n %m,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env })
|
||||
|
||||
for e in loclist
|
||||
" E*** and W*** are pep8 errors
|
||||
|
@ -27,9 +27,12 @@ function! SyntaxCheckers_python_frosted_GetLocList() dict
|
||||
\ '%-Z%p^,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
for e in loclist
|
||||
@ -39,7 +42,7 @@ function! SyntaxCheckers_python_frosted_GetLocList() dict
|
||||
if len(parts) >= 4
|
||||
let e["type"] = parts[1][0]
|
||||
let e["text"] = parts[3] . ' [' . parts[1] . ']'
|
||||
let e["hl"] = '\V' . escape(parts[2], '\')
|
||||
let e["hl"] = '\V\<' . escape(parts[2], '\') . '\>'
|
||||
elseif e["text"] =~? '\v^I\d+:'
|
||||
let e["valid"] = 0
|
||||
else
|
||||
|
@ -5,7 +5,7 @@
|
||||
"
|
||||
" For details about pep257 see: https://github.com/GreenSteam/pep257
|
||||
|
||||
if exists("g:loaded_syntastic_python_pep257_checker")
|
||||
if exists('g:loaded_syntastic_python_pep257_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_python_pep257_checker = 1
|
||||
@ -14,24 +14,40 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_python_pep257_GetLocList() dict
|
||||
if !exists('s:pep257_new')
|
||||
let s:pep257_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion(
|
||||
\ self.getExecEscaped() . ' --version'), [0, 3])
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' .
|
||||
\ '%E%f:%l:%c: %m,' .
|
||||
\ '%+C %m'
|
||||
if s:pep257_new
|
||||
let errorformat =
|
||||
\ '%E%f:%l %.%#:,' .
|
||||
\ '%+C %m'
|
||||
else
|
||||
let errorformat =
|
||||
\ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' .
|
||||
\ '%E%f:%l:%c: %m,' .
|
||||
\ '%+C %m'
|
||||
endif
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'preprocess': 'killEmpty',
|
||||
\ 'postprocess': ['compressWhitespace'] })
|
||||
|
||||
" pep257 outputs byte offsets rather than column numbers
|
||||
for e in loclist
|
||||
let e['col'] = get(e, 'col', 0) + 1
|
||||
endfor
|
||||
if s:pep257_new == 0
|
||||
" byte offsets rather than column numbers
|
||||
for e in loclist
|
||||
let e['col'] = get(e, 'col', 0) + 1
|
||||
endfor
|
||||
endif
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
@ -25,9 +25,12 @@ function! SyntaxCheckers_python_pep8_GetLocList() dict
|
||||
|
||||
let errorformat = '%f:%l:%c: %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'subtype': 'Style' })
|
||||
|
||||
for e in loclist
|
||||
|
@ -18,9 +18,12 @@ function! SyntaxCheckers_python_py3kwarn_GetLocList() dict
|
||||
|
||||
let errorformat = '%W%f:%l:%c: %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -26,14 +26,14 @@ function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i)
|
||||
\ || stridx(a:i['text'], 'shadowed by loop variable') >= 0
|
||||
|
||||
" fun with Python's %r: try "..." first, then '...'
|
||||
let terms = split(a:i['text'], '"', 1)
|
||||
if len(terms) > 2
|
||||
return terms[1]
|
||||
let term = matchstr(a:i['text'], '\m^.\{-}"\zs.\{-1,}\ze"')
|
||||
if term != ''
|
||||
return '\V\<' . escape(term, '\') . '\>'
|
||||
endif
|
||||
|
||||
let terms = split(a:i['text'], "'", 1)
|
||||
if len(terms) > 2
|
||||
return terms[1]
|
||||
let term = matchstr(a:i['text'], '\m^.\{-}''\zs.\{-1,}\ze''')
|
||||
if term != ''
|
||||
return '\V\<' . escape(term, '\') . '\>'
|
||||
endif
|
||||
endif
|
||||
return ''
|
||||
@ -49,9 +49,12 @@ function! SyntaxCheckers_python_pyflakes_GetLocList() dict
|
||||
\ '%E%f:%l: %m,'.
|
||||
\ '%-G%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'defaults': {'text': "Syntax error"} })
|
||||
|
||||
for e in loclist
|
||||
|
@ -30,10 +30,12 @@ function! SyntaxCheckers_python_pylama_GetLocList() dict
|
||||
\ '%-GWARNING:pylama:%.%#,' .
|
||||
\ '%A%f:%l:%c: %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['sort'] })
|
||||
\ 'env': env })
|
||||
|
||||
" adjust for weirdness in each checker
|
||||
for e in loclist
|
||||
@ -53,6 +55,8 @@ function! SyntaxCheckers_python_pylama_GetLocList() dict
|
||||
endif
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
|
@ -32,10 +32,12 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict
|
||||
\ '%-Z%p^%.%#,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let loclist=SyntasticMake({
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['sort'],
|
||||
\ 'env': env,
|
||||
\ 'returns': range(32) })
|
||||
|
||||
for e in loclist
|
||||
@ -55,6 +57,8 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict
|
||||
let e['vcol'] = 0
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
@ -63,9 +67,12 @@ function! s:PylintNew(exe)
|
||||
try
|
||||
" On Windows the version is shown as "pylint-script.py 1.0.0".
|
||||
" On Gentoo Linux it's "pylint-python2.7 0.28.0".
|
||||
" On NixOS, that would be ".pylint-wrapped 0.26.0", that would be.
|
||||
" On NixOS, that would be ".pylint-wrapped 0.26.0".
|
||||
" On Arch Linux it's "pylint2 1.1.0".
|
||||
" On new-ish Fedora it's "python3-pylint 1.2.0".
|
||||
" Have you guys considered switching to creative writing yet? ;)
|
||||
let pylint_version = filter(split(system(exe . ' --version'), '\m, \=\|\n'), 'v:val =~# ''\m^\.\=pylint\>''')[0]
|
||||
let pylint_version = filter( split(system(exe . ' --version'), '\m, \=\|\n'),
|
||||
\ 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0]
|
||||
let pylint_version = substitute(pylint_version, '\v^\S+\s+', '', '')
|
||||
let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1])
|
||||
catch /\m^Vim\%((\a\+)\)\=:E684/
|
||||
|
@ -30,9 +30,12 @@ function! SyntaxCheckers_python_python_GetLocList() dict
|
||||
|
||||
let errorformat = '%E%f:%l:%c: %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'returns': [0] })
|
||||
endfunction
|
||||
|
||||
|
Reference in New Issue
Block a user