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

Updated vim plugins

This commit is contained in:
amix
2015-02-24 10:45:22 +00:00
parent 8fa0bd4574
commit d195ccb777
104 changed files with 1743 additions and 1464 deletions

View File

@ -29,14 +29,15 @@
4.3. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5)
4.4. [The `perl` checker has stopped working...](#faqperl)
4.5. [What happened to the `rustc` checker?](#faqrust)
4.6. [I run a checker and the location list is not updated...](#faqloclist)
4.6. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
4.7. [How can I pass additional arguments to a checker?](#faqargs)
4.8. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
4.9. [What is the difference between syntax checkers and style checkers?](#faqstyle)
4.10. [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. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
4.12. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
4.6. [What happened to the `xcrun` checker?](#faqxcrun)
4.7. [I run a checker and the location list is not updated...](#faqloclist)
4.7. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
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.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)
- - -
@ -51,7 +52,7 @@ can be done on demand, or automatically as files are saved. If syntax errors
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, syntax checking plugins exist for ActionScript,
At the time of this writing, syntastic has checking plugins for ActionScript,
Ada, 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,
@ -59,11 +60,15 @@ Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo,
LISP, LLVM intermediate language, Lua, Markdown, MATLAB, NASM, 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, Swift, Tcl, TeX, Texinfo, Twig, TypeScript,
spec, Ruby, SASS/SCSS, Scala, Slim, SML, Tcl, TeX, Texinfo, Twig, TypeScript,
Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, 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], 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
enabled.
@ -183,10 +188,18 @@ supported, look at the [wiki][3]. Note that aliases do not work; the actual
executables must be available in your `$PATH`. Symbolic links are okay though.
You can see syntastic's idea of available checkers by running `:SyntasticInfo`.
A second probable reason is that none of the available checkers are
enabled. Syntastic comes preconfigured with a default list of enabled checkers
per filetype, but this list is kept short in order to prevent slowing down Vim
or trying to run conflicting checks. The command `:SyntasticInfo` will show you
which checkers are enabled. You can tell syntastic which checkers (among the
available ones) you want to run by setting `g:syntastic_<filetype>_checkers` in
your `vimrc` (see [below](#faqcheckers)).
Another reason it could fail is that either the command line options or the
error output for a syntax checker may have changed. In this case, make sure you
have the latest version of the syntax checker installed. If it still fails then
create an issue - or better yet, create a pull request.
post an [issue][4] - or better yet, create a pull request.
<a name="faqpython3"></a>
@ -236,14 +249,21 @@ let g:syntastic_enable_perl_checker = 1
__4.5. Q. What happened to the `rustc` checker?__
A. It has been included in the [Rust compiler package][12]. If you have
a recent version of the Rust compiler, the checker should be picked up
automatically by syntastic.
A. It is now part of the [rust.vim][12] plugin. If you install this plugin the
checker should be picked up automatically by syntastic.
<a name="faqxcrun"></a>
__4.6. Q. What happened to the `xcrun` checker?__
A. The `xcrun` checker used to have a security problem and it has been removed.
A better checker for __Swift__ is part of the [vim-swift][24] plugin. If you
install this plugin the checker should be picked up automatically by syntastic.
<a name="faqloclist"></a>
__4.6. Q. I run a checker and the location list is not updated...__
__4.6. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
__4.7. Q. I run a checker and the location list is not updated...__
__4.7. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
A. By default the location list is changed only when you run the `:Errors`
command, in order to minimise conflicts with other plugins. If you want the
@ -255,7 +275,7 @@ let g:syntastic_always_populate_loc_list = 1
<a name="faqargs"></a>
__4.7. Q. How can I pass additional arguments to a checker?__
__4.8. Q. How can I pass additional arguments to a checker?__
A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers
that do can be configured using global variables. The general form of the
@ -271,7 +291,7 @@ See `:help syntastic-checker-options` for more information.
<a name="faqcheckers"></a>
__4.8. Q. Syntastic supports several checkers for my filetype - how do I tell it
__4.9. Q. Syntastic supports several checkers for my filetype - how do I tell it
which one(s) to use?__
A. Stick a line like this in your `vimrc`:
@ -312,7 +332,7 @@ filetype of the current file is `php`).
<a name="faqstyle"></a>
__4.9. Q. What is the difference between syntax checkers and style checkers?__
__4.10. Q. What is the difference between syntax checkers and style checkers?__
A. The errors and warnings they produce are highlighted differently and can
be filtered by different rules, but otherwise the distinction is pretty much
@ -342,7 +362,7 @@ See `:help syntastic_quiet_messages` for details.
<a name="faqaggregate"></a>
__4.10. Q. I have enabled multiple checkers for the current filetype. How can I
__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?__
A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`:
@ -354,7 +374,7 @@ See `:help syntastic-aggregating-errors` for more details.
<a name="faqlnext"></a>
__4.11. Q. How can I jump between the different errors without using the location
__4.12. Q. How can I jump between the different errors without using the location
list at the bottom of the window?__
A. Vim provides several built-in commands for this. See `:help :lnext` and
@ -366,7 +386,7 @@ mappings (among other things).
<a name="faqbdelete"></a>
__4.12. Q. The error window is closed automatically when I :quit the current buffer
__4.13. Q. The error window is closed automatically when I :quit the current buffer
but not when I :bdelete it?__
A. There is no safe way to handle that situation automatically, but you can
@ -404,7 +424,7 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
[9]: http://valloric.github.io/YouCompleteMe/
[10]: http://perldoc.perl.org/perlrun.html#*-c*
[11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
[12]: https://github.com/rust-lang/rust/
[12]: https://github.com/rust-lang/rust.vim
[13]: http://www.vim.org/
[14]: https://github.com/Shougo/neobundle.vim
[15]: https://github.com/MarcWeber/vim-addon-manager
@ -416,6 +436,10 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
[21]: https://github.com/validator/validator/releases/latest
[22]: https://github.com/scrooloose/syntastic/wiki/HTML%3A---validator
[23]: http://validator.github.io/validator/#standalone
[24]: https://github.com/kballard/vim-swift
[25]: https://github.com/OmniSharp/omnisharp-vim
[26]: https://github.com/myint/syntastic-extras
[27]: https://github.com/roktas/syntastic-more
<!--
vim:tw=79:sw=4:

View File

@ -10,14 +10,14 @@ set cpo&vim
" convenience function to determine the 'null device' parameter
" based on the current operating system
function! syntastic#c#NullOutput() " {{{2
function! syntastic#c#NullOutput() abort " {{{2
let known_os = has('unix') || has('mac') || syntastic#util#isRunningWindows()
return known_os ? '-o ' . syntastic#util#DevNull() : ''
endfunction " }}}2
" read additional compiler flags from the given configuration file
" the file format and its parsing mechanism is inspired by clang_complete
function! syntastic#c#ReadConfig(file) " {{{2
function! syntastic#c#ReadConfig(file) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file)
" search upwards from the current file's directory
@ -69,7 +69,7 @@ function! syntastic#c#ReadConfig(file) " {{{2
endfunction " }}}2
" GetLocList() for C-like compilers
function! syntastic#c#GetLocList(filetype, subchecker, options) " {{{2
function! syntastic#c#GetLocList(filetype, subchecker, options) abort " {{{2
try
let flags = s:_get_cflags(a:filetype, a:subchecker, a:options)
catch /\m\C^Syntastic: skip checks$/
@ -96,7 +96,7 @@ endfunction " }}}2
" Private functions {{{1
" initialize c/cpp syntax checker handlers
function! s:_init() " {{{2
function! s:_init() abort " {{{2
let s:handlers = []
let s:cflags = {}
@ -118,7 +118,7 @@ function! s:_init() " {{{2
endfunction " }}}2
" register a handler dictionary object
function! s:_registerHandler(regex, function, args) " {{{2
function! s:_registerHandler(regex, function, args) abort " {{{2
let handler = {}
let handler["regex"] = a:regex
let handler["func"] = function(a:function)
@ -129,7 +129,7 @@ endfunction " }}}2
" try to find library with 'pkg-config'
" search possible libraries from first to last given
" argument until one is found
function! s:_checkPackage(name, ...) " {{{2
function! s:_checkPackage(name, ...) abort " {{{2
if executable('pkg-config')
if !has_key(s:cflags, a:name)
for pkg in a:000
@ -150,7 +150,7 @@ function! s:_checkPackage(name, ...) " {{{2
endfunction " }}}2
" try to find PHP includes with 'php-config'
function! s:_checkPhp() " {{{2
function! s:_checkPhp() abort " {{{2
if executable('php-config')
if !has_key(s:cflags, 'php')
let s:cflags['php'] = system('php-config --includes')
@ -162,7 +162,7 @@ function! s:_checkPhp() " {{{2
endfunction " }}}2
" try to find the python headers with distutils
function! s:_checkPython() " {{{2
function! s:_checkPython() abort " {{{2
if executable('python')
if !has_key(s:cflags, 'python')
let s:cflags['python'] = system('python -c ''from distutils import ' .
@ -176,7 +176,7 @@ function! s:_checkPython() " {{{2
endfunction " }}}2
" try to find the ruby headers with 'rbconfig'
function! s:_checkRuby() " {{{2
function! s:_checkRuby() abort " {{{2
if executable('ruby')
if !has_key(s:cflags, 'ruby')
let s:cflags['ruby'] = system('ruby -r rbconfig -e ' .
@ -194,7 +194,7 @@ endfunction " }}}2
" Utilities {{{1
" resolve checker-related user variables
function! s:_get_checker_var(scope, filetype, subchecker, name, default) " {{{2
function! s:_get_checker_var(scope, filetype, subchecker, name, default) abort " {{{2
let prefix = a:scope . ':' . 'syntastic_'
if exists(prefix . a:filetype . '_' . a:subchecker . '_' . a:name)
return {a:scope}:syntastic_{a:filetype}_{a:subchecker}_{a:name}
@ -206,7 +206,7 @@ function! s:_get_checker_var(scope, filetype, subchecker, name, default) " {{{2
endfunction " }}}2
" resolve user CFLAGS
function! s:_get_cflags(ft, ck, opts) " {{{2
function! s:_get_cflags(ft, ck, opts) abort " {{{2
" determine whether to parse header files as well
if has_key(a:opts, 'header_names') && expand('%', 1) =~? a:opts['header_names']
if s:_get_checker_var('g', a:ft, a:ck, 'check_header', 0)
@ -253,7 +253,7 @@ endfunction " }}}2
" get the gcc include directory argument depending on the default
" includes and the optional user-defined 'g:syntastic_c_include_dirs'
function! s:_get_include_dirs(filetype) " {{{2
function! s:_get_include_dirs(filetype) abort " {{{2
let include_dirs = []
if a:filetype =~# '\v^%(c|cpp|objc|objcpp)$' &&
@ -271,7 +271,7 @@ endfunction " }}}2
" search the first 100 lines for include statements that are
" given in the handlers dictionary
function! s:_search_headers() " {{{2
function! s:_search_headers() abort " {{{2
let includes = ''
let files = []
let found = []

View File

@ -10,24 +10,24 @@ let s:one_time_notices_issued = []
" Public functions {{{1
function! syntastic#log#info(msg) " {{{2
function! syntastic#log#info(msg) abort " {{{2
echomsg "syntastic: info: " . a:msg
endfunction " }}}2
function! syntastic#log#warn(msg) " {{{2
function! syntastic#log#warn(msg) abort " {{{2
echohl WarningMsg
echomsg "syntastic: warning: " . a:msg
echohl None
endfunction " }}}2
function! syntastic#log#error(msg) " {{{2
function! syntastic#log#error(msg) abort " {{{2
execute "normal \<Esc>"
echohl ErrorMsg
echomsg "syntastic: error: " . a:msg
echohl None
endfunction " }}}2
function! syntastic#log#oneTimeWarn(msg) " {{{2
function! syntastic#log#oneTimeWarn(msg) abort " {{{2
if index(s:one_time_notices_issued, a:msg) >= 0
return
endif
@ -37,7 +37,7 @@ function! syntastic#log#oneTimeWarn(msg) " {{{2
endfunction " }}}2
" @vimlint(EVL102, 1, l:OLD_VAR)
function! syntastic#log#deprecationWarn(old, new, ...) " {{{2
function! syntastic#log#deprecationWarn(old, new, ...) abort " {{{2
if exists('g:syntastic_' . a:old) && !exists('g:syntastic_' . a:new)
let msg = 'variable g:syntastic_' . a:old . ' is deprecated, please use '
@ -60,7 +60,7 @@ function! syntastic#log#deprecationWarn(old, new, ...) " {{{2
endfunction " }}}2
" @vimlint(EVL102, 0, l:OLD_VAR)
function! syntastic#log#debug(level, msg, ...) " {{{2
function! syntastic#log#debug(level, msg, ...) abort " {{{2
if !s:_isDebugEnabled(a:level)
return
endif
@ -80,7 +80,7 @@ function! syntastic#log#debug(level, msg, ...) " {{{2
call s:_logRedirect(0)
endfunction " }}}2
function! syntastic#log#debugShowOptions(level, names) " {{{2
function! syntastic#log#debugShowOptions(level, names) abort " {{{2
if !s:_isDebugEnabled(a:level)
return
endif
@ -96,7 +96,7 @@ function! syntastic#log#debugShowOptions(level, names) " {{{2
call s:_logRedirect(0)
endfunction " }}}2
function! syntastic#log#debugShowVariables(level, names) " {{{2
function! syntastic#log#debugShowVariables(level, names) abort " {{{2
if !s:_isDebugEnabled(a:level)
return
endif
@ -115,7 +115,7 @@ function! syntastic#log#debugShowVariables(level, names) " {{{2
call s:_logRedirect(0)
endfunction " }}}2
function! syntastic#log#debugDump(level) " {{{2
function! syntastic#log#debugDump(level) abort " {{{2
if !s:_isDebugEnabled(a:level)
return
endif
@ -127,11 +127,11 @@ endfunction " }}}2
" Private functions {{{1
function! s:_isDebugEnabled_smart(level) " {{{2
function! s:_isDebugEnabled_smart(level) abort " {{{2
return and(g:syntastic_debug, a:level)
endfunction " }}}2
function! s:_isDebugEnabled_dumb(level) " {{{2
function! s:_isDebugEnabled_dumb(level) abort " {{{2
" poor man's bit test for bit N, assuming a:level == 2**N
return (g:syntastic_debug / a:level) % 2
endfunction " }}}2
@ -139,7 +139,7 @@ endfunction " }}}2
let s:_isDebugEnabled = function(exists('*and') ? 's:_isDebugEnabled_smart' : 's:_isDebugEnabled_dumb')
lockvar s:_isDebugEnabled
function! s:_logRedirect(on) " {{{2
function! s:_logRedirect(on) abort " {{{2
if exists("g:syntastic_debug_file")
if a:on
try
@ -158,11 +158,11 @@ endfunction " }}}2
" Utilities {{{1
function! s:_log_timestamp() " {{{2
function! s:_log_timestamp() abort " {{{2
return 'syntastic: ' . split(reltimestr(reltime(g:_SYNTASTIC_START)))[0] . ': '
endfunction " }}}2
function! s:_format_variable(name) " {{{2
function! s:_format_variable(name) abort " {{{2
let vals = []
if exists('g:syntastic_' . a:name)
call add(vals, 'g:syntastic_' . a:name . ' = ' . strtrans(string(g:syntastic_{a:name})))

View File

@ -9,7 +9,7 @@ set cpo&vim
" Public functions {{{1
" merge consecutive blanks
function! syntastic#postprocess#compressWhitespace(errors) " {{{2
function! syntastic#postprocess#compressWhitespace(errors) abort " {{{2
for e in a:errors
let e['text'] = substitute(e['text'], "\001", '', 'g')
let e['text'] = substitute(e['text'], '\n', ' ', 'g')
@ -22,7 +22,7 @@ function! syntastic#postprocess#compressWhitespace(errors) " {{{2
endfunction " }}}2
" remove spurious CR under Cygwin
function! syntastic#postprocess#cygwinRemoveCR(errors) " {{{2
function! syntastic#postprocess#cygwinRemoveCR(errors) abort " {{{2
if has('win32unix')
for e in a:errors
let e['text'] = substitute(e['text'], '\r', '', 'g')
@ -33,7 +33,7 @@ function! syntastic#postprocess#cygwinRemoveCR(errors) " {{{2
endfunction " }}}2
" decode XML entities
function! syntastic#postprocess#decodeXMLEntities(errors) " {{{2
function! syntastic#postprocess#decodeXMLEntities(errors) abort " {{{2
for e in a:errors
let e['text'] = syntastic#util#decodeXMLEntities(e['text'])
endfor
@ -42,13 +42,13 @@ function! syntastic#postprocess#decodeXMLEntities(errors) " {{{2
endfunction " }}}2
" filter out errors referencing other files
function! syntastic#postprocess#filterForeignErrors(errors) " {{{2
function! syntastic#postprocess#filterForeignErrors(errors) abort " {{{2
return filter(copy(a:errors), 'get(v:val, "bufnr") == ' . bufnr(''))
endfunction " }}}2
" make sure line numbers are not past end of buffers
" XXX: this loads all referenced buffers in memory
function! syntastic#postprocess#guards(errors) " {{{2
function! syntastic#postprocess#guards(errors) abort " {{{2
let buffers = syntastic#util#unique(map(filter(copy(a:errors), 'v:val["valid"]'), 'str2nr(v:val["bufnr"])'))
let guards = {}

View File

@ -8,7 +8,7 @@ set cpo&vim
" Public functions {{{1
function! syntastic#preprocess#cabal(errors) " {{{2
function! syntastic#preprocess#cabal(errors) abort " {{{2
let out = []
let star = 0
for err in a:errors
@ -28,7 +28,7 @@ function! syntastic#preprocess#cabal(errors) " {{{2
return out
endfunction " }}}2
function! syntastic#preprocess#checkstyle(errors) " {{{2
function! syntastic#preprocess#checkstyle(errors) abort " {{{2
let out = []
let fname = expand('%', 1)
for err in a:errors
@ -55,14 +55,14 @@ function! syntastic#preprocess#checkstyle(errors) " {{{2
return out
endfunction " }}}2
function! syntastic#preprocess#cppcheck(errors) " {{{2
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) " {{{2
function! syntastic#preprocess#flow(errors) abort " {{{2
" JSON artifacts
let true = 1
let false = 0
@ -123,11 +123,11 @@ endfunction " }}}2
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)
function! syntastic#preprocess#killEmpty(errors) " {{{2
function! syntastic#preprocess#killEmpty(errors) abort " {{{2
return filter(copy(a:errors), 'v:val != ""')
endfunction " }}}2
function! syntastic#preprocess#perl(errors) " {{{2
function! syntastic#preprocess#perl(errors) abort " {{{2
let out = []
for e in a:errors
@ -143,7 +143,7 @@ endfunction " }}}2
" @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null)
function! syntastic#preprocess#prospector(errors) " {{{2
function! syntastic#preprocess#prospector(errors) abort " {{{2
" JSON artifacts
let true = 1
let false = 0
@ -158,36 +158,38 @@ function! syntastic#preprocess#prospector(errors) " {{{2
endtry
let out = []
if type(errs) == type({}) && has_key(errs, 'messages') && type(errs['messages']) == type([])
for e in errs['messages']
if type(e) == type({})
try
if e['source'] ==# 'pylint'
let e['location']['character'] += 1
endif
if type(errs) == type({}) && has_key(errs, 'messages')
if type(errs['messages']) == type([])
for e in errs['messages']
if type(e) == type({})
try
if e['source'] ==# 'pylint'
let e['location']['character'] += 1
endif
let msg =
\ e['location']['path'] . ':' .
\ e['location']['line'] . ':' .
\ e['location']['character'] . ': ' .
\ e['code'] . ' ' .
\ e['message'] . ' ' .
\ '[' . e['source'] . ']'
let msg =
\ e['location']['path'] . ':' .
\ e['location']['line'] . ':' .
\ e['location']['character'] . ': ' .
\ e['code'] . ' ' .
\ e['message'] . ' ' .
\ '[' . e['source'] . ']'
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker python/prospector: unknown error format')
let out = []
break
endtry
else
call syntastic#log#warn('checker python/prospector: unknown error format')
let out = []
break
endtry
else
call syntastic#log#warn('checker python/prospector: unknown error format')
let out = []
break
endif
endfor
else
call syntastic#log#warn('checker python/prospector: unknown error format')
endif
endfor
else
call syntastic#log#warn('checker python/prospector: unknown error format')
endif
endif
return out
@ -196,7 +198,7 @@ endfunction " }}}2
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)
function! syntastic#preprocess#rparse(errors) " {{{2
function! syntastic#preprocess#rparse(errors) abort " {{{2
let errlist = copy(a:errors)
" remove uninteresting lines and handle continuations
@ -205,7 +207,7 @@ function! syntastic#preprocess#rparse(errors) " {{{2
if i > 0 && errlist[i][:1] == ' ' && errlist[i] !~ '\m\s\+\^$'
let errlist[i-1] .= errlist[i][1:]
call remove(errlist, i)
elseif errlist[i] !~ '\m^\(Lint:\|Lint checking:\|Error in\) '
elseif errlist[i] !~# '\m^\(Lint:\|Lint checking:\|Error in\) '
call remove(errlist, i)
else
let i += 1
@ -235,11 +237,11 @@ function! syntastic#preprocess#rparse(errors) " {{{2
return out
endfunction " }}}2
function! syntastic#preprocess#tslint(errors) " {{{2
function! syntastic#preprocess#tslint(errors) abort " {{{2
return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")')
endfunction " }}}2
function! syntastic#preprocess#validator(errors) " {{{2
function! syntastic#preprocess#validator(errors) abort " {{{2
let out = []
for e in a:errors
let parts = matchlist(e, '\v^"([^"]+)"(.+)')
@ -254,6 +256,58 @@ function! syntastic#preprocess#validator(errors) " {{{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 out = []
if type(errs) == type([])
for e in errs
if type(e) == type({})
try
let msg =
\ e['file_path'] . ':' .
\ e['line_number'] . ':' .
\ e['column_number'] . ':' .
\ e['severity'][0] . ': ' .
\ e['description'] . ' (' .
\ e['policy_name'] . ')'
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker vim/vint: unknown error format')
let out = []
break
endtry
else
call syntastic#log#warn('checker vim/vint: unknown error format')
let out = []
break
endif
endfor
else
call syntastic#log#warn('checker vim/vint: unknown error format')
endif
return out
endfunction " }}}2
" @vimlint(EVL102, 0, l:true)
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)
" }}}1
let &cpo = s:save_cpo

View File

@ -8,11 +8,11 @@ set cpo&vim
" Public functions {{{1
function! syntastic#util#isRunningWindows() " {{{2
function! syntastic#util#isRunningWindows() abort " {{{2
return has('win16') || has('win32') || has('win64')
endfunction " }}}2
function! syntastic#util#DevNull() " {{{2
function! syntastic#util#DevNull() abort " {{{2
if syntastic#util#isRunningWindows()
return 'NUL'
endif
@ -24,8 +24,12 @@ function! syntastic#util#Slash() abort " {{{2
return (!exists("+shellslash") || &shellslash) ? '/' : '\'
endfunction " }}}2
function! syntastic#util#CygwinPath(path) abort " {{{2
return substitute(system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g')
endfunction " }}}2
" Create a temporary directory
function! syntastic#util#tmpdir() " {{{2
function! syntastic#util#tmpdir() abort " {{{2
let tempdir = ''
if (has('unix') || has('mac')) && executable('mktemp')
@ -41,7 +45,7 @@ function! syntastic#util#tmpdir() " {{{2
if has('win32') || has('win64')
let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . getpid()
elseif has('win32unix')
let tempdir = s:CygwinPath('/tmp/vim-syntastic-' . getpid())
let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . getpid())
elseif $TMPDIR != ''
let tempdir = $TMPDIR . '/vim-syntastic-' . getpid()
else
@ -60,7 +64,7 @@ function! syntastic#util#tmpdir() " {{{2
endfunction " }}}2
" Recursively remove a directory
function! syntastic#util#rmrf(what) " {{{2
function! syntastic#util#rmrf(what) abort " {{{2
" try to make sure we don't delete directories we didn't create
if a:what !~? 'vim-syntastic-'
return
@ -94,7 +98,7 @@ endfunction " }}}2
"returns
"
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
function! syntastic#util#parseShebang() " {{{2
function! syntastic#util#parseShebang() abort " {{{2
for lnum in range(1, 5)
let line = getline(lnum)
if line =~ '^#!'
@ -109,7 +113,7 @@ function! syntastic#util#parseShebang() " {{{2
endfunction " }}}2
" Get the value of a variable. Allow local variables to override global ones.
function! syntastic#util#var(name, ...) " {{{2
function! syntastic#util#var(name, ...) abort " {{{2
return
\ exists('b:syntastic_' . a:name) ? b:syntastic_{a:name} :
\ exists('g:syntastic_' . a:name) ? g:syntastic_{a:name} :
@ -117,7 +121,7 @@ function! syntastic#util#var(name, ...) " {{{2
endfunction " }}}2
" Parse a version string. Return an array of version components.
function! syntastic#util#parseVersion(version) " {{{2
function! syntastic#util#parseVersion(version) abort " {{{2
return map(split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)')
endfunction " }}}2
@ -127,13 +131,13 @@ endfunction " }}}2
" the "missing" elements will be assumed to be 0 for the purposes of checking.
"
" See http://semver.org for info about version numbers.
function! syntastic#util#versionIsAtLeast(installed, required) " {{{2
function! syntastic#util#versionIsAtLeast(installed, required) abort " {{{2
return syntastic#util#compareLexi(a:installed, a:required) >= 0
endfunction " }}}2
" Almost lexicographic comparison of two lists of integers. :) If lists
" have different lengths, the "missing" elements are assumed to be 0.
function! syntastic#util#compareLexi(a, b) " {{{2
function! syntastic#util#compareLexi(a, b) abort " {{{2
for idx in range(max([len(a:a), len(a:b)]))
let a_element = str2nr(get(a:a, idx, 0))
let b_element = str2nr(get(a:b, idx, 0))
@ -150,7 +154,7 @@ endfunction " }}}2
let s:_width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
lockvar s:_width
function! syntastic#util#screenWidth(str, tabstop) " {{{2
function! syntastic#util#screenWidth(str, tabstop) abort " {{{2
let chunks = split(a:str, "\t", 1)
let width = s:_width(chunks[-1])
for c in chunks[:-2]
@ -161,7 +165,7 @@ function! syntastic#util#screenWidth(str, tabstop) " {{{2
endfunction " }}}2
"print as much of a:msg as possible without "Press Enter" prompt appearing
function! syntastic#util#wideMsg(msg) " {{{2
function! syntastic#util#wideMsg(msg) abort " {{{2
let old_ruler = &ruler
let old_showcmd = &showcmd
@ -185,7 +189,7 @@ function! syntastic#util#wideMsg(msg) " {{{2
endfunction " }}}2
" Check whether a buffer is loaded, listed, and not hidden
function! syntastic#util#bufIsActive(buffer) " {{{2
function! syntastic#util#bufIsActive(buffer) abort " {{{2
" convert to number, or hell breaks loose
let buf = str2nr(a:buffer)
@ -205,7 +209,7 @@ endfunction " }}}2
" 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#findInParent(what, where) " {{{2
function! syntastic#util#findInParent(what, where) abort " {{{2
let here = fnamemodify(a:where, ':p')
let root = syntastic#util#Slash()
@ -237,7 +241,7 @@ function! syntastic#util#findInParent(what, where) " {{{2
endfunction " }}}2
" Returns unique elements in a list
function! syntastic#util#unique(list) " {{{2
function! syntastic#util#unique(list) abort " {{{2
let seen = {}
let uniques = []
for e in a:list
@ -250,17 +254,17 @@ function! syntastic#util#unique(list) " {{{2
endfunction " }}}2
" A less noisy shellescape()
function! syntastic#util#shescape(string) " {{{2
return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string)
function! syntastic#util#shescape(string) abort " {{{2
return a:string =~# '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string)
endfunction " }}}2
" A less noisy shellescape(expand())
function! syntastic#util#shexpand(string, ...) " {{{2
function! syntastic#util#shexpand(string, ...) abort " {{{2
return syntastic#util#shescape(a:0 ? expand(a:string, a:1) : expand(a:string, 1))
endfunction " }}}2
" Escape arguments
function! syntastic#util#argsescape(opt) " {{{2
function! syntastic#util#argsescape(opt) abort " {{{2
if type(a:opt) == type('') && a:opt != ''
return [a:opt]
elseif type(a:opt) == type([])
@ -271,7 +275,7 @@ function! syntastic#util#argsescape(opt) " {{{2
endfunction " }}}2
" decode XML entities
function! syntastic#util#decodeXMLEntities(string) " {{{2
function! syntastic#util#decodeXMLEntities(string) abort " {{{2
let str = a:string
let str = substitute(str, '\m&lt;', '<', 'g')
let str = substitute(str, '\m&gt;', '>', 'g')
@ -281,7 +285,7 @@ function! syntastic#util#decodeXMLEntities(string) " {{{2
return str
endfunction " }}}2
function! syntastic#util#redraw(full) " {{{2
function! syntastic#util#redraw(full) abort " {{{2
if a:full
redraw!
else
@ -289,7 +293,7 @@ function! syntastic#util#redraw(full) " {{{2
endif
endfunction " }}}2
function! syntastic#util#dictFilter(errors, filter) " {{{2
function! syntastic#util#dictFilter(errors, filter) abort " {{{2
let rules = s:_translateFilter(a:filter)
" call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, "applying filter:", rules)
try
@ -303,7 +307,7 @@ endfunction " }}}2
" Return a [high, low] list of integers, representing the time
" (hopefully high resolution) since program start
" TODO: This assumes reltime() returns a list of integers.
function! syntastic#util#stamp() " {{{2
function! syntastic#util#stamp() abort " {{{2
return reltime(g:_SYNTASTIC_START)
endfunction " }}}2
@ -311,7 +315,7 @@ endfunction " }}}2
" Private functions {{{1
function! s:_translateFilter(filters) " {{{2
function! s:_translateFilter(filters) abort " {{{2
let conditions = []
for k in keys(a:filters)
if type(a:filters[k]) == type([])
@ -327,7 +331,7 @@ function! s:_translateFilter(filters) " {{{2
return len(conditions) == 1 ? conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
endfunction " }}}2
function! s:_translateElement(key, term) " {{{2
function! s:_translateElement(key, term) abort " {{{2
let fkey = a:key
if fkey[0] == '!'
let fkey = fkey[1:]
@ -365,7 +369,7 @@ function! s:_translateElement(key, term) " {{{2
return ret
endfunction " }}}2
function! s:_rmrf(what) " {{{2
function! s:_rmrf(what) abort " {{{2
if !exists('s:rmdir')
let s:rmdir = syntastic#util#shescape(get(g:, 'netrw_localrmdir', 'rmdir'))
endif

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.6.0-16'
let g:_SYNTASTIC_VERSION = '3.6.0-44'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1
@ -42,15 +42,21 @@ endfor
let s:_running_windows = syntastic#util#isRunningWindows()
lockvar s:_running_windows
if !s:_running_windows && executable('uname')
if s:_running_windows
let g:_SYNTASTIC_UNAME = 'Windows'
elseif executable('uname')
try
let s:_uname = system('uname')
let g:_SYNTASTIC_UNAME = split(system('uname'), "\n")[0]
catch /\m^Vim\%((\a\+)\)\=:E484/
call syntastic#log#error("your shell " . &shell . " can't handle traditional UNIX syntax for redirections")
finish
catch /\m^Vim\%((\a\+)\)\=:E684/
let g:_SYNTASTIC_UNAME = 'Unknown'
endtry
lockvar s:_uname
else
let g:_SYNTASTIC_UNAME = 'Unknown'
endif
lockvar g:_SYNTASTIC_UNAME
" }}}1
@ -152,7 +158,7 @@ let s:modemap = g:SyntasticModeMap.Instance()
" @vimlint(EVL103, 1, a:cursorPos)
" @vimlint(EVL103, 1, a:cmdLine)
" @vimlint(EVL103, 1, a:argLead)
function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) " {{{2
function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) abort " {{{2
let checker_names = []
for ft in s:_resolve_filetypes([])
call extend(checker_names, s:registry.getNamesOfAvailableCheckers(ft))
@ -167,7 +173,7 @@ endfunction " }}}2
" @vimlint(EVL103, 1, a:cursorPos)
" @vimlint(EVL103, 1, a:cmdLine)
" @vimlint(EVL103, 1, a:argLead)
function! s:CompleteFiletypes(argLead, cmdLine, cursorPos) " {{{2
function! s:CompleteFiletypes(argLead, cmdLine, cursorPos) abort " {{{2
return join(s:registry.getKnownFiletypes(), "\n")
endfunction " }}}2
" @vimlint(EVL103, 0, a:cursorPos)
@ -185,34 +191,34 @@ command! SyntasticSetLoclist call SyntasticSetLoclist()
" Public API {{{1
function! SyntasticCheck(...) " {{{2
function! SyntasticCheck(...) abort " {{{2
call s:UpdateErrors(0, a:000)
call syntastic#util#redraw(g:syntastic_full_redraws)
endfunction " }}}2
function! SyntasticInfo(...) " {{{2
function! SyntasticInfo(...) abort " {{{2
call s:modemap.modeInfo(a:000)
call s:registry.echoInfoFor(s:_resolve_filetypes(a:000))
call s:_explain_skip(a:000)
endfunction " }}}2
function! SyntasticErrors() " {{{2
function! SyntasticErrors() abort " {{{2
call g:SyntasticLoclist.current().show()
endfunction " }}}2
function! SyntasticReset() " {{{2
function! SyntasticReset() abort " {{{2
call s:ClearCache()
call s:notifiers.refresh(g:SyntasticLoclist.New([]))
endfunction " }}}2
function! SyntasticToggleMode() " {{{2
function! SyntasticToggleMode() abort " {{{2
call s:modemap.toggleMode()
call s:ClearCache()
call s:notifiers.refresh(g:SyntasticLoclist.New([]))
call s:modemap.echoMode()
endfunction " }}}2
function! SyntasticSetLoclist() " {{{2
function! SyntasticSetLoclist() abort " {{{2
call g:SyntasticLoclist.current().setloclist()
endfunction " }}}2
@ -233,7 +239,7 @@ if v:version > 703 || (v:version == 703 && has('patch544'))
augroup END
endif
function! s:BufReadPostHook() " {{{2
function! s:BufReadPostHook() abort " {{{2
if g:syntastic_check_on_open
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufReadPost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
@ -241,19 +247,19 @@ function! s:BufReadPostHook() " {{{2
endif
endfunction " }}}2
function! s:BufWritePostHook() " {{{2
function! s:BufWritePostHook() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufWritePost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
call s:UpdateErrors(1, [])
endfunction " }}}2
function! s:BufEnterHook() " {{{2
function! s:BufEnterHook() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) .
\ ', &buftype = ' . string(&buftype))
if &buftype == ''
call s:notifiers.refresh(g:SyntasticLoclist.current())
elseif &buftype == 'quickfix'
elseif &buftype ==# 'quickfix'
" TODO: this is needed because in recent versions of Vim lclose
" can no longer be called from BufWinLeave
" TODO: at this point there is no b:syntastic_loclist
@ -266,7 +272,7 @@ function! s:BufEnterHook() " {{{2
endif
endfunction " }}}2
function! s:QuitPreHook() " {{{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')
@ -280,7 +286,7 @@ endfunction " }}}2
" Main {{{1
"refresh and redraw all the error info for this buf when saving or reading
function! s:UpdateErrors(auto_invoked, checker_names) " {{{2
function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'version')
call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, s:_DEBUG_DUMP_OPTIONS)
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
@ -336,13 +342,13 @@ function! s:UpdateErrors(auto_invoked, checker_names) " {{{2
endfunction " }}}2
"clear the loc list for the buffer
function! s:ClearCache() " {{{2
function! s:ClearCache() abort " {{{2
call s:notifiers.reset(g:SyntasticLoclist.current())
call b:syntastic_loclist.destroy()
endfunction " }}}2
"detect and cache all syntax errors in this buffer
function! s:CacheErrors(checker_names) " {{{2
function! s:CacheErrors(checker_names) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: ' .
\ (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
call s:ClearCache()
@ -351,7 +357,8 @@ function! s:CacheErrors(checker_names) " {{{2
if !s:_skip_file()
" debug logging {{{3
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'aggregate_errors')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . getcwd())
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$PATH = ' . string($PATH))
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . string(getcwd()))
" }}}3
let filetypes = s:_resolve_filetypes([])
@ -452,7 +459,7 @@ endfunction " }}}2
" 'env' - environment variables to set before running the checker
" 'returns' - a list of valid exit codes for the checker
" @vimlint(EVL102, 1, l:env_save)
function! SyntasticMake(options) " {{{2
function! SyntasticMake(options) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'SyntasticMake: called with options:', a:options)
" save options and locale env variables {{{3
@ -479,8 +486,8 @@ function! SyntasticMake(options) " {{{2
if has_key(a:options, 'env') && len(a:options['env'])
for key in keys(a:options['env'])
if key =~? '\m^[a-z_]\+$'
exec 'let env_save[' . string(key) . '] = $' . key
exec 'let $' . key . ' = ' . string(a:options['env'][key])
execute 'let env_save[' . string(key) . '] = $' . key
execute 'let $' . key . ' = ' . string(a:options['env'][key])
endif
endfor
endif
@ -495,7 +502,7 @@ function! SyntasticMake(options) " {{{2
let $LC_MESSAGES = old_lc_messages
if len(env_save)
for key in keys(env_save)
exec 'let $' . key . ' = ' . string(env_save[key])
execute 'let $' . key . ' = ' . string(env_save[key])
endfor
endif
" }}}3
@ -543,7 +550,7 @@ function! SyntasticMake(options) " {{{2
let &shellredir = old_shellredir
" }}}3
if !s:_running_windows && (s:_os_name() =~ "FreeBSD" || s:_os_name() =~ "OpenBSD")
if !s:_running_windows && (s:_os_name() =~? "FreeBSD" || s:_os_name() =~? "OpenBSD")
call syntastic#util#redraw(g:syntastic_full_redraws)
endif
@ -582,7 +589,7 @@ endfunction " }}}2
"g:syntastic_stl_format
"
"return '' if no errors are cached for the buffer
function! SyntasticStatuslineFlag() " {{{2
function! SyntasticStatuslineFlag() abort " {{{2
return g:SyntasticLoclist.current().getStatuslineFlag()
endfunction " }}}2
@ -590,12 +597,12 @@ endfunction " }}}2
" Utilities {{{1
function! s:_resolve_filetypes(filetypes) " {{{2
function! s:_resolve_filetypes(filetypes) abort " {{{2
let type = len(a:filetypes) ? a:filetypes[0] : &filetype
return split( get(g:syntastic_filetype_map, type, type), '\m\.' )
endfunction " }}}2
function! s:_ignore_file(filename) " {{{2
function! s:_ignore_file(filename) abort " {{{2
let fname = fnamemodify(a:filename, ':p')
for pattern in g:syntastic_ignore_files
if fname =~# pattern
@ -606,7 +613,7 @@ function! s:_ignore_file(filename) " {{{2
endfunction " }}}2
" Skip running in special buffers
function! s:_skip_file() " {{{2
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) ||
@ -618,7 +625,7 @@ function! s:_skip_file() " {{{2
endfunction " }}}2
" Explain why checks will be skipped for the current file
function! s:_explain_skip(filetypes) " {{{2
function! s:_explain_skip(filetypes) abort " {{{2
if empty(a:filetypes) && s:_skip_file()
let why = []
let fname = expand('%', 1)
@ -647,7 +654,7 @@ function! s:_explain_skip(filetypes) " {{{2
endfunction " }}}2
" Take a list of errors and add default values to them from a:options
function! s:_add_to_errors(errors, options) " {{{2
function! s:_add_to_errors(errors, options) abort " {{{2
for err in a:errors
for key in keys(a:options)
if !has_key(err, key) || empty(err[key])
@ -662,7 +669,7 @@ endfunction " }}}2
" XXX: Is this still needed?
" The script changes &shellredir to stop the screen
" flicking when shelling out to syntax checkers.
function! s:_bash_hack() " {{{2
function! s:_bash_hack() abort " {{{2
if g:syntastic_bash_hack
if !exists('s:shell_is_bash')
let s:shell_is_bash =
@ -677,12 +684,8 @@ function! s:_bash_hack() " {{{2
endif
endfunction " }}}2
function! s:_os_name() " {{{2
if !exists('s:_uname')
let s:_uname = system('uname')
lockvar s:_uname
endif
return s:_uname
function! s:_os_name() abort " {{{2
return g:_SYNTASTIC_UNAME
endfunction " }}}2
" }}}1

View File

@ -7,17 +7,17 @@ let g:SyntasticAutoloclistNotifier = {}
" Public methods {{{1
"
function! g:SyntasticAutoloclistNotifier.New() " {{{2
function! g:SyntasticAutoloclistNotifier.New() abort " {{{2
let newObj = copy(self)
return newObj
endfunction " }}}2
function! g:SyntasticAutoloclistNotifier.refresh(loclist) " {{{2
function! g:SyntasticAutoloclistNotifier.refresh(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: refresh')
call g:SyntasticAutoloclistNotifier.AutoToggle(a:loclist)
endfunction " }}}2
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) " {{{2
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: toggle')
if !a:loclist.isEmpty()
if syntastic#util#var('auto_loc_list') == 1

View File

@ -11,17 +11,17 @@ let g:SyntasticBalloonsNotifier = {}
" Public methods {{{1
function! g:SyntasticBalloonsNotifier.New() " {{{2
function! g:SyntasticBalloonsNotifier.New() abort " {{{2
let newObj = copy(self)
return newObj
endfunction " }}}2
function! g:SyntasticBalloonsNotifier.enabled() " {{{2
function! g:SyntasticBalloonsNotifier.enabled() abort " {{{2
return has('balloon_eval') && syntastic#util#var('enable_balloons')
endfunction " }}}2
" Update the error balloons
function! g:SyntasticBalloonsNotifier.refresh(loclist) " {{{2
function! g:SyntasticBalloonsNotifier.refresh(loclist) abort " {{{2
unlet! b:syntastic_private_balloons
if self.enabled() && !a:loclist.isEmpty()
let b:syntastic_private_balloons = a:loclist.balloons()
@ -33,7 +33,7 @@ endfunction " }}}2
" Reset the error balloons
" @vimlint(EVL103, 1, a:loclist)
function! g:SyntasticBalloonsNotifier.reset(loclist) " {{{2
function! g:SyntasticBalloonsNotifier.reset(loclist) abort " {{{2
let b:syntastic_private_balloons = {}
if has('balloon_eval')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'balloons: reset')
@ -47,7 +47,7 @@ endfunction " }}}2
" Private functions {{{1
function! SyntasticBalloonsExprNotifier() " {{{2
function! SyntasticBalloonsExprNotifier() abort " {{{2
if !exists('b:syntastic_private_balloons')
return ''
endif

View File

@ -7,7 +7,7 @@ let g:SyntasticChecker = {}
" Public methods {{{1
function! g:SyntasticChecker.New(args) " {{{2
function! g:SyntasticChecker.New(args) abort " {{{2
let newObj = copy(self)
let newObj._filetype = a:args['filetype']
@ -40,25 +40,43 @@ function! g:SyntasticChecker.New(args) " {{{2
return newObj
endfunction " }}}2
function! g:SyntasticChecker.getFiletype() " {{{2
function! g:SyntasticChecker.getFiletype() abort " {{{2
return self._filetype
endfunction " }}}2
function! g:SyntasticChecker.getName() " {{{2
function! g:SyntasticChecker.getName() abort " {{{2
return self._name
endfunction " }}}2
function! g:SyntasticChecker.getExec() " {{{2
return
" Synchronise _exec with user's setting. Force re-validation if needed.
"
" XXX: This function must be called at least once before calling either
" getExec() or getExecEscaped(). Normally isAvailable() does that for you
" automatically, but you should keep still this in mind if you change the
" current checker workflow.
function! g:SyntasticChecker.syncExec() dict " {{{2
let user_exec =
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec', self._exec), 1 )
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec'), 1 )
if user_exec != '' && user_exec !=# self._exec
let self._exec = user_exec
if has_key(self, '_available')
" we have a new _exec on the block, it has to be validated
call remove(self, '_available')
endif
endif
endfunction " }}}2
function! g:SyntasticChecker.getExecEscaped() " {{{2
return syntastic#util#shescape(self.getExec())
function! g:SyntasticChecker.getExec() abort " {{{2
return self._exec
endfunction " }}}2
function! g:SyntasticChecker.getLocListRaw() " {{{2
function! g:SyntasticChecker.getExecEscaped() abort " {{{2
return syntastic#util#shescape(self._exec)
endfunction " }}}2
function! g:SyntasticChecker.getLocListRaw() abort " {{{2
let name = self._filetype . '/' . self._name
try
let list = self._locListFunc()
@ -73,11 +91,11 @@ function! g:SyntasticChecker.getLocListRaw() " {{{2
return list
endfunction " }}}2
function! g:SyntasticChecker.getLocList() " {{{2
function! g:SyntasticChecker.getLocList() abort " {{{2
return g:SyntasticLoclist.New(self.getLocListRaw())
endfunction " }}}2
function! g:SyntasticChecker.getVersion(...) " {{{2
function! g:SyntasticChecker.getVersion(...) abort " {{{2
if !exists('self._version')
let command = a:0 ? a:1 : self.getExecEscaped() . ' --version'
let version_output = system(command)
@ -89,7 +107,7 @@ function! g:SyntasticChecker.getVersion(...) " {{{2
return get(self, '_version', [])
endfunction " }}}2
function! g:SyntasticChecker.setVersion(version) " {{{2
function! g:SyntasticChecker.setVersion(version) abort " {{{2
if len(a:version)
let self._version = copy(a:version)
call self.log(self.getExec() . ' version =', a:version)
@ -98,7 +116,7 @@ function! g:SyntasticChecker.setVersion(version) " {{{2
endif
endfunction " }}}2
function! g:SyntasticChecker.log(msg, ...) " {{{2
function! g:SyntasticChecker.log(msg, ...) abort " {{{2
let leader = self._filetype . '/' . self._name . ': '
if a:0 > 0
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, leader . a:msg, a:1)
@ -107,7 +125,7 @@ function! g:SyntasticChecker.log(msg, ...) " {{{2
endif
endfunction " }}}2
function! g:SyntasticChecker.makeprgBuild(opts) " {{{2
function! g:SyntasticChecker.makeprgBuild(opts) abort " {{{2
let basename = self._filetype . '_' . self._name . '_'
let parts = []
@ -120,20 +138,21 @@ function! g:SyntasticChecker.makeprgBuild(opts) " {{{2
return join(parts)
endfunction " }}}2
function! g:SyntasticChecker.isAvailable() " {{{2
function! g:SyntasticChecker.isAvailable() abort " {{{2
call self.syncExec()
if !has_key(self, '_available')
let self._available = self._isAvailableFunc()
endif
return self._available
endfunction " }}}2
function! g:SyntasticChecker.wantSort() " {{{2
function! g:SyntasticChecker.wantSort() abort " {{{2
return syntastic#util#var(self._filetype . '_' . self._name . '_sort', 0)
endfunction " }}}2
" This method is no longer used by syntastic. It's here only to maintain
" backwards compatibility with external checkers which might depend on it.
function! g:SyntasticChecker.setWantSort(val) " {{{2
function! g:SyntasticChecker.setWantSort(val) abort " {{{2
if !exists('g:syntastic_' . self._filetype . '_' . self._name . '_sort')
let g:syntastic_{self._filetype}_{self._name}_sort = a:val
endif
@ -143,7 +162,7 @@ endfunction " }}}2
" Private methods {{{1
function! g:SyntasticChecker._quietMessages(errors) " {{{2
function! g:SyntasticChecker._quietMessages(errors) abort " {{{2
" wildcard quiet_messages
let quiet_filters = copy(syntastic#util#var('quiet_messages', {}))
if type(quiet_filters) != type({})
@ -168,7 +187,7 @@ function! g:SyntasticChecker._quietMessages(errors) " {{{2
endif
endfunction " }}}2
function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2
function! g:SyntasticChecker._populateHighlightRegexes(errors) abort " {{{2
if has_key(self, '_highlightRegexFunc')
for e in a:errors
if e['valid']
@ -181,7 +200,7 @@ function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2
endif
endfunction " }}}2
function! g:SyntasticChecker._getOpt(opts, basename, name, default) " {{{2
function! g:SyntasticChecker._getOpt(opts, basename, name, default) abort " {{{2
let ret = []
call extend( ret, syntastic#util#argsescape(get(a:opts, a:name . '_before', '')) )
call extend( ret, syntastic#util#argsescape(syntastic#util#var( a:basename . a:name, get(a:opts, a:name, a:default) )) )

View File

@ -7,16 +7,16 @@ let g:SyntasticCursorNotifier = {}
" Public methods {{{1
function! g:SyntasticCursorNotifier.New() " {{{2
function! g:SyntasticCursorNotifier.New() abort " {{{2
let newObj = copy(self)
return newObj
endfunction " }}}2
function! g:SyntasticCursorNotifier.enabled() " {{{2
function! g:SyntasticCursorNotifier.enabled() abort " {{{2
return syntastic#util#var('echo_current_error')
endfunction " }}}2
function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2
function! g:SyntasticCursorNotifier.refresh(loclist) abort " {{{2
if self.enabled() && !a:loclist.isEmpty()
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: refresh')
let b:syntastic_private_messages = copy(a:loclist.messages(bufnr('')))
@ -28,7 +28,7 @@ function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2
endfunction " }}}2
" @vimlint(EVL103, 1, a:loclist)
function! g:SyntasticCursorNotifier.reset(loclist) " {{{2
function! g:SyntasticCursorNotifier.reset(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: reset')
autocmd! syntastic CursorMoved
unlet! b:syntastic_private_messages
@ -40,7 +40,7 @@ endfunction " }}}2
" Private functions {{{1
function! SyntasticRefreshCursor() " {{{2
function! SyntasticRefreshCursor() abort " {{{2
if !exists('b:syntastic_private_messages') || empty(b:syntastic_private_messages)
" file not checked
return
@ -93,7 +93,7 @@ endfunction " }}}2
" Utilities {{{1
function! s:_is_same_index(line, old_line, column, idx, messages) " {{{2
function! s:_is_same_index(line, old_line, column, idx, messages) abort " {{{2
if a:old_line >= 0 && a:line == a:old_line && a:idx >= 0
if len(a:messages) <= 1
return 1
@ -113,7 +113,7 @@ function! s:_is_same_index(line, old_line, column, idx, messages) " {{{2
endif
endfunction " }}}2
function! s:_find_index(column, messages) " {{{2
function! s:_find_index(column, messages) abort " {{{2
let max = len(a:messages) - 1
if max == 0
return 0

View File

@ -13,7 +13,7 @@ let s:setup_done = 0
" Public methods {{{1
function! g:SyntasticHighlightingNotifier.New() " {{{2
function! g:SyntasticHighlightingNotifier.New() abort " {{{2
let newObj = copy(self)
if !s:setup_done
@ -25,12 +25,12 @@ function! g:SyntasticHighlightingNotifier.New() " {{{2
return newObj
endfunction " }}}2
function! g:SyntasticHighlightingNotifier.enabled() " {{{2
function! g:SyntasticHighlightingNotifier.enabled() abort " {{{2
return s:has_highlighting && syntastic#util#var('enable_highlighting')
endfunction " }}}2
" Sets error highlights in the cuirrent window
function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2
function! g:SyntasticHighlightingNotifier.refresh(loclist) abort " {{{2
if self.enabled()
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: refresh')
call self._reset()
@ -61,7 +61,7 @@ endfunction " }}}2
" Remove all error highlights from the window
" @vimlint(EVL103, 1, a:loclist)
function! g:SyntasticHighlightingNotifier.reset(loclist) " {{{2
function! g:SyntasticHighlightingNotifier.reset(loclist) abort " {{{2
if s:has_highlighting
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: reset')
call self._reset()
@ -74,7 +74,7 @@ endfunction " }}}2
" Private methods {{{1
" One time setup: define our own highlighting
function! g:SyntasticHighlightingNotifier._setup() " {{{2
function! g:SyntasticHighlightingNotifier._setup() abort " {{{2
if s:has_highlighting
if !hlexists('SyntasticError')
highlight link SyntasticError SpellBad
@ -91,7 +91,7 @@ function! g:SyntasticHighlightingNotifier._setup() " {{{2
endif
endfunction " }}}2
function! g:SyntasticHighlightingNotifier._reset() " {{{2
function! g:SyntasticHighlightingNotifier._reset() abort " {{{2
for match in getmatches()
if stridx(match['group'], 'Syntastic') == 0
call matchdelete(match['id'])

View File

@ -7,7 +7,7 @@ let g:SyntasticLoclist = {}
" Public methods {{{1
function! g:SyntasticLoclist.New(rawLoclist) " {{{2
function! g:SyntasticLoclist.New(rawLoclist) abort " {{{2
let newObj = copy(self)
let llist = filter(copy(a:rawLoclist), 'v:val["valid"] == 1')
@ -27,20 +27,20 @@ function! g:SyntasticLoclist.New(rawLoclist) " {{{2
return newObj
endfunction " }}}2
function! g:SyntasticLoclist.current() " {{{2
function! g:SyntasticLoclist.current() abort " {{{2
if !exists("b:syntastic_loclist") || empty(b:syntastic_loclist)
let b:syntastic_loclist = g:SyntasticLoclist.New([])
endif
return b:syntastic_loclist
endfunction " }}}2
function! g:SyntasticLoclist.extend(other) " {{{2
function! g:SyntasticLoclist.extend(other) abort " {{{2
let list = self.copyRaw()
call extend(list, a:other.copyRaw())
return g:SyntasticLoclist.New(list)
endfunction " }}}2
function! g:SyntasticLoclist.sort() " {{{2
function! g:SyntasticLoclist.sort() abort " {{{2
if !self._sorted
for e in self._rawLoclist
call s:_set_screen_column(e)
@ -52,11 +52,11 @@ function! g:SyntasticLoclist.sort() " {{{2
endif
endfunction " }}}2
function! g:SyntasticLoclist.isEmpty() " {{{2
function! g:SyntasticLoclist.isEmpty() abort " {{{2
return empty(self._rawLoclist)
endfunction " }}}2
function! g:SyntasticLoclist.isNewerThan(stamp) " {{{2
function! g:SyntasticLoclist.isNewerThan(stamp) abort " {{{2
if !exists("self._stamp")
let self._stamp = []
return 0
@ -64,23 +64,23 @@ function! g:SyntasticLoclist.isNewerThan(stamp) " {{{2
return syntastic#util#compareLexi(self._stamp, a:stamp) > 0
endfunction " }}}2
function! g:SyntasticLoclist.copyRaw() " {{{2
function! g:SyntasticLoclist.copyRaw() abort " {{{2
return copy(self._rawLoclist)
endfunction " }}}2
function! g:SyntasticLoclist.getRaw() " {{{2
function! g:SyntasticLoclist.getRaw() abort " {{{2
return self._rawLoclist
endfunction " }}}2
function! g:SyntasticLoclist.getBuffers() " {{{2
function! g:SyntasticLoclist.getBuffers() abort " {{{2
return syntastic#util#unique(map(copy(self._rawLoclist), 'str2nr(v:val["bufnr"])') + [self._owner])
endfunction " }}}2
function! g:SyntasticLoclist.getCursorColumns() " {{{2
function! g:SyntasticLoclist.getCursorColumns() abort " {{{2
return self._columns
endfunction " }}}2
function! g:SyntasticLoclist.getStatuslineFlag() " {{{2
function! g:SyntasticLoclist.getStatuslineFlag() abort " {{{2
if !exists("self._stl_format")
let self._stl_format = ''
endif
@ -133,7 +133,7 @@ function! g:SyntasticLoclist.getStatuslineFlag() " {{{2
return self._stl_flag
endfunction " }}}2
function! g:SyntasticLoclist.getFirstError(...) " {{{2
function! g:SyntasticLoclist.getFirstError(...) abort " {{{2
let max_issues = len(self._rawLoclist)
if a:0 && a:1 < max_issues
let max_issues = a:1
@ -148,23 +148,23 @@ function! g:SyntasticLoclist.getFirstError(...) " {{{2
return 0
endfunction " }}}2
function! g:SyntasticLoclist.getName() " {{{2
function! g:SyntasticLoclist.getName() abort " {{{2
return len(self._name)
endfunction " }}}2
function! g:SyntasticLoclist.setName(name) " {{{2
function! g:SyntasticLoclist.setName(name) abort " {{{2
let self._name = a:name
endfunction " }}}2
function! g:SyntasticLoclist.getOwner() " {{{2
function! g:SyntasticLoclist.getOwner() abort " {{{2
return self._owner
endfunction " }}}2
function! g:SyntasticLoclist.setOwner(buffer) " {{{2
function! g:SyntasticLoclist.setOwner(buffer) abort " {{{2
let self._owner = type(a:buffer) == type(0) ? a:buffer : str2nr(a:buffer)
endfunction " }}}2
function! g:SyntasticLoclist.deploy() " {{{2
function! g:SyntasticLoclist.deploy() abort " {{{2
call self.setOwner(bufnr(''))
let self._stamp = syntastic#util#stamp()
for buf in self.getBuffers()
@ -172,19 +172,19 @@ function! g:SyntasticLoclist.deploy() " {{{2
endfor
endfunction " }}}2
function! g:SyntasticLoclist.destroy() " {{{2
function! g:SyntasticLoclist.destroy() abort " {{{2
for buf in self.getBuffers()
call setbufvar(buf, 'syntastic_loclist', {})
endfor
endfunction " }}}2
function! g:SyntasticLoclist.decorate(tag) " {{{2
function! g:SyntasticLoclist.decorate(tag) abort " {{{2
for e in self._rawLoclist
let e['text'] .= ' [' . a:tag . ']'
endfor
endfunction " }}}2
function! g:SyntasticLoclist.balloons() " {{{2
function! g:SyntasticLoclist.balloons() abort " {{{2
if !exists("self._cachedBalloons")
let sep = has("balloon_multiline") ? "\n" : ' | '
@ -207,14 +207,14 @@ function! g:SyntasticLoclist.balloons() " {{{2
return get(self._cachedBalloons, bufnr(''), {})
endfunction " }}}2
function! g:SyntasticLoclist.errors() " {{{2
function! g:SyntasticLoclist.errors() abort " {{{2
if !exists("self._cachedErrors")
let self._cachedErrors = self.filter({'type': "E"})
endif
return self._cachedErrors
endfunction " }}}2
function! g:SyntasticLoclist.warnings() " {{{2
function! g:SyntasticLoclist.warnings() abort " {{{2
if !exists("self._cachedWarnings")
let self._cachedWarnings = self.filter({'type': "W"})
endif
@ -223,12 +223,12 @@ endfunction " }}}2
" Legacy function. Syntastic no longer calls it, but we keep it
" around because other plugins (f.i. powerline) depend on it.
function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() " {{{2
function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() abort " {{{2
return !self.isEmpty()
endfunction " }}}2
" cache used by EchoCurrentError()
function! g:SyntasticLoclist.messages(buf) " {{{2
function! g:SyntasticLoclist.messages(buf) abort " {{{2
if !exists("self._cachedMessages")
let self._cachedMessages = {}
@ -280,14 +280,14 @@ endfunction " }}}2
"would return all errors for buffer 10.
"
"Note that all comparisons are done with ==?
function! g:SyntasticLoclist.filter(filters) " {{{2
function! g:SyntasticLoclist.filter(filters) abort " {{{2
let conditions = values(map(copy(a:filters), 's:_translate(v:key, v:val)'))
let filter = len(conditions) == 1 ?
\ conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
return filter(copy(self._rawLoclist), filter)
endfunction " }}}2
function! g:SyntasticLoclist.setloclist() " {{{2
function! g:SyntasticLoclist.setloclist() abort " {{{2
if !exists('w:syntastic_loclist_set')
let w:syntastic_loclist_set = 0
endif
@ -298,7 +298,7 @@ function! g:SyntasticLoclist.setloclist() " {{{2
endfunction " }}}2
"display the cached errors for this buf in the location list
function! g:SyntasticLoclist.show() " {{{2
function! g:SyntasticLoclist.show() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: show')
call self.setloclist()
@ -333,7 +333,7 @@ endfunction " }}}2
" Public functions {{{1
function! SyntasticLoclistHide() " {{{2
function! SyntasticLoclistHide() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: hide')
silent! lclose
endfunction " }}}2
@ -342,11 +342,11 @@ endfunction " }}}2
" Utilities {{{1
function! s:_translate(key, val) " {{{2
function! s:_translate(key, val) abort " {{{2
return 'get(v:val, ' . string(a:key) . ', "") ==? ' . string(a:val)
endfunction " }}}2
function! s:_set_screen_column(item) " {{{2
function! s:_set_screen_column(item) abort " {{{2
if !has_key(a:item, 'scol')
let col = get(a:item, 'col', 0)
if col != 0 && get(a:item, 'vcol', 0) == 0
@ -363,7 +363,7 @@ function! s:_set_screen_column(item) " {{{2
endif
endfunction " }}}2
function! s:_remove_shadowed_items(errors) " {{{2
function! s:_remove_shadowed_items(errors) abort " {{{2
" keep only the first message at a given column
let i = 0
while i < len(a:errors) - 1
@ -395,7 +395,7 @@ function! s:_remove_shadowed_items(errors) " {{{2
endwhile
endfunction " }}}2
function! s:_compare_error_items_by_columns(a, b) " {{{2
function! s:_compare_error_items_by_columns(a, b) abort " {{{2
if a:a['bufnr'] != a:b['bufnr']
" group by file
return a:a['bufnr'] - a:b['bufnr']
@ -413,7 +413,7 @@ function! s:_compare_error_items_by_columns(a, b) " {{{2
endif
endfunction " }}}2
function! s:_compare_error_items_by_lines(a, b) " {{{2
function! s:_compare_error_items_by_lines(a, b) abort " {{{2
if a:a['bufnr'] != a:b['bufnr']
" group by file
return a:a['bufnr'] - a:b['bufnr']

View File

@ -7,7 +7,7 @@ let g:SyntasticModeMap = {}
" Public methods {{{1
function! g:SyntasticModeMap.Instance() " {{{2
function! g:SyntasticModeMap.Instance() abort " {{{2
if !exists('s:SyntasticModeMapInstance')
let s:SyntasticModeMapInstance = copy(self)
call s:SyntasticModeMapInstance.synch()
@ -16,7 +16,7 @@ function! g:SyntasticModeMap.Instance() " {{{2
return s:SyntasticModeMapInstance
endfunction " }}}2
function! g:SyntasticModeMap.synch() " {{{2
function! g:SyntasticModeMap.synch() abort " {{{2
if exists('g:syntastic_mode_map')
let self._mode = get(g:syntastic_mode_map, 'mode', 'active')
let self._activeFiletypes = copy(get(g:syntastic_mode_map, 'active_filetypes', []))
@ -28,7 +28,7 @@ function! g:SyntasticModeMap.synch() " {{{2
endif
endfunction " }}}2
function! g:SyntasticModeMap.allowsAutoChecking(filetype) " {{{2
function! g:SyntasticModeMap.allowsAutoChecking(filetype) abort " {{{2
let fts = split(a:filetype, '\m\.')
if self.isPassive()
@ -38,7 +38,7 @@ function! g:SyntasticModeMap.allowsAutoChecking(filetype) " {{{2
endif
endfunction " }}}2
function! g:SyntasticModeMap.doAutoChecking() " {{{2
function! g:SyntasticModeMap.doAutoChecking() abort " {{{2
let local_mode = get(b:, 'syntastic_mode', '')
if local_mode ==# 'active' || local_mode ==# 'passive'
return local_mode ==# 'active'
@ -47,11 +47,11 @@ function! g:SyntasticModeMap.doAutoChecking() " {{{2
return self.allowsAutoChecking(&filetype)
endfunction " }}}2
function! g:SyntasticModeMap.isPassive() " {{{2
function! g:SyntasticModeMap.isPassive() abort " {{{2
return self._mode ==# 'passive'
endfunction " }}}2
function! g:SyntasticModeMap.toggleMode() " {{{2
function! g:SyntasticModeMap.toggleMode() abort " {{{2
call self.synch()
if self._mode ==# 'active'
@ -67,12 +67,12 @@ function! g:SyntasticModeMap.toggleMode() " {{{2
let g:syntastic_mode_map['mode'] = self._mode
endfunction " }}}2
function! g:SyntasticModeMap.echoMode() " {{{2
function! g:SyntasticModeMap.echoMode() abort " {{{2
echo "Syntastic: " . self._mode . " mode enabled"
endfunction " }}}2
function! g:SyntasticModeMap.modeInfo(filetypes) " {{{2
echomsg 'Syntastic version: ' . g:_SYNTASTIC_VERSION
function! g:SyntasticModeMap.modeInfo(filetypes) abort " {{{2
echomsg 'Syntastic version: ' . g:_SYNTASTIC_VERSION . ' (Vim ' . v:version . ', ' . g:_SYNTASTIC_UNAME . ')'
let type = len(a:filetypes) ? a:filetypes[0] : &filetype
echomsg 'Info for filetype: ' . type
@ -104,11 +104,11 @@ endfunction " }}}2
" Private methods {{{1
function! g:SyntasticModeMap._isOneFiletypeActive(filetypes) " {{{2
function! g:SyntasticModeMap._isOneFiletypeActive(filetypes) abort " {{{2
return !empty(filter(copy(a:filetypes), 'index(self._activeFiletypes, v:val) != -1'))
endfunction " }}}2
function! g:SyntasticModeMap._noFiletypesArePassive(filetypes) " {{{2
function! g:SyntasticModeMap._noFiletypesArePassive(filetypes) abort " {{{2
return empty(filter(copy(a:filetypes), 'index(self._passiveFiletypes, v:val) != -1'))
endfunction " }}}2

View File

@ -13,7 +13,7 @@ lockvar! s:_PERSISTENT_NOTIFIERS
" Public methods {{{1
function! g:SyntasticNotifiers.Instance() " {{{2
function! g:SyntasticNotifiers.Instance() abort " {{{2
if !exists('s:SyntasticNotifiersInstance')
let s:SyntasticNotifiersInstance = copy(self)
call s:SyntasticNotifiersInstance._initNotifiers()
@ -22,7 +22,7 @@ function! g:SyntasticNotifiers.Instance() " {{{2
return s:SyntasticNotifiersInstance
endfunction " }}}2
function! g:SyntasticNotifiers.refresh(loclist) " {{{2
function! g:SyntasticNotifiers.refresh(loclist) abort " {{{2
if !a:loclist.isEmpty() && !a:loclist.isNewerThan([])
" loclist not fully constructed yet
return
@ -48,7 +48,7 @@ function! g:SyntasticNotifiers.refresh(loclist) " {{{2
endfor
endfunction " }}}2
function! g:SyntasticNotifiers.reset(loclist) " {{{2
function! g:SyntasticNotifiers.reset(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'notifiers: reset')
for type in self._enabled_types
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
@ -71,7 +71,7 @@ endfunction " }}}2
" Private methods {{{1
function! g:SyntasticNotifiers._initNotifiers() " {{{2
function! g:SyntasticNotifiers._initNotifiers() abort " {{{2
let self._notifier = {}
for type in s:_NOTIFIER_TYPES
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')

View File

@ -73,8 +73,8 @@ let s:_DEFAULT_CHECKERS = {
\ 'scss': ['sass', 'scss_lint'],
\ 'sh': ['sh', 'shellcheck'],
\ 'slim': ['slimrb'],
\ 'sml': ['smlnj'],
\ 'spec': ['rpmlint'],
\ 'swift': ['xcrun'],
\ 'tcl': ['nagelfar'],
\ 'tex': ['lacheck', 'chktex'],
\ 'texinfo': ['makeinfo'],
@ -137,7 +137,7 @@ let g:SyntasticRegistry = {}
" parameters, all private methods take normalized filetypes. Public methods
" are thus supposed to normalize filetypes before calling private methods.
function! g:SyntasticRegistry.Instance() " {{{2
function! g:SyntasticRegistry.Instance() abort " {{{2
if !exists('s:SyntasticRegistryInstance')
let s:SyntasticRegistryInstance = copy(self)
let s:SyntasticRegistryInstance._checkerMap = {}
@ -146,7 +146,7 @@ function! g:SyntasticRegistry.Instance() " {{{2
return s:SyntasticRegistryInstance
endfunction " }}}2
function! g:SyntasticRegistry.CreateAndRegisterChecker(args) " {{{2
function! g:SyntasticRegistry.CreateAndRegisterChecker(args) abort " {{{2
let checker = g:SyntasticChecker.New(a:args)
let registry = g:SyntasticRegistry.Instance()
call registry._registerChecker(checker)
@ -156,7 +156,7 @@ endfunction " }}}2
" If hints_list is empty, user settings are are used instead. Checkers are
" not checked for availability (that is, the corresponding IsAvailable() are
" not run).
function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) " {{{2
function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) abort " {{{2
let ft = s:_normalise_filetype(a:ftalias)
call self._loadCheckersFor(ft)
@ -179,11 +179,11 @@ endfunction " }}}2
" Same as getCheckers(), but keep only the checkers available. This runs the
" corresponding IsAvailable() functions for all checkers.
function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) " {{{2
function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) abort " {{{2
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()')
endfunction " }}}2
function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
function! g:SyntasticRegistry.getKnownFiletypes() abort " {{{2
let types = keys(s:_DEFAULT_CHECKERS)
call extend(types, keys(s:_DEFAULT_FILETYPE_MAP))
@ -199,13 +199,13 @@ function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
return syntastic#util#unique(types)
endfunction " }}}2
function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2
function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) abort " {{{2
let ft = s:_normalise_filetype(a:ftalias)
call self._loadCheckersFor(ft)
return keys(filter( copy(self._checkerMap[ft]), 'v:val.isAvailable()' ))
endfunction " }}}2
function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2
function! g:SyntasticRegistry.echoInfoFor(ftalias_list) abort " {{{2
let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:_normalise_filetype(v:val)' ))
if len(ft_list) != 1
let available = []
@ -274,11 +274,11 @@ function! g:SyntasticRegistry._registerChecker(checker) abort " {{{2
let self._checkerMap[ft][name] = a:checker
endfunction " }}}2
function! g:SyntasticRegistry._filterCheckersByName(checkers_map, list) " {{{2
function! g:SyntasticRegistry._filterCheckersByName(checkers_map, list) abort " {{{2
return filter( map(copy(a:list), 'get(a:checkers_map, v:val, {})'), '!empty(v:val)' )
endfunction " }}}2
function! g:SyntasticRegistry._loadCheckersFor(filetype) " {{{2
function! g:SyntasticRegistry._loadCheckersFor(filetype) abort " {{{2
if has_key(self._checkerMap, a:filetype)
return
endif
@ -291,7 +291,7 @@ function! g:SyntasticRegistry._loadCheckersFor(filetype) " {{{2
endfunction " }}}2
" Check for obsolete variable g:syntastic_<filetype>_checker
function! g:SyntasticRegistry._checkDeprecation(filetype) " {{{2
function! g:SyntasticRegistry._checkDeprecation(filetype) abort " {{{2
if exists('g:syntastic_' . a:filetype . '_checker') && !exists('g:syntastic_' . a:filetype . '_checkers')
let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker]
call syntastic#log#oneTimeWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated')
@ -304,14 +304,14 @@ endfunction " }}}2
"resolve filetype aliases, and replace - with _ otherwise we cant name
"syntax checker functions legally for filetypes like "gentoo-metadata"
function! s:_normalise_filetype(ftalias) " {{{2
function! s:_normalise_filetype(ftalias) abort " {{{2
let ft = get(s:_DEFAULT_FILETYPE_MAP, a:ftalias, a:ftalias)
let ft = get(g:syntastic_filetype_map, ft, ft)
let ft = substitute(ft, '\m-', '_', 'g')
return ft
endfunction " }}}2
function! s:_disabled_by_eclim(filetype) " {{{2
function! s:_disabled_by_eclim(filetype) abort " {{{2
if index(s:_ECLIM_TYPES, a:filetype) >= 0
let lang = toupper(a:filetype[0]) . a:filetype[1:]
let ft = a:filetype !=# 'cpp' ? lang : 'C'
@ -321,7 +321,7 @@ function! s:_disabled_by_eclim(filetype) " {{{2
return 0
endfunction " }}}2
function! s:_disabled_by_ycm(filetype) " {{{2
function! s:_disabled_by_ycm(filetype) abort " {{{2
return index(s:_YCM_TYPES, a:filetype) >= 0
endfunction " }}}2

View File

@ -19,7 +19,7 @@ let s:setup_done = 0
" Public methods {{{1
function! g:SyntasticSignsNotifier.New() " {{{2
function! g:SyntasticSignsNotifier.New() abort " {{{2
let newObj = copy(self)
if !s:setup_done
@ -31,11 +31,11 @@ function! g:SyntasticSignsNotifier.New() " {{{2
return newObj
endfunction " }}}2
function! g:SyntasticSignsNotifier.enabled() " {{{2
function! g:SyntasticSignsNotifier.enabled() abort " {{{2
return has('signs') && syntastic#util#var('enable_signs')
endfunction " }}}2
function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2
function! g:SyntasticSignsNotifier.refresh(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'signs: refresh')
let old_signs = copy(self._bufSignIds())
if self.enabled()
@ -49,7 +49,7 @@ endfunction " }}}2
" Private methods {{{1
" One time setup: define our own sign types and highlighting
function! g:SyntasticSignsNotifier._setup() " {{{2
function! g:SyntasticSignsNotifier._setup() abort " {{{2
if has('signs')
if !hlexists('SyntasticErrorSign')
highlight link SyntasticErrorSign error
@ -83,7 +83,7 @@ function! g:SyntasticSignsNotifier._setup() " {{{2
endfunction " }}}2
" Place signs by all syntax errors in the buffer
function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2
function! g:SyntasticSignsNotifier._signErrors(loclist) abort " {{{2
let loclist = a:loclist
if !loclist.isEmpty()
@ -116,7 +116,7 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2
endfunction " }}}2
" Remove the signs with the given ids from this buffer
function! g:SyntasticSignsNotifier._removeSigns(ids) " {{{2
function! g:SyntasticSignsNotifier._removeSigns(ids) abort " {{{2
if has('signs')
for s in reverse(copy(a:ids))
execute "sign unplace " . s
@ -126,7 +126,7 @@ function! g:SyntasticSignsNotifier._removeSigns(ids) " {{{2
endfunction " }}}2
" Get all the ids of the SyntaxError signs in the buffer
function! g:SyntasticSignsNotifier._bufSignIds() " {{{2
function! g:SyntasticSignsNotifier._bufSignIds() abort " {{{2
if !exists("b:syntastic_private_sign_ids")
let b:syntastic_private_sign_ids = []
endif

View File

@ -146,7 +146,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
let fname = expand('%:p:h', 1) . syntastic#util#Slash() . expand ('%:t', 1)
if has('win32unix')
let fname = s:CygwinPath(fname)
let fname = syntastic#util#CygwinPath(fname)
endif
let makeprg = self.makeprgBuild({
@ -155,9 +155,9 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
" unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types
let errorformat =
\ '%E%f:%l:\ error:\ %m,'.
\ '%W%f:%l:\ warning:\ %m,'.
\ '%A%f:%l:\ %m,'.
\ '%E%f:%l: error: %m,'.
\ '%W%f:%l: warning: %m,'.
\ '%A%f:%l: %m,'.
\ '%+Z%p^,'.
\ '%+C%.%#,'.
\ '%-G%.%#'
@ -179,10 +179,6 @@ endfunction " }}}1
" Utilities {{{1
function! s:CygwinPath(path) " {{{2
return substitute(system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g')
endfunction " }}}2
function! s:RemoveCarriageReturn(line) " {{{2
return substitute(a:line, "\r", '', 'g')
endfunction " }}}2
@ -360,13 +356,14 @@ function! s:GetMavenClasspath() " {{{2
let mvn_properties = s:GetMavenProperties()
let output_dir = 'target/classes'
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 mvn_classpath = s:AddToClasspath(mvn_classpath, output_dir)
let test_output_dir = 'target/test-classes'
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
@ -388,21 +385,23 @@ function! s:MavenOutputDirectory() " {{{2
if has_key(mvn_properties, 'project.properties.build.dir')
let output_dir = mvn_properties['project.properties.build.dir']
endif
if stridx(expand('%:p:h', 1), 'src.main.java') >= 0
let output_dir .= '/target/classes'
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
endif
if stridx(expand('%:p:h', 1), 'src.test.java') >= 0
let output_dir .= '/target/test-classes'
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
endif
if has('win32unix')
let output_dir = s:CygwinPath(output_dir)
let output_dir = syntastic#util#CygwinPath(output_dir)
endif
return output_dir
endif

View File

@ -0,0 +1,47 @@
"============================================================================
"File: standard.vim
"Description: JavaScript syntax checker - using standard
"Maintainer: LCD 47 <lcd047@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_javascript_standard_checker")
finish
endif
let g:loaded_syntastic_javascript_standard_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_standard_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 6, 1])
endfunction
function! SyntaxCheckers_javascript_standard_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args': '-v' })
let errorformat = ' %f:%l:%c: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'defaults': {'type': 'W'},
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'standard'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -22,7 +22,7 @@ function! SyntaxCheckers_json_jsonval_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat =
\ '%E%f:\ %m\ at\ line\ %l,' .
\ '%E%f: %m at line %l,' .
\ '%-G%.%#'
return SyntasticMake({

View File

@ -21,7 +21,7 @@ set cpo&vim
function! SyntaxCheckers_nasm_nasm_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '-X gnu -f elf' .
\ ' -I ' . syntastic#util#shescape(expand('%:p:h', 1) . '/') .
\ ' -I ' . syntastic#util#shescape(expand('%:p:h', 1) . syntastic#util#Slash()) .
\ ' ' . syntastic#c#NullOutput() })
let errorformat = '%f:%l: %t%*[^:]: %m'

View File

@ -46,7 +46,7 @@ endfunction " }}}1
function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1
let makeprg = s:GetMakeprg()
if makeprg == ""
if makeprg == ''
return []
endif

View File

@ -44,7 +44,7 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict
let e['text'] .= printf(' [%s%03d]', e['type'], e['nr'])
" E901 are syntax errors
" E902 are I/O errors
if e['type'] ==? 'E' && e['nr'] !~ '\m^9'
if e['type'] ==? 'E' && e['nr'] !~# '\m^9'
let e['subtype'] = 'Style'
endif
call remove(e, 'nr')

View File

@ -62,7 +62,7 @@ function! SyntaxCheckers_r_lint_GetLocList() dict
\ 'returns': [0] })
for e in loclist
if e['type'] == 'F'
if e['type'] ==? 'F'
" parse error
let e['type'] = 'E'
call remove(e, 'subtype')

View File

@ -26,7 +26,7 @@ function! SyntaxCheckers_ruby_reek_IsAvailable() dict
endfunction
function! SyntaxCheckers_ruby_reek_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_before': '--no-color --quiet --line-number --single-line' })
let makeprg = self.makeprgBuild({ 'args_before': '--no-color --line-number --single-line' })
let errorformat =
\ '%E%.%#: Racc::ParseError: %f:%l :: %m,' .
@ -34,7 +34,8 @@ function! SyntaxCheckers_ruby_reek_GetLocList() dict
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
\ 'errorformat': errorformat,
\ 'returns': [0, 2] })
for e in loclist
if e['type'] ==? 'W'

View File

@ -23,7 +23,9 @@ function! SyntaxCheckers_ruby_rubylint_GetLocList() dict
if !exists('s:rubylint_new')
let s:rubylint_new = syntastic#util#versionIsAtLeast(self.getVersion(), [2])
endif
let makeprg = self.makeprgBuild({ 'args': (s:rubylint_new ? '' : 'analyze ') . '--presenter=syntastic' })
let makeprg = self.makeprgBuild({
\ 'args': (s:rubylint_new ? '' : 'analyze '),
\ 'args_after': '--presenter=syntastic' })
let errorformat = '%f:%t:%l:%c: %m'

View File

@ -28,14 +28,14 @@ function! SyntaxCheckers_slim_slimrb_GetLocList() dict
if s:slimrb_new
let errorformat =
\ '%C\ %#%f\, Line %l\, Column %c,'.
\ '%-G\ %.%#,'.
\ '%C %#%f\, Line %l\, Column %c,'.
\ '%-G %.%#,'.
\ '%ESlim::Parser::SyntaxError: %m,'.
\ '%+C%.%#'
else
let errorformat =
\ '%C\ %#%f\, Line %l,'.
\ '%-G\ %.%#,'.
\ '%C %#%f\, Line %l,'.
\ '%-G %.%#,'.
\ '%ESlim::Parser::SyntaxError: %m,'.
\ '%+C%.%#'
endif

View File

@ -1,46 +1,45 @@
"============================================================================
"File: xcrun.vim
"Description: swift syntax checker - using xcrun
"Maintainer: Tom Fogg <tom@canobe.com>
"File: smlnj.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_swift_xcrun_checker")
if exists("g:loaded_syntastic_sml_smlnj_checker")
finish
endif
let g:loaded_syntastic_xcrun_checker = 1
let g:loaded_syntastic_sml_smlnj_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_swift_xcrun_GetLocList() dict
function! SyntaxCheckers_sml_smlnj_GetLocList() dict
let makeprg = self.makeprgBuild({})
let makeprg = self.makeprgBuild({ 'args_after': 'swift' })
let errorformat=
\ '%f:%l:%c:{%*[^}]}: %trror: %m,'.
\ '%f:%l:%c:{%*[^}]}: fatal %trror: %m,'.
\ '%f:%l:%c:{%*[^}]}: %tarning: %m,'.
\ '%f:%l:%c: %trror: %m,'.
\ '%f:%l:%c: fatal %trror: %m,'.
\ '%f:%l:%c: %tarning: %m,'.
\ '%f:%l: %trror: %m,'.
\ '%f:%l: fatal %trror: %m,'.
\ '%f:%l: %tarning: %m,' .
let errorformat =
\ '%E%f:%l%\%.%c %trror: %m,' .
\ '%E%f:%l%\%.%c-%\d%\+%\%.%\d%\+ %trror: %m,' .
\ '%W%f:%l%\%.%c %tarning: %m,' .
\ '%W%f:%l%\%.%c-%\d%\+%\%.%\d%\+ %tarning: %m,' .
\ '%C%\s%\+%m,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
\ 'errorformat': errorformat,
\ 'postprocess': ['compressWhitespace'],
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'swift',
\ 'name': 'xcrun'})
\ 'filetype': 'sml',
\ 'name': 'smlnj',
\ 'exec': 'sml'})
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -0,0 +1,55 @@
"============================================================================
"File: vint.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_vim_vint_checker")
finish
endif
let g:loaded_syntastic_vim_vint_checker = 1
if !exists('g:syntastic_vim_vint_sort')
let g:syntastic_vim_vint_sort = 1
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_vim_vint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'post_args': '--json' })
let errorformat = '%f:%l:%c:%t: %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'vint',
\ 'returns': [0, 1] })
for e in loclist
if e['type'] ==? 's'
let e['type'] = 'w'
let e['subtype'] = 'Style'
elseif e['type'] !=? 'e' && e['type'] !=? 'w'
let e['type'] = 'e'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'vim',
\ 'name': 'vint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker: