1
0
mirror of https://github.com/amix/vimrc synced 2025-06-23 23:15:01 +08:00

Updated plugins

This commit is contained in:
amix
2015-12-08 10:20:04 -03:00
parent 768c72a3ed
commit 3b37bba6cd
239 changed files with 8132 additions and 3198 deletions

View File

@ -40,8 +40,8 @@ too:
Before you consider adding features to syntastic, _please_ spend a few
minutes (re-)reading the latest version of the [manual][1]. Syntastic
is changing rapidly at times, and it's quite possible that some of the
features you want to add exist already.
is changing rapidly at times, and it's quite possible that some features
you want to add exist already.
To submit a patch:
@ -54,7 +54,7 @@ Small, focused patches are preferred.
Large changes to the code should be discussed with the core team first.
Create an issue and explain your plan and see what we say.
Also make sure to update the manual whenever applicable. Nobody can use
Also, make sure to update the manual whenever applicable. Nobody can use
features that aren't documented.
<a name="generalstyle"></a>

View File

@ -35,7 +35,7 @@
4.8. [How can I pass additional arguments to a checker?](#faqargs)
4.9. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
4.10. [What is the difference between syntax checkers and style checkers?](#faqstyle)
4.11. [I have enabled multiple checkers for the current filetype. How can I display all of the errors from all of the checkers together?](#faqaggregate)
4.11. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
4.12. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
4.13. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
5. [Resources](#otherresources)
@ -53,22 +53,23 @@ are detected, the user is notified and is happy because they didn't have to
compile their code or execute their script to find them.
At the time of this writing, syntastic has checking plugins for ActionScript,
Ada, API Blueprint, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C,
C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml,
Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex,
Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM,
Nix, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
Object, OS X and iOS property lists, Puppet, Python, R, Racket, Relax NG,
reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, Tcl,
TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT,
Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, ASM,
BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq,
CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, Erlang,
eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars,
HSS, HTML, Jade, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM
intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, Objective-C,
Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and
iOS property lists, Puppet, Python, QML, R, Racket, Relax NG, reStructuredText,
RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, SQL, Stylus, Tcl, TeX,
Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, XQuery,
YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3] for details
about the corresponding supported checkers.
A number of third-party Vim plugins also provide checkers for syntastic,
for example: [omnisharp-vim][25], [rust.vim][12], [syntastic-extras][26],
[syntastic-more][27], [vim-crystal][29], [vim-eastwood][28], and
[vim-swift][24].
for example: [merlin][30], [omnisharp-vim][25], [rust.vim][12],
[syntastic-extras][26], [syntastic-more][27], [vim-crystal][29],
[vim-eastwood][28], and [vim-swift][24].
Below is a screenshot showing the methods that Syntastic uses to display syntax
errors. Note that, in practise, you will only have a subset of these methods
@ -159,10 +160,10 @@ following:
## 3\. Recommended settings
Syntastic has a large number of options that can be configured, and the
defaults are not particularly well suitable for new users. It is recommended
that you start by adding the following lines to your `vimrc` file, and return
to them after reading the manual (see `:help syntastic` in Vim):
Syntastic has numerous options that can be configured, and the defaults
are not particularly well suitable for new users. It is recommended
that you start by adding the following lines to your `vimrc` file, and
return to them after reading the manual (see `:help syntastic` in Vim):
```vim
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
@ -380,7 +381,7 @@ See `:help syntastic_quiet_messages` for details.
<a name="faqaggregate"></a>
__4.11. Q. I have enabled multiple checkers for the current filetype. How can I
display all of the errors from all of the checkers together?__
display all errors from all checkers together?__
A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`:
```vim
@ -427,7 +428,8 @@ There are also a dedicated [google group][5], and a
Syntastic aims to provide a common interface to syntax checkers for as many
languages as possible. For particular languages, there are, of course, other
plugins that provide more functionality than syntastic. You might want to take
a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
a look at [ghcmod-vim][31], [jedi-vim][7], [python-mode][8], [vim-go][32], or
[YouCompleteMe][9].
[0]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png
[1]: https://github.com/tpope/vim-pathogen
@ -459,6 +461,9 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
[27]: https://github.com/roktas/syntastic-more
[28]: https://github.com/venantius/vim-eastwood
[29]: https://github.com/rhysd/vim-crystal
[30]: https://github.com/the-lambda-church/merlin
[31]: https://github.com/eagletmt/ghcmod-vim
[32]: https://github.com/fatih/vim-go
<!--
vim:tw=79:sw=4:

View File

@ -223,24 +223,7 @@ function! s:_get_cflags(ft, ck, opts) abort " {{{2
" check if the user manually set some cflags
let b_cflags = s:_get_checker_var('b', a:ft, a:ck, 'cflags', '')
if b_cflags ==# ''
if a:ft ==# 'c' || a:ft ==# 'cpp'
" check whether to search for include files at all
if !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0)
" refresh the include file search if desired
if s:_get_checker_var('g', a:ft, a:ck, 'auto_refresh_includes', 0)
let flags .= ' ' . s:_search_headers()
else
" search for header includes if not cached already
if !exists('b:syntastic_' . a:ft . '_includes')
let b:syntastic_{a:ft}_includes = s:_search_headers()
endif
let flags .= ' ' . b:syntastic_{a:ft}_includes
endif
endif
endif
else
" user-defined cflags
if b_cflags !=# ''
let flags .= ' ' . b_cflags
endif
@ -248,6 +231,19 @@ function! s:_get_cflags(ft, ck, opts) abort " {{{2
let config_file = s:_get_checker_var('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
let flags .= ' ' . syntastic#c#ReadConfig(config_file)
if b_cflags ==# '' && (a:ft ==# 'c' || a:ft ==# 'cpp') && !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0)
" refresh the include file search if desired
if s:_get_checker_var('g', a:ft, a:ck, 'auto_refresh_includes', 0)
let flags .= ' ' . s:_search_headers()
else
" search for header includes if not cached already
if !exists('b:syntastic_' . a:ft . '_includes')
let b:syntastic_{a:ft}_includes = s:_search_headers()
endif
let flags .= ' ' . b:syntastic_{a:ft}_includes
endif
endif
return flags
endfunction " }}}2

View File

@ -59,27 +59,51 @@ function! syntastic#preprocess#cppcheck(errors) abort " {{{2
return map(copy(a:errors), 'substitute(v:val, ''\v^\[[^]]+\]\zs( -\> \[[^]]+\])+\ze:'', "", "")')
endfunction " }}}2
" @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null)
function! syntastic#preprocess#flow(errors) abort " {{{2
" JSON artifacts
let true = 1
let false = 0
let null = ''
function! syntastic#preprocess#dockerfile_lint(errors) abort " {{{2
let out = []
let json = s:_decode_JSON(join(a:errors, ''))
if type(json) == type({})
try
let data = json['error']['data'] + json['warn']['data'] + json['info']['data']
for e in data
let type = toupper(e['level'][0])
if type ==# 'I'
let type = 'W'
let style = 1
else
let style = 0
endif
let line = get(e, 'line', 1)
let message = e['message']
if has_key(e, 'description') && e['description'] !=# 'None'
let message = message . '. ' . e['description']
endif
let msg =
\ type . ':' .
\ style . ':' .
\ line . ':' .
\ message
call add(out, msg)
endfor
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format')
let out = []
endtry
else
call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format')
endif
return out
endfunction " }}}2
function! syntastic#preprocess#flow(errors) abort " {{{2
let idx = 0
while idx < len(a:errors) && a:errors[idx][0] != '{'
while idx < len(a:errors) && a:errors[idx][0] !=# '{'
let idx += 1
endwhile
" A hat tip to Marc Weber for this trick
" http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
try
let errs = eval(join(a:errors[idx :], ''))
catch
let errs = {}
endtry
let errs = s:_decode_JSON(join(a:errors[idx :], ''))
let out = []
if type(errs) == type({}) && has_key(errs, 'errors') && type(errs['errors']) == type([])
@ -108,29 +132,26 @@ function! syntastic#preprocess#flow(errors) abort " {{{2
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker javascript/flow: unknown error format')
call syntastic#log#warn('checker javascript/flow: unrecognized error format')
let out = []
break
endtry
else
call syntastic#log#warn('checker javascript/flow: unknown error format')
call syntastic#log#warn('checker javascript/flow: unrecognized error format')
let out = []
break
endif
endfor
else
call syntastic#log#warn('checker javascript/flow: unknown error format')
call syntastic#log#warn('checker javascript/flow: unrecognized error format')
endif
return out
endfunction " }}}2
" @vimlint(EVL102, 0, l:true)
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)
function! syntastic#preprocess#iconv(errors) abort " {{{2
return
\ (has('iconv') || has('iconv/dyn')) && &encoding !=# '' && &encoding !=# 'utf-8' ?
\ has('iconv') && &encoding !=# '' && &encoding !=# 'utf-8' ?
\ map(a:errors, 'iconv(v:val, "utf-8", &encoding)') :
\ a:errors
endfunction " }}}2
@ -152,22 +173,8 @@ function! syntastic#preprocess#perl(errors) abort " {{{2
return syntastic#util#unique(out)
endfunction " }}}2
" @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null)
function! syntastic#preprocess#prospector(errors) abort " {{{2
" JSON artifacts
let true = 1
let false = 0
let null = ''
" A hat tip to Marc Weber for this trick
" http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
try
let errs = eval(join(a:errors, ''))
catch
let errs = {}
endtry
let errs = s:_decode_JSON(join(a:errors, ''))
let out = []
if type(errs) == type({}) && has_key(errs, 'messages')
@ -189,26 +196,23 @@ function! syntastic#preprocess#prospector(errors) abort " {{{2
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker python/prospector: unknown error format')
call syntastic#log#warn('checker python/prospector: unrecognized error format')
let out = []
break
endtry
else
call syntastic#log#warn('checker python/prospector: unknown error format')
call syntastic#log#warn('checker python/prospector: unrecognized error format')
let out = []
break
endif
endfor
else
call syntastic#log#warn('checker python/prospector: unknown error format')
call syntastic#log#warn('checker python/prospector: unrecognized error format')
endif
endif
return out
endfunction " }}}2
" @vimlint(EVL102, 0, l:true)
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)
function! syntastic#preprocess#rparse(errors) abort " {{{2
let errlist = copy(a:errors)
@ -249,6 +253,42 @@ function! syntastic#preprocess#rparse(errors) abort " {{{2
return out
endfunction " }}}2
function! syntastic#preprocess#stylelint(errors) abort " {{{2
let out = []
" CssSyntaxError: /path/to/file.css:2:11: Missed semicolon
let parts = matchlist(a:errors[0], '\v^CssSyntaxError: (.{-1,}):(\d+):(\d+): (.+)')
if len(parts) > 4
call add(out, 'E:' . join(parts[1:4], ':'))
else
let errs = s:_decode_JSON(join(a:errors, ''))
let out = []
if type(errs) == type([]) && len(errs) == 1 && type(errs[0]) == type({}) &&
\ has_key(errs[0], 'source') && has_key(errs[0], 'warnings') && type(errs[0]['warnings']) == type([])
for e in errs[0]['warnings']
try
let msg =
\ ['W', 'E'][e['severity']-1] . ':' .
\ errs[0]['source'] . ':' .
\ e['line'] . ':' .
\ e['column'] . ':' .
\ e['text']
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker css/stylelint: unrecognized error format')
let out = []
break
endtry
endfor
else
call syntastic#log#warn('checker css/stylelint: unrecognized error format')
endif
endif
return out
endfunction " }}}2
function! syntastic#preprocess#tslint(errors) abort " {{{2
return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")')
endfunction " }}}2
@ -268,22 +308,8 @@ function! syntastic#preprocess#validator(errors) abort " {{{2
return out
endfunction " }}}2
" @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null)
function! syntastic#preprocess#vint(errors) abort " {{{2
" JSON artifacts
let true = 1
let false = 0
let null = ''
" A hat tip to Marc Weber for this trick
" http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
try
let errs = eval(join(a:errors, ''))
catch
let errs = []
endtry
let errs = s:_decode_JSON(join(a:errors, ''))
let out = []
if type(errs) == type([])
@ -300,22 +326,166 @@ function! syntastic#preprocess#vint(errors) abort " {{{2
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker vim/vint: unknown error format')
call syntastic#log#warn('checker vim/vint: unrecognized error format')
let out = []
break
endtry
else
call syntastic#log#warn('checker vim/vint: unknown error format')
call syntastic#log#warn('checker vim/vint: unrecognized error format')
let out = []
break
endif
endfor
else
call syntastic#log#warn('checker vim/vint: unknown error format')
call syntastic#log#warn('checker vim/vint: unrecognized error format')
endif
return out
endfunction " }}}2
" }}}1
" Workarounds {{{1
" In errorformat, \ or % following %f make it depend on isfname. The default
" setting of isfname is crafted to work with completion, rather than general
" filename matching. The result for syntastic is that filenames containing
" spaces (or a few other special characters) can't be matched.
"
" Fixing isfname to address this problem would depend on the set of legal
" characters for filenames on the filesystem the project's files lives on.
" Inferring the kind of filesystem a file lives on, in advance to parsing the
" file's name, is an interesting problem (think f.i. a file loaded from a VFAT
" partition, mounted on Linux). A problem syntastic is not prepared to solve.
"
" As a result, the functions below exist for the only reason to avoid using
" things like %f\, in errorformat.
"
" References:
" https://groups.google.com/forum/#!topic/vim_dev/pTKmZmouhio
" https://vimhelp.appspot.com/quickfix.txt.html#error-file-format
function! syntastic#preprocess#basex(errors) abort " {{{2
let out = []
let idx = 0
while idx < len(a:errors)
let parts = matchlist(a:errors[idx], '\v^\[\S+\] Stopped at (.+), (\d+)/(\d+):')
if len(parts) > 3
let err = parts[1] . ':' . parts[2] . ':' . parts[3] . ':'
let parts = matchlist(a:errors[idx+1], '\v^\[(.)\D+(\d+)\] (.+)')
if len(parts) > 3
let err .= (parts[1] ==? 'W' || parts[1] ==? 'E' ? parts[1] : 'E') . ':' . parts[2] . ':' . parts[3]
call add(out, err)
let idx +=1
endif
elseif a:errors[idx] =~# '\m^\['
" unparseable errors
call add(out, a:errors[idx])
endif
let idx +=1
endwhile
return out
endfunction " }}}2
function! syntastic#preprocess#bro(errors) abort " {{{2
let out = []
for e in a:errors
let parts = matchlist(e, '\v^%(fatal )?(error|warning) in (.{-1,}), line (\d+): (.+)')
if len(parts) > 4
let parts[1] = parts[1][0]
call add(out, join(parts[1:4], ':'))
endif
endfor
return out
endfunction " }}}2
function! syntastic#preprocess#coffeelint(errors) abort " {{{2
let out = []
for e in a:errors
let parts = matchlist(e, '\v^(.{-1,}),(\d+)%(,\d*)?,(error|warn),(.+)')
if len(parts) > 4
let parts[3] = parts[3][0]
call add(out, join(parts[1:4], ':'))
endif
endfor
return out
endfunction " }}}2
function! syntastic#preprocess#mypy(errors) abort " {{{2
let out = []
for e in a:errors
" new format
let parts = matchlist(e, '\v^(.{-1,}):(\d+): error: (.+)')
if len(parts) > 3
call add(out, join(parts[1:3], ':'))
continue
endif
" old format
let parts = matchlist(e, '\v^(.{-1,}), line (\d+): (.+)')
if len(parts) > 3
call add(out, join(parts[1:3], ':'))
endif
endfor
return out
endfunction " }}}2
function! syntastic#preprocess#nix(errors) abort " {{{2
let out = []
for e in a:errors
let parts = matchlist(e, '\v^(.{-1,}), at (.{-1,}):(\d+):(\d+)$')
if len(parts) > 4
call add(out, join(parts[2:4], ':') . ':' . parts[1])
continue
endif
let parts = matchlist(e, '\v^(.{-1,}) at (.{-1,}), line (\d+):')
if len(parts) > 3
call add(out, parts[2] . ':' . parts[3] . ':' . parts[1])
continue
endif
let parts = matchlist(e, '\v^error: (.{-1,}), in (.{-1,})$')
if len(parts) > 2
call add(out, parts[2] . ':' . parts[1])
endif
endfor
return out
endfunction " }}}2
" }}}1
" Private functions {{{1
" @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null)
function! s:_decode_JSON(json) abort " {{{2
if a:json ==# ''
return []
endif
" The following is inspired by https://github.com/MarcWeber/vim-addon-manager and
" http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
" A hat tip to Marc Weber for this trick
if substitute(a:json, '\v\"%(\\.|[^"\\])*\"|true|false|null|[+-]?\d+%(\.\d+%([Ee][+-]?\d+)?)?', '', 'g') !~# "[^,:{}[\\] \t]"
" JSON artifacts
let true = 1
let false = 0
let null = ''
try
let object = eval(a:json)
catch
" malformed JSON
let object = ''
endtry
else
let object = ''
endif
return object
endfunction " }}}2
" @vimlint(EVL102, 0, l:true)
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)

View File

@ -107,16 +107,16 @@ function! syntastic#util#rmrf(what) abort " {{{2
endif
endfunction " }}}2
"search the first 5 lines of the file for a magic number and return a map
"containing the args and the executable
" Search the first 5 lines of the file for a magic number and return a map
" containing the args and the executable
"
"e.g.
" e.g.
"
"#!/usr/bin/perl -f -bar
" #!/usr/bin/perl -f -bar
"
"returns
" returns
"
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
" {'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
function! syntastic#util#parseShebang() abort " {{{2
for lnum in range(1, 5)
let line = getline(lnum)
@ -183,7 +183,7 @@ function! syntastic#util#screenWidth(str, tabstop) abort " {{{2
return width
endfunction " }}}2
"print as much of a:msg as possible without "Press Enter" prompt appearing
" Print as much of a:msg as possible without "Press Enter" prompt appearing
function! syntastic#util#wideMsg(msg) abort " {{{2
let old_ruler = &ruler
let old_showcmd = &showcmd
@ -226,7 +226,7 @@ function! syntastic#util#bufIsActive(buffer) abort " {{{2
return 0
endfunction " }}}2
" start in directory a:where and walk up the parent folders until it finds a
" Start in directory a:where and walk up the parent folders until it finds a
" file named a:what; return path to that file
function! syntastic#util#findFileInParent(what, where) abort " {{{2
let old_suffixesadd = &suffixesadd
@ -236,7 +236,7 @@ function! syntastic#util#findFileInParent(what, where) abort " {{{2
return file
endfunction " }}}2
" start in directory a:where and walk up the parent folders until it finds a
" Start in directory a:where and walk up the parent folders until it finds a
" file matching a:what; return path to that file
function! syntastic#util#findGlobInParent(what, where) abort " {{{2
let here = fnamemodify(a:where, ':p')
@ -303,7 +303,7 @@ function! syntastic#util#argsescape(opt) abort " {{{2
return []
endfunction " }}}2
" decode XML entities
" Decode XML entities
function! syntastic#util#decodeXMLEntities(string) abort " {{{2
let str = a:string
let str = substitute(str, '\m&lt;', '<', 'g')
@ -339,6 +339,87 @@ function! syntastic#util#stamp() abort " {{{2
return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' )
endfunction " }}}2
let s:_wid_base = 'syntastic_' . getpid() . '_' . reltimestr(g:_SYNTASTIC_START) . '_'
let s:_wid_pool = 0
" Add unique IDs to windows
function! syntastic#util#setWids() abort " {{{2
for tab in range(1, tabpagenr('$'))
for win in range(1, tabpagewinnr(tab, '$'))
if gettabwinvar(tab, win, 'syntastic_wid') ==# ''
call settabwinvar(tab, win, 'syntastic_wid', s:_wid_base . s:_wid_pool)
let s:_wid_pool += 1
endif
endfor
endfor
endfunction " }}}2
let s:_str2float = function(exists('*str2float') ? 'str2float' : 'str2nr')
lockvar s:_str2float
function! syntastic#util#str2float(val) abort " {{{2
return s:_str2float(a:val)
endfunction " }}}2
function! syntastic#util#float2str(val) abort " {{{2
return s:_float2str(a:val)
endfunction " }}}2
" Crude printf()-like width formatter. Handles wide characters.
function! syntastic#util#wformat(format, str) abort " {{{2
if a:format ==# ''
return a:str
endif
echomsg string(a:format) . ', ' . string(a:str)
let specs = matchlist(a:format, '\v^(-?)(0?)(%([1-9]\d*))?%(\.(\d+))?$')
if len(specs) < 5
return a:str
endif
let flushleft = specs[1] ==# '-'
let lpad = specs[2] ==# '0' ? '0' : ' '
let minlen = str2nr(specs[3])
let maxlen = str2nr(specs[4])
let out = substitute(a:str, "\t", ' ', 'g')
if maxlen && s:_width(out) > maxlen
let chars = filter(split(out, '\zs\ze', 1), 'v:val !=# ""')
let out = ''
if flushleft
for c in chars
if s:_width(out . c) < maxlen
let out .= c
else
let out .= &encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '>'
break
endif
endfor
else
call reverse(chars)
for c in chars
if s:_width(c . out) < maxlen
let out = c . out
else
let out = (&encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '<') . out
break
endif
endfor
endif
endif
if minlen && s:_width(out) < minlen
if flushleft
let out .= repeat(' ', minlen - s:_width(out))
else
let out = repeat(lpad, minlen - s:_width(out)) . out
endif
endif
return out
endfunction " }}}2
" }}}1
" Private functions {{{1
@ -416,6 +497,17 @@ function! s:_rmrf(what) abort " {{{2
endif
endfunction " }}}2
function! s:_float2str_smart(val) abort " {{{2
return printf('%.1f', a:val)
endfunction " }}}2
function! s:_float2str_dumb(val) abort " {{{2
return a:val
endfunction " }}}2
let s:_float2str = function(has('float') ? 's:_float2str_smart' : 's:_float2str_dumb')
lockvar s:_float2str
" }}}1
let &cpo = s:save_cpo

View File

@ -54,7 +54,7 @@ CONTENTS *syntastic-contents*
7.10.vim-go................................|syntastic-vim-go|
7.11.vim-virtualenv........................|syntastic-vim-virtualenv|
7.12.YouCompleteMe.........................|syntastic-ycm|
7.13.The zsh shell and rvm.................|syntastic-zsh|
7.13.The zsh shell and MacVim..............|syntastic-zsh|
8.About........................................|syntastic-about|
9.License......................................|syntastic-license|
@ -86,7 +86,7 @@ checker integrations, see the guide on the GitHub wiki:
1.1. Quick start *syntastic-quickstart*
Syntastic comes preconfigured with a default list of enabled checkers per
filetype. This list is kept reasonably short to prevent slowing down Vim or
|filetype|. This list is kept reasonably short to prevent slowing down Vim or
trying to use conflicting checkers.
You can see the list of checkers available for the current filetype with the
@ -110,10 +110,10 @@ these commands, or perhaps install a plugin such as Tim Pope's 'unimpaired'
------------------------------------------------------------------------------
1.2. Recommended settings *syntastic-recommended*
Syntastic has a large number of options that can be configured, and the
defaults are not particularly well suitable for new users. It is recommended
that you start by adding the following lines to your vimrc, and return to them
later as needed: >
Syntastic has numerous options that can be configured, and the defaults are
not particularly well suitable for new users. It is recommended that you start
by adding the following lines to your vimrc, and return to them later as
needed: >
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
@ -161,13 +161,13 @@ is derived from the |syntastic_stl_format| option.
------------------------------------------------------------------------------
2.2. Error signs *syntastic-error-signs*
Syntastic uses the |:sign| commands to mark lines with errors and warnings in
the sign column. To enable this feature, use the |'syntastic_enable_signs'|
option.
Syntastic uses the |:sign| commands (provided that the |+signs| feature is
compiled in) to mark lines with errors and warnings in the sign column. To
enable this feature, use the |'syntastic_enable_signs'| option.
Signs are colored using the Error and Todo syntax highlight groups by default.
If you wish to customize the colors for the signs, you can use the following
groups:
Signs are colored using the Error and Todo syntax highlight groups by default
(see |group-name|). If you wish to customize the colors for the signs, you
can use the following groups:
SyntasticErrorSign - For syntax errors, links to 'error' by default
SyntasticWarningSign - For syntax warnings, links to 'todo' by default
SyntasticStyleErrorSign - For style errors, links to 'SyntasticErrorSign'
@ -194,17 +194,13 @@ Example: >
You can use the |:Errors| command to display the errors for the current buffer
in the |location-list|.
Note that when you use |:Errors| the current location list is overwritten with
Syntastic's own location list. The location list is also overwritten when
|syntastic_auto_jump| is non-zero and the cursor has to jump to an issue.
By default syntastic doesn't fill the |location-list| with the errors found by
the checkers, in order to reduce clashes with other plugins. Consequently, if
you run |:lopen| or |:lwindow| rather than |:Errors| to open the error window you
wouldn't see syntastic's list of errors. If you insist on using |:lopen| or
|:lwindow| you should either run |:SyntasticSetLoclist| after running the checks,
or set |syntastic_always_populate_loc_list| which tells syntastic to update the
|location-list| automatically.
you run |:lopen| or |:lwindow| rather than |:Errors| to open the error window
you wouldn't see syntastic's list of errors. If you insist on using |:lopen|
or |:lwindow| you should either run |:SyntasticSetLoclist| after running the
checks, or set |syntastic_always_populate_loc_list| which tells syntastic to
update the |location-list| automatically.
------------------------------------------------------------------------------
2.4. Error highlighting *syntastic-highlighting*
@ -251,7 +247,8 @@ You can selectively disable some of the errors found by checkers either
using |'syntastic_quiet_messages'|, or by specifying a list of patterns in
|'syntastic_ignore_files'|.
See also: |'syntastic_<filetype>_<checker>_quiet_messages'|.
See also: |'syntastic_<filetype>_<checker>_quiet_messages'| and
|'b:syntastic_skip_checks'|.
==============================================================================
3. Commands *syntastic-commands*
@ -273,15 +270,15 @@ for more info.
Manually cause a syntax check to be done. By default the checkers in the
|'g:syntastic_<filetype>_checkers'| or |'b:syntastic_checkers'| lists are run,
cf. |syntastic-filetype-checkers|. If |syntastic_aggregate_errors| is unset
cf. |syntastic-filetype-checkers|. If |'syntastic_aggregate_errors'| is unset
(which is the default), checking stops the first time a checker reports any
errors; if |syntastic_aggregate_errors| is set, all checkers that apply are run
in turn, and all errors found are aggregated in a single list.
errors; if |'syntastic_aggregate_errors'| is set, all checkers that apply are
run in turn, and all errors found are aggregated in a single list.
The command may be followed by a (space separated) list of checkers. In this
case |'g:syntastic_<filetype>_checkers'| and |'b:syntastic_checkers'| are
ignored, and the checkers named by the command's arguments are run instead, in
the order specified. The rules of |syntastic_aggregate_errors| still apply.
the order specified. The set by |'syntastic_aggregate_errors'| still apply.
Example: >
:SyntasticCheck flake8 pylint
@ -301,24 +298,23 @@ Resets the list of errors and turns off all error notifiers.
If |'syntastic_always_populate_loc_list'| is not set, the |location-list| is
not filled in automatically with the list of errors detected by the checkers.
This is useful if you run syntastic along with other plugins that use location
lists. The |:SyntasticSetLoclist| command allows you to stick the errors into
lists. The |:SyntasticSetLoclist| command allows you to stick the errors into
the location list explicitly.
==============================================================================
4. Global Options *syntastic-global-options*
*'syntastic_check_on_open'*
Default: 0
If enabled, syntastic will do syntax checks when buffers are first loaded as
well as on saving >
If this variable is enabled, syntastic in active mode will run syntax checks
when buffers are first loaded, as well as on saving: >
let g:syntastic_check_on_open = 1
<
*'syntastic_check_on_wq'*
Default: 1
Normally syntastic runs syntax checks whenever buffers are written to disk.
If you want to skip these checks when you issue |:wq|, |:x|, and |:ZZ|, set this
variable to 0. >
In active mode syntax checks are normally run whenever buffers are written to
disk, even when the writes happen just before quitting Vim. If you want to
skip checks when you issue |:wq|, |:x|, and |:ZZ|, set this variable to 0: >
let g:syntastic_check_on_wq = 0
<
*'syntastic_aggregate_errors'*
@ -332,36 +328,37 @@ time a checker finds any errors. >
*'syntastic_id_checkers'*
Default: 1
When results from multiple checkers are aggregated in a single error list
(that is either when |syntastic_aggregate_errors| is enabled, or when checking
a file with a composite filetype), it might not be immediately obvious which
checker has produced a given error message. This variable instructs syntastic
to label error messages with the names of the checkers that created them. >
(that is either when |'syntastic_aggregate_errors'| is enabled, or when
checking a file with a composite filetype), it might not be immediately
obvious which checker has produced a given error message. This variable
instructs syntastic to label error messages with the names of the checkers
that created them. >
let g:syntastic_id_checkers = 0
<
*'syntastic_sort_aggregated_errors'*
Default: 1
By default, when results from multiple checkers are aggregated in a single
error list (that is either when |syntastic_aggregate_errors| is enabled, or
when checking a file with a composite filetype), errors are grouped by file,
then sorted by line number, then grouped by type (namely errors take precedence
over warnings), then they are sorted by column number. If you want to leave
messages grouped by checker output, set this variable to 0. >
error list (that is either when |'syntastic_aggregate_errors'| is enabled,
or when checking a file with a composite filetype), errors are grouped by
file, then sorted by line number, then grouped by type (namely errors take
precedence over warnings), then they are sorted by column number. If you want
to leave messages grouped by checker output, set this variable to 0: >
let g:syntastic_sort_aggregated_errors = 0
<
*'syntastic_echo_current_error'*
Default: 1
If enabled, syntastic will echo current error to the command window. If
multiple errors are found on the same line, |syntastic_cursor_columns| is used
to decide which one is shown. >
multiple errors are found on the same line, |'syntastic_cursor_columns'| is
used to decide which one is shown. >
let g:syntastic_echo_current_error = 1
<
*'syntastic_cursor_columns'*
Default: 1
This option controls which errors are echoed to the command window if
|syntastic_echo_current_error| is set and multiple errors are found on the same
line. When the option is enabled, the first error corresponding to the current
column is show. Otherwise, the first error on the current line is echoed,
regardless of the cursor position on the current line.
|'syntastic_echo_current_error'| is set and multiple errors are found on the
same line. When the option is enabled, the first error corresponding to the
current column is shown. Otherwise, the first error on the current line is
echoed, regardless of the cursor position on the current line.
When dealing with very large lists of errors, disabling this option can speed
up navigation significantly: >
@ -402,10 +399,17 @@ errors (where possible). Highlighting can be turned off with the following >
<
*'syntastic_always_populate_loc_list'*
Default: 0
Enable this option to tell syntastic to always stick any detected errors into
the |location-list|: >
By default syntastic doesn't fill the |location-list| with the errors found
by the checkers, in order to reduce clashes with other plugins. Enable this
option to tell syntastic to always stick any detected errors into the
|location-list|: >
let g:syntastic_always_populate_loc_list = 1
<
Please note that if |'syntastic_auto_jump'| is set to a non-zero value the
location list is overwritten with Syntastic's own list when taking a jump,
regardless of the value of |'syntastic_always_populate_loc_list'|. The
location list is also overwritten when running the |:Errors| command.
*'syntastic_auto_jump'*
Default: 0
Enable this option if you want the cursor to jump to the first detected issue
@ -426,6 +430,10 @@ When set to 3 the cursor will jump to the first error detected, if any. If
all issues detected are warnings, the cursor won't jump. >
let g:syntastic_auto_jump = 3
<
Please note that in either situation taking the jump also has the side effect
of the location list being overwritten with Syntastic's own location list,
regardless of the value of |'syntastic_always_populate_loc_list'|.
*'syntastic_auto_loc_list'*
Default: 2
Use this option to tell syntastic to automatically open and/or close the
@ -452,8 +460,8 @@ opens. >
Default: []
Use this option to specify files that syntastic should never check. It's a
list of |regular-expression| patterns. The full paths of files (see |::p|) are
matched against these patterns, and the matches are case sensitive. Use |\c|
to specify case insensitive patterns. Example: >
matched against these patterns, and the matches are case-sensitive. Use |\c|
to specify case-insensitive patterns. Example: >
let g:syntastic_ignore_files = ['\m^/usr/include/', '\m\c\.h$']
<
*'syntastic_filetype_map'*
@ -528,10 +536,10 @@ overriding filters, cf. |filter-overrides|).
"level" - takes one of two values, "warnings" or "errors"
"type" - can be either "syntax" or "style"
"regex" - is matched against the messages' text as a case insensitive
"regex" - is matched against the messages' text as a case-insensitive
|regular-expression|
"file" - is matched against the filenames the messages refer to, as a
case sensitive |regular-expression|.
case-sensitive |regular-expression|.
If a key is prefixed by an exclamation mark "!", the corresponding filter is
negated (i.e. the above example silences all messages that are NOT errors).
@ -565,12 +573,25 @@ ones produced by "pylint": >
Default: [Syntax: line:%F (%t)]
Use this option to control what the syntastic statusline text contains. Several
magic flags are available to insert information:
%e - number of errors
%w - number of warnings
%t - total number of warnings and errors
%e - number of errors
%w - number of warnings
%t - total number of warnings and errors
%ne - filename of file containing first error
%nw - filename of file containing first warning
%N - filename of file containing first warning or error
%pe - filename with path of file containing first error
%pw - filename with path of file containing first warning
%P - filename with path of file containing first warning or error
%fe - line number of first error
%fw - line number of first warning
%F - line number of first warning or error
%F - line number of first warning or error
These flags accept width and alignment controls similar to the ones used by
|'statusline'| flags:
%-0{minwid}.{maxwid}{flag}
All fields except {flag} are optional. A single percent sign can be given as
"%%".
Several additional flags are available to hide text under certain conditions:
%E{...} - hide the text in the brackets unless there are errors
@ -612,7 +633,6 @@ The above variable can be used to disable exit code checks in syntastic.
*'syntastic_shell'*
Default: Vim's 'shell'
This is the (full path to) the shell syntastic will use to run the checkers.
On UNIX and Mac OS-X this shell must accept Bourne-compatible syntax for
file "stdout" and "stderr" redirections ">file" and "2>file". Examples of
@ -624,6 +644,13 @@ operations. It must take care to initialize all environment variables needed
by the checkers you're using. Example: >
let g:syntastic_shell = "/bin/sh"
<
*'syntastic_nested_autocommands'*
Default: 0
Controls whether syntastic's autocommands |BufReadPost| and |BufWritePost|
are called from other |BufReadPost| and |BufWritePost| autocommands (see
|autocmd-nested|). This is known to trigger interoperability problems with
other plugins, so only enable it if you actually need that functionality.
*'syntastic_debug'*
Default: 0
Set this to the sum of one or more of the following flags to enable
@ -780,7 +807,7 @@ this variable, that takes precedence over it in the buffers where it is
defined.
For aggregated lists (see |syntastic-aggregating-errors|) these variables are
ignored if |syntastic_sort_aggregated_errors| is set (which is the default).
ignored if |'syntastic_sort_aggregated_errors'| is set (which is the default).
==============================================================================
6. Notes *syntastic-notes*
@ -792,7 +819,7 @@ Some Vim plugins use composite filetypes, such as "django.python" or
"handlebars.html". Normally, syntastic deals with this situation by splitting
the filetype in its simple components, and calling all checkers that apply.
If this behaviour is not desirable, you can disable it by mapping the
composite filetypes to a simple ones using |syntastic_filetype_map|, e.g.: >
composite filetypes to simple ones using |'syntastic_filetype_map'|, e.g.: >
let g:syntastic_filetype_map = { "handlebars.html": "handlebars" }
<
------------------------------------------------------------------------------
@ -809,7 +836,7 @@ checkers, without any translation or conversion.
The 'shellslash' option is relevant only on Windows systems. This option
determines (among other things) the rules for quoting command lines, and there
is no easy way for syntastic to make sure its state is appropriate for your
shell. It should be turned off if your 'shell' (or |g:syntastic_shell|) is
shell. It should be turned off if your 'shell' (or |'syntastic_shell'|) is
"cmd.exe", and on for shells that expect an UNIX-like syntax, such as Cygwin's
"sh". Most checkers will stop working if 'shellslash' is set to the wrong
value.
@ -832,7 +859,7 @@ quickfix windows.
The "csh" and "tcsh" shells are mostly compatible with syntastic. However,
some checkers assume Bourne shell syntax for redirecting "stderr". For this
reason, you should point |g:syntastic_shell| to a Bourne-compatible shell,
reason, you should point |'syntastic_shell'| to a Bourne-compatible shell,
such as "zsh", "bash", "ksh", or even the original Bourne "sh": >
let g:syntastic_shell = "/bin/sh"
<
@ -854,7 +881,7 @@ details.
At the time of this writing the "fish" shell (see http://fishshell.com/)
doesn't support the standard UNIX syntax for file redirections, and thus it
can't be used together with syntastic. You can however set |g:syntastic_shell|
can't be used together with syntastic. You can however set |'syntastic_shell'|
to a more traditional shell, such as "zsh", "bash", "ksh", or even the
original Bourne "sh": >
let g:syntastic_shell = "/bin/sh"
@ -915,9 +942,9 @@ Syntastic can be used along with the "python-mode" Vim plugin (see
https://github.com/klen/python-mode). However, they both run syntax checks by
default when you save buffers to disk, and this is probably not what you want.
To avoid both plugins opening error windows, you can either set passive mode
for python in syntastic (see |syntastic_mode_map|), or disable lint checks in
"python-mode", by setting |pymode_lint_write| to 0. E.g.: >
let g:pymode_lint_write = 0
for python in syntastic (see |'syntastic_mode_map'|), or disable lint checks in
"python-mode", by setting |pymode_lint_on_write| to 0. E.g.: >
let g:pymode_lint_on_write = 0
<
------------------------------------------------------------------------------
7.9. vim-auto-save *syntastic-vim-auto-save*
@ -955,20 +982,19 @@ http://valloric.github.io/YouCompleteMe/). However, by default "YouCompleteMe"
disables syntastic's checkers for the "c", "cpp", "objc", and "objcpp"
filetypes, in order to allow its own checkers to run. If you want to use YCM's
identifier completer but still run syntastic's checkers for those filetypes you
have to set |ycm_show_diagnostics_ui| to 0. E.g.: >
have to set |g:ycm_show_diagnostics_ui| to 0. E.g.: >
let g:ycm_show_diagnostics_ui = 0
<
------------------------------------------------------------------------------
7.13 The zsh shell and rvm *syntastic-zsh*
7.13 The zsh shell and MacVim *syntastic-zsh*
If you're running MacVim together with the "zsh" shell (http://www.zsh.org/)
and "rvm" (https://rvm.io/), you need to be aware that MacVim does not source
the .zshrc file, but will source a .zshenv file. Consequently you have to
either source the "rvm" scripts from within .zshenv, or just change your shell
to something else: >
set shell=/bin/sh
<
Of course, you'll have to make sure "rvm" still works in the new shell.
you need to be aware that MacVim does not source your .zshrc file, but will
source a .zshenv file. Consequently you have to move any setup steps relevant
to the checkers you're using from .zshrc to .zshenv, otherwise your checkers
will misbehave when run by syntastic. This is particularly important for
programs such as "rvm" (https://rvm.io/) or "rbenv" (http://rbenv.org/), that
rely on setting environment variables.
==============================================================================
8. About *syntastic-about*

View File

@ -9,7 +9,7 @@
"
"============================================================================
if exists('g:loaded_syntastic_plugin')
if exists('g:loaded_syntastic_plugin') || &compatible
finish
endif
let g:loaded_syntastic_plugin = 1
@ -19,11 +19,16 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.6.0-122'
let g:_SYNTASTIC_VERSION = '3.7.0-55'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1
if v:version < 700 || (v:version == 700 && !has('patch175'))
call syntastic#log#error('need Vim version 7.0.175 or later')
finish
endif
for s:feature in [
\ 'autocmd',
\ 'eval',
@ -87,6 +92,7 @@ let g:_SYNTASTIC_DEFAULTS = {
\ 'ignore_extensions': '\c\v^([gx]?z|lzma|bz2)$',
\ 'ignore_files': [],
\ 'loc_list_height': 10,
\ 'nested_autocommands': 0,
\ 'quiet_messages': {},
\ 'reuse_loc_lists': 0,
\ 'shell': &shell,
@ -130,7 +136,7 @@ let s:_DEBUG_DUMP_OPTIONS = [
\ 'shelltemp',
\ 'shellxquote'
\ ]
if v:version > 703 || (v:version == 703 && has('patch446'))
if exists('+shellxescape')
call add(s:_DEBUG_DUMP_OPTIONS, 'shellxescape')
endif
lockvar! s:_DEBUG_DUMP_OPTIONS
@ -157,6 +163,8 @@ let s:registry = g:SyntasticRegistry.Instance()
let s:notifiers = g:SyntasticNotifiers.Instance()
let s:modemap = g:SyntasticModeMap.Instance()
let s:_quit_pre = []
" Commands {{{1
" @vimlint(EVL103, 1, a:cursorPos)
@ -184,12 +192,15 @@ endfunction " }}}2
" @vimlint(EVL103, 0, a:cmdLine)
" @vimlint(EVL103, 0, a:argLead)
command! -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck call SyntasticCheck(<f-args>)
command! -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo call SyntasticInfo(<f-args>)
command! Errors call SyntasticErrors()
command! SyntasticReset call SyntasticReset()
command! SyntasticToggleMode call SyntasticToggleMode()
command! SyntasticSetLoclist call SyntasticSetLoclist()
command! -bar -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck call SyntasticCheck(<f-args>)
command! -bar -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo call SyntasticInfo(<f-args>)
command! -bar Errors call SyntasticErrors()
command! -bar SyntasticReset call SyntasticReset()
command! -bar SyntasticToggleMode call SyntasticToggleMode()
command! -bar SyntasticSetLoclist call SyntasticSetLoclist()
command! SyntasticJavacEditClasspath runtime! syntax_checkers/java/*.vim | SyntasticJavacEditClasspath
command! SyntasticJavacEditConfig runtime! syntax_checkers/java/*.vim | SyntasticJavacEditConfig
" }}}1
@ -231,15 +242,26 @@ endfunction " }}}2
" Autocommands {{{1
augroup syntastic
autocmd BufReadPost * call s:BufReadPostHook()
autocmd BufWritePost * call s:BufWritePostHook()
autocmd BufEnter * call s:BufEnterHook()
autocmd!
autocmd BufEnter * call s:BufEnterHook()
augroup END
if v:version > 703 || (v:version == 703 && has('patch544'))
if g:syntastic_nested_autocommands
augroup syntastic
autocmd BufReadPost * nested call s:BufReadPostHook()
autocmd BufWritePost * nested call s:BufWritePostHook()
augroup END
else
augroup syntastic
autocmd BufReadPost * call s:BufReadPostHook()
autocmd BufWritePost * call s:BufWritePostHook()
augroup END
endif
if exists('##QuitPre')
" QuitPre was added in Vim 7.3.544
augroup syntastic
autocmd QuitPre * call s:QuitPreHook()
autocmd QuitPre * call s:QuitPreHook(expand('<amatch>', 1))
augroup END
endif
@ -276,10 +298,15 @@ function! s:BufEnterHook() abort " {{{2
endif
endfunction " }}}2
function! s:QuitPreHook() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: QuitPre, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
function! s:QuitPreHook(fname) abort " {{{2
let buf = bufnr(fnameescape(a:fname))
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, 'autocmd: QuitPre, buffer ' . buf . ' = ' . string(a:fname))
if !syntastic#util#var('check_on_wq')
call syntastic#util#setWids()
call add(s:_quit_pre, buf . '_' . getbufvar(buf, 'changetick') . '_' . w:syntastic_wid)
endif
if get(w:, 'syntastic_loclist_set', 0)
call SyntasticLoclistHide()
endif
@ -296,17 +323,23 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'UpdateErrors' . (a:auto_invoked ? ' (auto)' : '') .
\ ': ' . (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
call s:modemap.synch()
if s:_skip_file()
return
endif
call s:modemap.synch()
let run_checks = !a:auto_invoked || s:modemap.doAutoChecking()
if run_checks
call s:CacheErrors(a:checker_names)
unlockvar! b:syntastic_changedtick
let b:syntastic_changedtick = b:changedtick
lockvar! b:syntastic_changedtick
else
if a:auto_invoked
return
endif
endif
let loclist = g:SyntasticLoclist.current()
@ -610,12 +643,26 @@ function! s:_ignore_file(filename) abort " {{{2
return 0
endfunction " }}}2
function! s:_is_quitting(buf) abort " {{{2
let quitting = 0
if exists('w:syntastic_wid')
let key = a:buf . '_' . getbufvar(a:buf, 'changetick') . '_' . w:syntastic_wid
let idx = index(s:_quit_pre, key)
if idx >= 0
call remove(s:_quit_pre, idx)
let quitting = 1
endif
endif
return quitting
endfunction " }}}2
" Skip running in special buffers
function! s:_skip_file() abort " {{{2
let fname = expand('%', 1)
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype !=# '') ||
\ !filereadable(fname) || getwinvar(0, '&diff') || s:_ignore_file(fname) ||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
let skip = s:_is_quitting(bufnr('%')) || get(b:, 'syntastic_skip_checks', 0) ||
\ (&buftype !=# '') || !filereadable(fname) || getwinvar(0, '&diff') ||
\ s:_ignore_file(fname) || fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
if skip
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, '_skip_file: skipping checks')
endif
@ -628,6 +675,9 @@ function! s:_explain_skip(filetypes) abort " {{{2
let why = []
let fname = expand('%', 1)
if s:_is_quitting(bufnr('%'))
call add(why, 'quitting buffer')
endif
if get(b:, 'syntastic_skip_checks', 0)
call add(why, 'b:syntastic_skip_checks set')
endif

View File

@ -7,26 +7,36 @@ let g:SyntasticChecker = {}
" Public methods {{{1
function! g:SyntasticChecker.New(args) abort " {{{2
function! g:SyntasticChecker.New(args, ...) abort " {{{2
let newObj = copy(self)
let newObj._filetype = a:args['filetype']
let newObj._name = a:args['name']
let newObj._exec = get(a:args, 'exec', newObj._name)
if has_key(a:args, 'redirect')
let [filetype, name] = split(a:args['redirect'], '/')
if a:0
" redirected checker
let newObj._exec = get(a:args, 'exec', a:1['_exec'])
let filetype = a:1['_filetype']
let name = a:1['_name']
let prefix = 'SyntaxCheckers_' . filetype . '_' . name . '_'
if exists('g:syntastic_' . filetype . '_' . name . '_sort') && !exists('g:syntastic_' . newObj._filetype . '_' . newObj._name . '_sort')
let g:syntastic_{newObj._filetype}_{newObj._name}_sort = g:syntastic_{filetype}_{name}_sort
endif
else
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
endif
if has_key(a:args, 'enable')
let newObj._enable = a:args['enable']
if has_key(a:args, 'enable')
let newObj._enable = a:args['enable']
elseif has_key(a:1, '_enable')
let newObj._enable = a:1['_enable']
endif
else
let newObj._exec = get(a:args, 'exec', newObj._name)
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
if has_key(a:args, 'enable')
let newObj._enable = a:args['enable']
endif
endif
let newObj._locListFunc = function(prefix . 'GetLocList')
@ -85,6 +95,11 @@ function! g:SyntasticChecker.getLocListRaw() abort " {{{2
if has_key(self, '_enable')
let status = syntastic#util#var(self._enable, -1)
if type(status) != type(0)
call syntastic#log#error('checker ' . name . ': invalid value ' . strtrans(string(status)) .
\ ' for g:syntastic_' . self._enable . '; try 0 or 1 instead')
return []
endif
if status < 0
call syntastic#log#error('checker ' . name . ': checks disabled for security reasons; ' .
\ 'set g:syntastic_' . self._enable . ' to 1 to override')

View File

@ -110,19 +110,21 @@ function! g:SyntasticLoclist.getStatuslineFlag() abort " {{{2
"hide stuff wrapped in %B(...) unless there are both errors and warnings
let output = substitute(output, '\m\C%B{\([^}]*\)}', (num_warnings && num_errors) ? '\1' : '' , 'g')
"sub in the total errors/warnings/both
let output = substitute(output, '\m\C%w', num_warnings, 'g')
let output = substitute(output, '\m\C%e', num_errors, 'g')
let output = substitute(output, '\m\C%t', num_issues, 'g')
"first error/warning line num
let output = substitute(output, '\m\C%F', num_issues ? self._rawLoclist[0]['lnum'] : '', 'g')
"first error line num
let output = substitute(output, '\m\C%fe', num_errors ? errors[0]['lnum'] : '', 'g')
"first warning line num
let output = substitute(output, '\m\C%fw', num_warnings ? warnings[0]['lnum'] : '', 'g')
let flags = {
\ '%': '%',
\ 't': num_issues,
\ 'e': num_errors,
\ 'w': num_warnings,
\ 'N': (num_issues ? fnamemodify( bufname(self._rawLoclist[0]['bufnr']), ':t') : ''),
\ 'P': (num_issues ? fnamemodify( bufname(self._rawLoclist[0]['bufnr']), ':p:~:.') : ''),
\ 'F': (num_issues ? self._rawLoclist[0]['lnum'] : ''),
\ 'ne': (num_errors ? fnamemodify( bufname(errors[0]['bufnr']), ':t') : ''),
\ 'pe': (num_errors ? fnamemodify( bufname(errors[0]['bufnr']), ':p:~:.') : ''),
\ 'fe': (num_errors ? errors[0]['lnum'] : ''),
\ 'nw': (num_warnings ? fnamemodify( bufname(warnings[0]['bufnr']), ':t') : ''),
\ 'pw': (num_warnings ? fnamemodify( bufname(warnings[0]['bufnr']), ':p:~:.') : ''),
\ 'fw': (num_warnings ? warnings[0]['lnum'] : '') }
let output = substitute(output, '\v\C\%(-?\d*%(\.\d+)?)([npf][ew]|[NPFtew%])', '\=syntastic#util#wformat(submatch(1), flags[submatch(2)])', 'g')
let self._stl_flag = output
else

View File

@ -8,7 +8,8 @@ let g:loaded_syntastic_registry = 1
let s:_DEFAULT_CHECKERS = {
\ 'actionscript': ['mxmlc'],
\ 'ada': ['gcc'],
\ 'apiblueprint': ['snowcrash'],
\ 'ansible': ['ansible_lint'],
\ 'apiblueprint': ['drafter'],
\ 'applescript': ['osacompile'],
\ 'asciidoc': ['asciidoc'],
\ 'asm': ['gcc'],
@ -29,6 +30,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'd': ['dmd'],
\ 'dart': ['dartanalyzer'],
\ 'docbk': ['xmllint'],
\ 'dockerfile': ['dockerfile_lint'],
\ 'dustjs': ['swiffer'],
\ 'elixir': [],
\ 'erlang': ['escript'],
@ -42,6 +44,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'haxe': ['haxe'],
\ 'hss': ['hss'],
\ 'html': ['tidy'],
\ 'jade': ['jade_lint'],
\ 'java': ['javac'],
\ 'javascript': ['jshint', 'jslint'],
\ 'json': ['jsonlint', 'jsonval'],
@ -66,7 +69,9 @@ let s:_DEFAULT_CHECKERS = {
\ 'pod': ['podchecker'],
\ 'puppet': ['puppet', 'puppetlint'],
\ 'python': ['python', 'flake8', 'pylint'],
\ 'qml': ['qmllint'],
\ 'r': [],
\ 'rmd': [],
\ 'racket': ['racket'],
\ 'rnc': ['rnv'],
\ 'rst': ['rst2pseudoxml'],
@ -78,6 +83,8 @@ let s:_DEFAULT_CHECKERS = {
\ 'slim': ['slimrb'],
\ 'sml': ['smlnj'],
\ 'spec': ['rpmlint'],
\ 'sql': ['sqlint'],
\ 'stylus': ['stylint'],
\ 'tcl': ['nagelfar'],
\ 'tex': ['lacheck', 'chktex'],
\ 'texinfo': ['makeinfo'],
@ -91,6 +98,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'xhtml': ['tidy'],
\ 'xml': ['xmllint'],
\ 'xslt': ['xmllint'],
\ 'xquery': ['basex'],
\ 'yacc': ['bison'],
\ 'yaml': ['jsyaml'],
\ 'z80': ['z80syntaxchecker'],
@ -151,8 +159,21 @@ function! g:SyntasticRegistry.Instance() abort " {{{2
endfunction " }}}2
function! g:SyntasticRegistry.CreateAndRegisterChecker(args) abort " {{{2
let checker = g:SyntasticChecker.New(a:args)
let registry = g:SyntasticRegistry.Instance()
if has_key(a:args, 'redirect')
let [ft, name] = split(a:args['redirect'], '/')
call registry._loadCheckersFor(ft)
let clone = get(registry._checkerMap[ft], name, {})
if empty(clone)
throw 'Syntastic: Checker ' . a:args['redirect'] . ' redirects to unregistered checker ' . ft . '/' . name
endif
let checker = g:SyntasticChecker.New(a:args, clone)
else
let checker = g:SyntasticChecker.New(a:args)
endif
call registry._registerChecker(checker)
endfunction " }}}2
@ -187,7 +208,7 @@ function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) abort "
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()')
endfunction " }}}2
" Same as getCheckers(), but keep only the checkers tyhat are available and
" Same as getCheckers(), but keep only the checkers that are available and
" disabled. This runs the corresponding IsAvailable() functions for all checkers.
function! g:SyntasticRegistry.getCheckersDisabled(ftalias, hints_list) abort " {{{2
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isDisabled() && v:val.isAvailable()')

View File

@ -0,0 +1,52 @@
"============================================================================
"File: ansible_lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Erik Zaadi <erik.zaadi at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_ansible_ansible_lint_checker')
finish
endif
let g:loaded_syntastic_ansible_ansible_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_ansible_ansible_lint_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 0, 4])
endfunction
function! SyntaxCheckers_ansible_ansible_lint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-p' })
let errorformat = '%f:%l: [ANSIBLE%n] %m'
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'defaults': {'type': 'E'},
\ 'subtype': 'Style',
\ 'returns': [0, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'ansible',
\ 'name': 'ansible_lint',
\ 'exec': 'ansible-lint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -1,5 +1,5 @@
"============================================================================
"File: snowcrash.vim
"File: drafter.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
@ -10,19 +10,19 @@
"
"============================================================================
if exists('g:loaded_syntastic_apiblueprint_snowcrash_checker')
if exists('g:loaded_syntastic_apiblueprint_drafter_checker')
finish
endif
let g:loaded_syntastic_apiblueprint_snowcrash_checker = 1
let g:loaded_syntastic_apiblueprint_drafter_checker = 1
if !exists('g:syntastic_apiblueprint_snowcrash_sort')
let g:syntastic_apiblueprint_snowcrash_sort = 1
if !exists('g:syntastic_apiblueprint_drafter_sort')
let g:syntastic_apiblueprint_drafter_sort = 1
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_apiblueprint_snowcrash_GetLocList() dict
function! SyntaxCheckers_apiblueprint_drafter_GetLocList() dict
let makeprg = self.makeprgBuild({ 'post_args': '-u -l' })
let errorformat =
@ -34,7 +34,7 @@ function! SyntaxCheckers_apiblueprint_snowcrash_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 2] })
\ 'returns': [0, 2, 3, 4] })
for e in loclist
let matches = matchlist(e['text'], '\v^(.+); line (\d+), column (\d+) - line (\d+), column (\d+)$')
@ -58,7 +58,7 @@ endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'apiblueprint',
\ 'name': 'snowcrash'})
\ 'name': 'drafter'})
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -19,6 +19,10 @@ if !exists('g:syntastic_asm_compiler_options')
let g:syntastic_asm_compiler_options = ''
endif
if !exists('g:syntastic_asm_generic')
let g:syntastic_asm_generic = 0
endif
let s:save_cpo = &cpo
set cpo&vim
@ -36,14 +40,13 @@ function! SyntaxCheckers_asm_gcc_GetLocList() dict " {{{1
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l: %m',
\ 'main_flags': '-x assembler -fsyntax-only -masm=' . s:GetDialect() })
\ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect()) })
endfunction " }}}1
" Utilities {{{1
function! s:GetDialect() " {{{2
return exists('g:syntastic_asm_dialect') ? g:syntastic_asm_dialect :
\ expand('%:e', 1) ==? 'asm' ? 'intel' : 'att'
return syntastic#util#var('asm_dialect', expand('%:e', 1) ==? 'asm' ? 'intel' : 'att')
endfunction " }}}2
" }}}1

View File

@ -40,14 +40,12 @@ function! SyntaxCheckers_bro_bro_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_before': '--parse-only' })
"example: error in ./foo.bro, line 3: unknown identifier banana, at or near "banana"
let errorformat =
\ 'fatal %trror in %f\, line %l: %m,' .
\ '%trror in %f\, line %l: %m,' .
\ '%tarning in %f\, line %l: %m'
let errorformat = '%t:%f:%l:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
\ 'errorformat': errorformat,
\ 'preprocess': 'bro' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -43,9 +43,12 @@ function! SyntaxCheckers_c_clang_check_GetLocList() dict
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
\ '%E%m'
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
endfunction

View File

@ -43,9 +43,12 @@ function! SyntaxCheckers_c_clang_tidy_GetLocList() dict
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
\ '%E%m'
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
endfunction

View File

@ -24,17 +24,14 @@ function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict
endif
let makeprg = self.makeprgBuild({ 'args_after': (s:coffeelint_new ? '--reporter csv' : '--csv') })
let errorformat =
\ '%f\,%l\,%\d%#\,%trror\,%m,' .
\ '%f\,%l\,%trror\,%m,' .
\ '%f\,%l\,%\d%#\,%tarn\,%m,' .
\ '%f\,%l\,%tarn\,%m'
let errorformat = '%f:%l:%t:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
\ 'returns': [0, 1],
\ 'preprocess': 'coffeelint' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -22,7 +22,7 @@ function! SyntaxCheckers_coq_coqtop_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-noglob -batch -load-vernac-source' })
let errorformat =
\ '%AFile \"%f\"\, line %l\, characters %c\-%.%#\:,'.
\ '%AFile "%f"\, line %l\, characters %c-%.%#\:,'.
\ '%C%m'
return SyntasticMake({

View File

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_cpp_clang_check_checker')
endif
let g:loaded_syntastic_cpp_clang_check_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'clang_check',

View File

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_cpp_clang_tidy_checker')
endif
let g:loaded_syntastic_cpp_clang_tidy_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'clang_tidy',

View File

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_cpp_cppcheck_checker')
endif
let g:loaded_syntastic_cpp_cppcheck_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'cppcheck',

View File

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_cpp_oclint_checker')
endif
let g:loaded_syntastic_cpp_oclint_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'oclint',

View File

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_cpp_pc_lint_checker')
endif
let g:loaded_syntastic_cpp_pc_lint_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'pc_lint',

View File

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_css_phpcs_checker')
endif
let g:loaded_syntastic_css_phpcs_checker = 1
runtime! syntax_checkers/php/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'phpcs',

View File

@ -16,8 +16,6 @@ if exists('g:loaded_syntastic_css_recess_checker')
endif
let g:loaded_syntastic_css_recess_checker = 1
runtime! syntax_checkers/less/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'recess',

View File

@ -0,0 +1,43 @@
"============================================================================
"File: stylelint.vim
"Description: Syntax checking plugin for syntastic.vim using `stylelint`
" (https://github.com/stylelint/stylelint).
"Maintainer: Tim Carry <tim at pixelastic dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_css_stylelint_checker')
finish
endif
let g:loaded_syntastic_css_stylelint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_css_stylelint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-f json' })
let errorformat = '%t:%f:%l:%c:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'preprocess': 'stylelint',
\ 'returns': [0, 1, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'stylelint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_docbk_xmllint_checker')
endif
let g:loaded_syntastic_docbk_xmllint_checker = 1
runtime! syntax_checkers/xml/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'docbk',
\ 'name': 'xmllint',

View File

@ -0,0 +1,53 @@
"============================================================================
"File: dockerfile_lint.vim
"Description: Syntax checking plugin for syntastic.vim using dockerfile-lint
" (https://github.com/projectatomic/dockerfile-lint).
"Maintainer: Tim Carry <tim at pixelastic dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_dockerfile_dockerfile_lint_checker')
finish
endif
let g:loaded_syntastic_dockerfile_dockerfile_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_dockerfile_dockerfile_lint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '-j',
\ 'fname_before': '-f' })
let errorformat = '%t:%n:%l:%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'dockerfile_lint',
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
for e in loclist
if e['nr']
let e['subtype'] = 'Style'
endif
call remove(e, 'nr')
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'dockerfile',
\ 'name': 'dockerfile_lint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -27,6 +27,10 @@ function! SyntaxCheckers_go_go_IsAvailable() dict
endfunction
function! SyntaxCheckers_go_go_GetLocList() dict
if !exists('s:go_new')
let s:go_new = syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [1, 5])
endif
" Check with gofmt first, since `go build` and `go test` might not report
" syntax errors in the current file if another file with syntax error is
" compiled first.
@ -51,15 +55,15 @@ function! SyntaxCheckers_go_go_GetLocList() dict
" compiled by `go build`, therefore `go test` must be called for those.
if match(expand('%', 1), '\m_test\.go$') == -1
let cmd = 'build'
let opts = syntastic#util#var('go_go_build_args')
let opts = syntastic#util#var('go_go_build_args', s:go_new ? '-buildmode=archive' : '')
let cleanup = 0
else
let cmd = 'test -c'
let opts = syntastic#util#var('go_go_test_args')
let opts = syntastic#util#var('go_go_test_args', s:go_new ? '-buildmode=archive' : '')
let cleanup = 1
endif
let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts
let makeprg = self.getExec() . ' ' . cmd . ' ' . opt_str
let makeprg = self.getExecEscaped() . ' ' . cmd . ' ' . opt_str
" The first pattern is for warnings from C compilers.
let errorformat =
@ -67,6 +71,8 @@ function! SyntaxCheckers_go_go_GetLocList() dict
\ '%E%f:%l:%c:%m,' .
\ '%E%f:%l:%m,' .
\ '%C%\s%\+%m,' .
\ '%+Ecan''t load package: %m,' .
\ '%+Einternal error: %m,' .
\ '%-G#%.%#'
" The go compiler needs to either be run with an import path as an
@ -77,6 +83,7 @@ function! SyntaxCheckers_go_go_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'cwd': expand('%:p:h', 1),
\ 'env': {'GOGC': 'off'},
\ 'defaults': {'type': 'e'} })
if cleanup

View File

@ -0,0 +1,53 @@
"============================================================================
"File: gometalinter.vim
"Description: Check go syntax using 'gometalint'
"Maintainer: Joshua Rubin <joshua@rubixconsulting.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_go_gometalinter_checker')
finish
endif
let g:loaded_syntastic_go_gometalinter_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_go_gometalinter_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': '-t',
\ 'fname': syntastic#util#shexpand('%:p:h') })
let errorformat =
\ '%f:%l:%c:%trror: %m,' .
\ '%f:%l:%c:%tarning: %m,' .
\ '%f:%l::%trror: %m,' .
\ '%f:%l::%tarning: %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 1] })
for e in loclist
if e['text'] =~# '\v\(%(deadcode|gocyclo|golint|defercheck|varcheck|structcheck|errcheck|dupl)\)$'
let e['subtype'] = 'Style'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'go',
\ 'name': 'gometalinter'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -19,7 +19,9 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_go_gotype_GetLocList() dict
let makeprg = self.getExecEscaped() . ' .'
let makeprg = self.makeprgBuild({
\ 'args': (expand('%', 1) =~# '\m_test\.go$' ? '-a' : ''),
\ 'fname': '.' })
let errorformat =
\ '%f:%l:%c: %m,' .

View File

@ -23,7 +23,7 @@ function! SyntaxCheckers_go_govet_IsAvailable() dict
endfunction
function! SyntaxCheckers_go_govet_GetLocList() dict
let makeprg = self.getExec() . ' vet'
let makeprg = self.getExecEscaped() . ' vet'
let errorformat =
\ '%Evet: %.%\+: %f:%l:%c: %m,' .

View File

@ -51,7 +51,14 @@ function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
let s:ghc_mod_new = -1
endif
return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new)
" ghc-mod 5.4.0 wants to run in the root directory of the project;
" syntastic can't cope with the resulting complications
"
" References:
" https://hackage.haskell.org/package/ghc-mod-5.4.0.0/changelog
let s:ghc_mod_bailout = syntastic#util#versionIsAtLeast(parsed_ver, [5, 4])
return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new) && !s:ghc_mod_bailout
endfunction
function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict

View File

@ -18,6 +18,7 @@ function! SyntaxCheckers_haskell_hlint_GetLocList() dict
\ 'fname': syntastic#util#shexpand('%:p')})
let errorformat =
\ '%E%f:%l:%v: Error while reading hint file\, %m,' .
\ '%E%f:%l:%v: Error: %m,' .
\ '%W%f:%l:%v: Warning: %m,' .
\ '%C%m'

View File

@ -0,0 +1,40 @@
"============================================================================
"File: jade_lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Ben Parnell <benjaminparnell.94@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_jade_jade_lint_checker')
finish
endif
let g:loaded_syntastic_jade_jade_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_jade_jade_lint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-r inline' })
let errorformat = '%f:%l:%c %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'jade',
\ 'name': 'jade_lint',
\ 'exec': 'jade-lint' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -17,7 +17,7 @@ endif
let g:loaded_syntastic_java_checkstyle_checker = 1
if !exists('g:syntastic_java_checkstyle_classpath')
let g:syntastic_java_checkstyle_classpath = 'checkstyle-5.5-all.jar'
let g:syntastic_java_checkstyle_classpath = 'checkstyle-6.10.1-all.jar'
endif
if !exists('g:syntastic_java_checkstyle_conf_file')
@ -32,30 +32,38 @@ function! SyntaxCheckers_java_checkstyle_IsAvailable() dict
return 0
endif
let classpath = expand(g:syntastic_java_checkstyle_classpath, 1)
let conf_file = expand(g:syntastic_java_checkstyle_conf_file, 1)
call self.log(
\ 'filereadable(' . string(classpath) . ') = ' . filereadable(classpath) . ', ' .
\ 'filereadable(' . string(conf_file) . ') = ' . filereadable(conf_file))
call self.log('filereadable(' . string(conf_file) . ') = ' . filereadable(conf_file))
return filereadable(classpath) && filereadable(conf_file)
return filereadable(conf_file)
endfunction
function! SyntaxCheckers_java_checkstyle_GetLocList() dict
let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) )
" classpath
if !exists('s:sep')
let s:sep = syntastic#util#isRunningWindows() || has('win32unix') ? ';' : ':'
endif
let classpath = join(map( split(g:syntastic_java_checkstyle_classpath, s:sep, 1), 'expand(v:val, 1)' ), s:sep)
call self.log('classpath =', classpath)
" forced options
let opts = []
if classpath !=# ''
call extend(opts, ['-cp', classpath])
endif
call extend(opts, [
\ 'com.puppycrawl.tools.checkstyle.Main',
\ '-c', expand(g:syntastic_java_checkstyle_conf_file, 1),
\ '-f', 'xml' ])
" filename
let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) )
if has('win32unix')
let fname = substitute(syntastic#util#system('cygpath -m ' . fname), '\m\%x00', '', 'g')
endif
let makeprg = self.makeprgBuild({
\ 'args_after': [
\ '-cp', expand(g:syntastic_java_checkstyle_classpath, 1),
\ 'com.puppycrawl.tools.checkstyle.Main',
\ '-c', expand(g:syntastic_java_checkstyle_conf_file, 1),
\ '-f', 'xml'],
\ 'fname': fname })
let makeprg = self.makeprgBuild({ 'args_after': opts, 'fname': fname })
let errorformat = '%f:%t:%l:%c:%m'

View File

@ -84,11 +84,12 @@ lockvar! s:_FILE_SHORTCUTS
" }}}1
command! SyntasticJavacEditClasspath call s:EditClasspath()
" Commands {{{1
if g:syntastic_java_javac_config_file_enabled
command! SyntasticJavacEditConfig call s:EditConfig()
endif
command! SyntasticJavacEditClasspath call s:EditClasspath()
command! SyntasticJavacEditConfig call s:EditConfig()
" }}}1
function! SyntaxCheckers_java_javac_IsAvailable() dict " {{{1
let s:has_maven = executable(expand(g:syntastic_java_maven_executable, 1))
@ -173,9 +174,8 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
let errorformat =
\ '%E%f:%l: error: %m,'.
\ '%W%f:%l: warning: %m,'.
\ '%A%f:%l: %m,'.
\ '%+Z%p^,'.
\ '%+C%.%#,'.
\ '%E%f:%l: %m,'.
\ '%Z%p^,'.
\ '%-G%.%#'
if output_dir !=# ''
@ -290,6 +290,10 @@ function! s:SaveConfig() " {{{2
endfunction " }}}2
function! s:EditConfig() " {{{2
if !g:syntastic_java_javac_config_file_enabled
return
endif
let command = 'syntastic javac config'
let winnr = bufwinnr('^' . command . '$')
if winnr < 0
@ -356,7 +360,7 @@ function! s:GetMavenClasspath() " {{{2
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
\ ' -f ' . syntastic#util#shescape(pom) .
\ ' ' . g:syntastic_java_maven_options
let mvn_classpath_output = split(syntastic#util#system(mvn_cmd . ' dependency:build-classpath'), "\n")
let mvn_classpath_output = split(syntastic#util#system(mvn_cmd . ' dependency:build-classpath -DincludeScope=test'), "\n")
let mvn_classpath = ''
let class_path_next = 0
@ -373,16 +377,10 @@ function! s:GetMavenClasspath() " {{{2
let mvn_properties = s:GetMavenProperties()
let sep = syntastic#util#Slash()
let output_dir = join(['target', 'classes'], sep)
if has_key(mvn_properties, 'project.build.outputDirectory')
let output_dir = mvn_properties['project.build.outputDirectory']
endif
let output_dir = get(mvn_properties, 'project.build.outputDirectory', join(['target', 'classes'], sep))
let mvn_classpath = s:AddToClasspath(mvn_classpath, output_dir)
let test_output_dir = join(['target', 'test-classes'], sep)
if has_key(mvn_properties, 'project.build.testOutputDirectory')
let test_output_dir = mvn_properties['project.build.testOutputDirectory']
endif
let test_output_dir = get(mvn_properties, 'project.build.testOutputDirectory', join(['target', 'test-classes'], sep))
let mvn_classpath = s:AddToClasspath(mvn_classpath, test_output_dir)
let g:syntastic_java_javac_maven_pom_ftime[pom] = getftime(pom)
@ -397,23 +395,16 @@ function! s:MavenOutputDirectory() " {{{2
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
if s:has_maven && filereadable(pom)
let mvn_properties = s:GetMavenProperties()
let output_dir = getcwd()
if has_key(mvn_properties, 'project.properties.build.dir')
let output_dir = mvn_properties['project.properties.build.dir']
endif
let output_dir = get(mvn_properties, 'project.properties.build.dir', getcwd())
let sep = syntastic#util#Slash()
if stridx(expand('%:p:h', 1), join(['src', 'main', 'java'], sep)) >= 0
let output_dir = join ([output_dir, 'target', 'classes'], sep)
if has_key(mvn_properties, 'project.build.outputDirectory')
let output_dir = mvn_properties['project.build.outputDirectory']
endif
let src_main_dir = get(mvn_properties, 'project.build.sourceDirectory', join(['src', 'main', 'java'], sep))
let src_test_dir = get(mvn_properties, 'project.build.testsourceDirectory', join(['src', 'test', 'java'], sep))
if stridx(expand('%:p:h', 1), src_main_dir) >= 0
let output_dir = get(mvn_properties, 'project.build.outputDirectory', join ([output_dir, 'target', 'classes'], sep))
endif
if stridx(expand('%:p:h', 1), join(['src', 'test', 'java'], sep)) >= 0
let output_dir = join([output_dir, 'target', 'test-classes'], sep)
if has_key(mvn_properties, 'project.build.testOutputDirectory')
let output_dir = mvn_properties['project.build.testOutputDirectory']
endif
if stridx(expand('%:p:h', 1), src_test_dir) >= 0
let output_dir = get(mvn_properties, 'project.build.testOutputDirectory', join([output_dir, 'target', 'test-classes'], sep))
endif
if has('win32unix')

View File

@ -18,21 +18,31 @@ if !exists('g:syntastic_javascript_eslint_sort')
let g:syntastic_javascript_eslint_sort = 1
endif
if !exists('g:syntastic_javascript_eslint_generic')
let g:syntastic_javascript_eslint_generic = 0
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_eslint_IsAvailable() dict
if g:syntastic_javascript_eslint_generic
call self.log('generic eslint, exec =', self.getExec())
endif
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 1])
return g:syntastic_javascript_eslint_generic || syntastic#util#versionIsAtLeast(self.getVersion(), [0, 1])
endfunction
function! SyntaxCheckers_javascript_eslint_GetLocList() dict
call syntastic#log#deprecationWarn('javascript_eslint_conf', 'javascript_eslint_args',
\ "'--config ' . syntastic#util#shexpand(OLD_VAR)")
if !g:syntastic_javascript_eslint_generic
call syntastic#log#deprecationWarn('javascript_eslint_conf', 'javascript_eslint_args',
\ "'--config ' . syntastic#util#shexpand(OLD_VAR)")
endif
let makeprg = self.makeprgBuild({ 'args_before': '-f compact' })
let makeprg = self.makeprgBuild({ 'args_before': (g:syntastic_javascript_eslint_generic ? '' : '-f compact') })
let errorformat =
\ '%E%f: line %l\, col %c\, Error - %m,' .
@ -43,9 +53,17 @@ function! SyntaxCheckers_javascript_eslint_GetLocList() dict
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'] })
for e in loclist
let e['col'] += 1
endfor
if !g:syntastic_javascript_eslint_generic
if !exists('s:eslint_new')
let s:eslint_new = syntastic#util#versionIsAtLeast(self.getVersion(), [1])
endif
if !s:eslint_new
for e in loclist
let e['col'] += 1
endfor
endif
endif
return loclist
endfunction

View File

@ -18,6 +18,10 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
let version_output = syntastic#util#system(self.getExecEscaped() . ' --version')
let parsed_ver = !v:shell_error && (version_output =~# '\m^JSXHint\>') ? syntastic#util#parseVersion(version_output) : []
if len(parsed_ver)

View File

@ -14,14 +14,22 @@ if exists('g:loaded_syntastic_javascript_standard_checker')
endif
let g:loaded_syntastic_javascript_standard_checker = 1
if !exists('g:syntastic_javascript_standard_generic')
let g:syntastic_javascript_standard_generic = 0
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_standard_IsAvailable() dict
if g:syntastic_javascript_standard_generic
call self.log('generic standard, exec =', self.getExec())
endif
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 6, 1])
return g:syntastic_javascript_standard_generic || syntastic#util#versionIsAtLeast(self.getVersion(), [2, 6, 1])
endfunction
function! SyntaxCheckers_javascript_standard_GetLocList() dict

View File

@ -23,14 +23,15 @@ function! SyntaxCheckers_nix_nix_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '--parse-only' })
let errorformat =
\ '%m\, at %f:%l:%c,' .
\ '%m at %f\, line %l:,' .
\ 'error: %m\, in %f'
\ '%f:%l:%c:%m,' .
\ '%f:%l:%m,' .
\ '%f:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
\ 'defaults': {'type': 'e'},
\ 'preprocess': 'nix' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_nroff_igor_checker')
endif
let g:loaded_syntastic_nroff_igor_checker = 1
runtime! syntax_checkers/docbk/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'nroff',
\ 'name': 'igor',

View File

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_objc_oclint_checker')
endif
let g:loaded_syntastic_objc_oclint_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objc',
\ 'name': 'oclint',

View File

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_objcpp_oclint_checker')
endif
let g:loaded_syntastic_objcpp_oclint_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objcpp',
\ 'name': 'oclint',

View File

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_perl_podchecker_checker')
endif
let g:loaded_syntastic_perl_podchecker_checker = 1
runtime! syntax_checkers/pod/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'perl',
\ 'name': 'podchecker',

View File

@ -16,13 +16,14 @@ set cpo&vim
function! SyntaxCheckers_python_mypy_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f\, line %l: %m'
let errorformat = '%f:%l:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': { 'type': 'E' },
\ 'returns': [0, 1] })
\ 'returns': [0, 1],
\ 'preprocess': 'mypy' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -0,0 +1,39 @@
"============================================================================
"File: qmllint.vim
"Description: Syntax checking plugin for syntastic.vim using qmllint
"Maintainer: Peter Wu <peter@lekensteyn.nl>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_qml_qmllint_checker')
finish
endif
let g:loaded_syntastic_qml_qmllint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_qml_qmllint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f:%l : %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'returns': [0, 255] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'qml',
\ 'name': 'qmllint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,81 @@
"============================================================================
"File: lintr.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Jim Hester <james.f.hester at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" Security:
"
" This checker runs the code in your file. This is probably fine if you
" wrote the file yourself, but it can be a problem if you're trying to
" check third party files. If you are 100% willing to let Vim run the
" code in your file, set g:syntastic_enable_r_lintr_checker to 1 in
" your vimrc to enable this checker:
"
" let g:syntastic_enable_r_lintr_checker = 1
if exists("g:loaded_syntastic_r_lintr_checker")
finish
endif
let g:loaded_syntastic_r_lintr_checker = 1
if !exists('g:syntastic_r_lintr_linters')
let g:syntastic_r_lintr_linters = 'default_linters'
endif
if !exists('g:syntastic_r_lintr_cache')
let g:syntastic_r_lintr_cache = 'FALSE'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_r_lintr_GetHighlightRegex(item)
let term = matchstr(a:item['text'], "\\m'\\zs[^']\\+\\ze'")
return term != '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_r_lintr_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
call system(self.getExecEscaped() . ' --slave --no-restore --no-save -e ' . syntastic#util#shescape('library(lintr)'))
return v:shell_error == 0
endfunction
function! SyntaxCheckers_r_lintr_GetLocList() dict
let setwd = syntastic#util#isRunningWindows() ? 'setwd(''' . escape(getcwd(), '"\') . '''); ' : ''
let makeprg = self.getExecEscaped() . ' --slave --no-restore --no-save' .
\ ' -e ' . syntastic#util#shescape(setwd . 'suppressPackageStartupMessages(library(lintr)); ' .
\ 'lint(cache = ' . g:syntastic_r_lintr_cache . ', commandArgs(TRUE), ' . g:syntastic_r_lintr_linters . ')') .
\ ' --args ' . syntastic#util#shexpand('%')
let errorformat =
\ '%W%f:%l:%c: style: %m,' .
\ '%W%f:%l:%c: warning: %m,' .
\ '%E%f:%l:%c: error: %m,'
call self.setWantSort(1)
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'r',
\ 'name': 'lintr',
\ 'exec': 'R',
\ 'enable': 'enable_r_lintr_checker'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,23 @@
"============================================================================
"File: lintr.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Jim Hester <james.f.hester at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_rmd_lintr_checker')
finish
endif
let g:loaded_syntastic_rmd_lintr_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'rmd',
\ 'name': 'lintr',
\ 'redirect': 'r/lintr'})
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -29,9 +29,9 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict
let srcdir = syntastic#util#var('rst_sphinx_source_dir')
call self.log('g:syntastic_rst_sphinx_source_dir =', srcdir)
if srcdir == ''
if srcdir ==# ''
let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1))
if config == '' || !filereadable(config)
if config ==# '' || !filereadable(config)
call self.log('conf.py file not found')
return []
endif
@ -40,9 +40,9 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict
let confdir = syntastic#util#var('rst_sphinx_config_dir')
call self.log('g:syntastic_rst_sphinx_config_dir =', confdir)
if confdir == ''
if confdir ==# ''
let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1))
let confdir = (config != '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir
let confdir = (config !=# '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir
endif
let makeprg = self.makeprgBuild({

View File

@ -0,0 +1,72 @@
"============================================================================
"File: flog.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Tim Carry <tim at pixelastic dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_ruby_flog_checker')
finish
endif
let g:loaded_syntastic_ruby_flog_checker = 1
if !exists('g:syntastic_ruby_flog_threshold_warning')
let g:syntastic_ruby_flog_threshold_warning = 45
endif
if !exists('g:syntastic_ruby_flog_threshold_error')
let g:syntastic_ruby_flog_threshold_error = 90
endif
if !exists('g:syntastic_ruby_flog_sort')
let g:syntastic_ruby_flog_sort = 1
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_ruby_flog_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args': '-a' })
" Example output:
" 93.25: MyClass::my_method my_file:42
let errorformat = '%\m%\s%#%m: %.%# %f:%l'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style' })
let trail_w = syntastic#util#float2str(g:syntastic_ruby_flog_threshold_warning) . ')'
let trail_e = syntastic#util#float2str(g:syntastic_ruby_flog_threshold_error) . ')'
for e in loclist
let score = syntastic#util#str2float(e['text'])
let e['text'] = 'Complexity is too high (' . syntastic#util#float2str(score) . '/'
if score < g:syntastic_ruby_flog_threshold_warning
let e['valid'] = 0
elseif score < g:syntastic_ruby_flog_threshold_error
let e['type'] = 'W'
let e['text'] .= trail_w
else
let e['type'] = 'E'
let e['text'] .= trail_e
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'ruby',
\ 'name': 'flog'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_scss_sass_checker')
endif
let g:loaded_syntastic_scss_sass_checker = 1
runtime! syntax_checkers/sass/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'scss',
\ 'name': 'sass',

View File

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_scss_sassc_checker')
endif
let g:loaded_syntastic_scss_sassc_checker = 1
runtime! syntax_checkers/sass/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'scss',
\ 'name': 'sassc',

View File

@ -0,0 +1,39 @@
"============================================================================
"File: slim_lint.vim
"Description: Slim style and syntax checker plugin for Syntastic
"Maintainer: Vasily Kolesnikov <re.vkolesnikov@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_slim_slim_lint_checker')
finish
endif
let g:loaded_syntastic_slim_slim_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_slim_slim_lint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f:%l [%t] %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style'})
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'slim',
\ 'name': 'slim_lint',
\ 'exec': 'slim-lint' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,50 @@
"============================================================================
"File: sqlint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Steve Purcell <steve@sanityinc.com>
"License: MIT
"============================================================================
if exists('g:loaded_syntastic_sql_sqlint_checker')
finish
endif
let g:loaded_syntastic_sql_sqlint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_sql_sqlint_GetHighlightRegex(i)
let term = matchstr(a:i['text'], '\m at or near "\zs[^"]\+\ze"')
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_sql_sqlint_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 0, 3])
endfunction
function! SyntaxCheckers_sql_sqlint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat =
\ '%E%f:%l:%c:ERROR %m,' .
\ '%W%f:%l:%c:WARNING %m,' .
\ '%C %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'sql',
\ 'name': 'sqlint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,43 @@
"============================================================================
"File: stylint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_stylus_stylint_checker')
finish
endif
let g:loaded_syntastic_stylus_stylint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_stylus_stylint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat =
\ '%WWarning: %m,' .
\ '%EError: %m,' .
\ '%CFile: %f,' .
\ '%CLine: %l:%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'stylus',
\ 'name': 'stylint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_text_igor_checker')
endif
let g:loaded_syntastic_text_igor_checker = 1
runtime! syntax_checkers/docbk/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'text',
\ 'name': 'igor',

View File

@ -0,0 +1,23 @@
"============================================================================
"File: eslint.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_typescript_eslint_checker')
finish
endif
let g:loaded_syntastic_typescript_eslint_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'typescript',
\ 'name': 'eslint',
\ 'redirect': 'javascript/eslint'})
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -18,6 +18,10 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_typescript_tsc_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
let version_output = split(syntastic#util#system(self.getExecEscaped() . ' --version'), '\n', 1)
let ver = filter(copy(version_output), 'v:val =~# ''\m\<Version ''')
let parsed_ver = len(ver) ? syntastic#util#parseVersion(ver[0], '\v<Version \zs\d+(\.\d+)\ze') : []
@ -48,6 +52,7 @@ function! SyntaxCheckers_typescript_tsc_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr('')} })
endfunction

View File

@ -22,9 +22,13 @@ function! SyntaxCheckers_typescript_tslint_GetHighlightRegex(item)
endfunction
function! SyntaxCheckers_typescript_tslint_GetLocList() dict
if !exists('s:tslint_new')
let s:tslint_new = syntastic#util#versionIsAtLeast(self.getVersion(), [2, 4])
endif
let makeprg = self.makeprgBuild({
\ 'args_after': '--format verbose',
\ 'fname_before': '-f' })
\ 'fname_before': (s:tslint_new ? '' : '-f') })
" (comment-format) ts/app.ts[12, 36]: comment must start with lowercase letter
let errorformat = '%f[%l\, %c]: %m'

View File

@ -0,0 +1,38 @@
"============================================================================
"File: iverilog.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Psidium <psiidium at gmail dot com>
"License: The MIT License
"============================================================================
if exists('g:loaded_syntastic_verilog_iverilog_checker')
finish
endif
let g:loaded_syntastic_verilog_iverilog_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_verilog_iverilog_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_before': '-t null',
\ 'args': '-Wall' })
let errorformat =
\ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m,' .
\ '%E%f:%l: : %m,' .
\ '%W%f:%l: : %m,' .
\ '%f:%l: %m'
return SyntasticMake({'makeprg': makeprg, 'errorformat': errorformat})
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'verilog',
\ 'name': 'iverilog'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,55 @@
"============================================================================
"File: vcom.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Jim Vogel <jim dot e dot vogel at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_vhdl_vcom_checker')
finish
endif
let g:loaded_syntastic_vhdl_vcom_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_vhdl_vcom_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_before': '-lint' })
let errorformat =
\ '** %tRROR: %f(%l): %m,' .
\ '** %tRROR: %m,' .
\ '** %tARNING: %f(%l): %m,' .
\ '** %tARNING: %m,' .
\ '** %tOTE: %m,' .
\ '%tRROR: %f(%l): %m,' .
\ '%tARNING[%*[0-9]]: %f(%l): %m,' .
\ '%tRROR: %m,' .
\ '%tARNING[%*[0-9]]: %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
for e in loclist
if e['type'] !=? 'E' && e['type'] !=? 'W'
let e['type'] = 'W'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'vhdl',
\ 'name': 'vcom'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -74,6 +74,8 @@ function! SyntaxCheckers_vim_vimlint_GetLocList() dict " {{{1
endif
endif
call self.log('options =', param)
return vimlint#vimlint(expand('%', 1), param)
endfunction " }}}1

View File

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_xhtml_jshint_checker')
endif
let g:loaded_syntastic_xhtml_jshint_checker = 1
runtime! syntax_checkers/html/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'xhtml',
\ 'name': 'jshint',

View File

@ -0,0 +1,51 @@
"============================================================================
"File: basex.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: James Wright <james dot jw at hotmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
"
"============================================================================
if exists('g:loaded_syntastic_xquery_basex_checker')
finish
endif
let g:loaded_syntastic_xquery_basex_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_xquery_basex_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '-z',
\ 'fname_before': '-q',
\ 'fname': syntastic#util#shescape('inspect:module("' . escape(expand('%:p', 1), '"') . '")') })
let errorformat =
\ '%f:%l:%c:%t:%n:%m,' .
\ '%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'basex' })
for e in loclist
if e['type'] !=# 'W' && e['type'] !=# 'E'
let e['type'] = 'E'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'xquery',
\ 'name': 'basex'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_xslt_xmllint_checker')
endif
let g:loaded_syntastic_xslt_xmllint_checker = 1
runtime! syntax_checkers/xml/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'xslt',
\ 'name': 'xmllint',

View File

@ -28,6 +28,7 @@ function! SyntaxCheckers_yaml_jsyaml_GetLocList() dict
let errorformat =
\ 'Error on line %l\, col %c:%m,' .
\ 'JS-YAML: %m at line %l\, column %c:,' .
\ 'YAMLException: %m at line %l\, column %c:,' .
\ '%-G%.%#'
return SyntasticMake({