Merge commit '347aeab113ea37edbdfdd80210a0adec130efb4d' into main

main
Buddy Sandidge 10 years ago
commit b6768cb961

@ -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,18 +52,23 @@ 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,
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,
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, 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.
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,
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].
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
@ -183,10 +189,32 @@ 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`.
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.
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)).
A third possible reason is that the `$PATH` seen by syntastic might not be same
as the `$PATH` in your login shell. Syntastic runs checkers using the shell
pointed to by Vim's `shell` (or by `g:syntastic_shell`, if set), and that's the
shell you need to configure to set the proper `$PATH` and environment variables
for your checkers. You can see syntastic's idea of `$PATH` by running
```vim
:echo syntastic#util#system('echo "$PATH"')
```
on UNIX and Mac OS-X systems, or
```vim
:echo syntastic#util#system('echo %PATH%')
```
on Windows.
Finally, 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 post an [issue][4] - or better yet, create a pull request.
<a name="faqpython3"></a>
@ -204,8 +232,10 @@ __4.3. Q. Are there any local checkers for HTML5 that I can use with syntastic?_
[HTML Tidy][18] has a fork named [HTML Tidy for HTML5][19]. It's a drop
in replacement, and syntastic can use it without changes. Just install it
somewhere and point `g:syntastic_html_tidy_exec` to its executable.
somewhere and point `g:syntastic_html_tidy_exec` to its executable:
```vim
let g:syntastic_html_tidy_exec = 'tidy5'
```
Alternatively, you can install [vnu.jar][21] from the [validator.nu][20]
project and run it as a [HTTP server][23]:
```sh
@ -236,14 +266,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 +292,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 +308,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 +349,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 +379,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 +391,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 +403,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
@ -374,7 +411,7 @@ work around it:
```vim
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
cabbrev <silent> bd lclose\|bdelete
cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>
```
<a name="otherresources"></a>
@ -404,18 +441,24 @@ 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
[16]: https://github.com/junegunn/vim-plug/
[17]: https://github.com/gmarik/Vundle.vim
[18]: http://tidy.sourceforge.net/
[19]: http://w3c.github.io/tidy-html5/
[19]: http://www.htacg.org/tidy-html5/
[20]: http://about.validator.nu/
[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
[28]: https://github.com/venantius/vim-eastwood
[29]: https://github.com/rhysd/vim-crystal
<!--
vim:tw=79:sw=4:

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_c_autoload") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_c_autoload') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_c_autoload = 1
@ -10,19 +10,19 @@ 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
let config = findfile(a:file, '.;')
if config == ''
let config = findfile(a:file, escape(expand('%:p:h', 1), ' ') . ';')
if config ==# ''
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file not found')
return ''
endif
@ -44,7 +44,7 @@ function! syntastic#c#ReadConfig(file) " {{{2
endtry
" filter out empty lines and comments
call filter(lines, 'v:val !~ ''\v^(\s*#|$)''')
call filter(lines, 'v:val !~# ''\v^(\s*#|$)''')
" remove leading and trailing spaces
call map(lines, 'substitute(v:val, ''\m^\s\+'', "", "")')
@ -53,7 +53,7 @@ function! syntastic#c#ReadConfig(file) " {{{2
let parameters = []
for line in lines
let matches = matchstr(line, '\m\C^\s*-I\s*\zs.\+')
if matches != ''
if matches !=# ''
" this one looks like an absolute path
if match(matches, '\m^\%(/\|\a:\)') != -1
call add(parameters, '-I' . matches)
@ -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,22 +118,22 @@ 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)
let handler["args"] = a:args
let handler['regex'] = a:regex
let handler['func'] = function(a:function)
let handler['args'] = a:args
call add(s:handlers, handler)
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
let pkg_flags = system('pkg-config --cflags ' . pkg)
let pkg_flags = syntastic#util#system('pkg-config --cflags ' . pkg)
" since we cannot necessarily trust the pkg-config exit code
" we have to check for an error output as well
if v:shell_error == 0 && pkg_flags !~? 'not found'
@ -150,10 +150,10 @@ 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')
let s:cflags['php'] = syntastic#util#system('php-config --includes')
let s:cflags['php'] = ' ' . substitute(s:cflags['php'], "\n", '', '')
endif
return s:cflags['php']
@ -162,10 +162,10 @@ 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 ' .
let s:cflags['python'] = syntastic#util#system('python -c ''from distutils import ' .
\ 'sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())''')
let s:cflags['python'] = substitute(s:cflags['python'], "\n", '', '')
let s:cflags['python'] = ' -I' . s:cflags['python']
@ -176,10 +176,10 @@ 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 ' .
let s:cflags['ruby'] = syntastic#util#system('ruby -r rbconfig -e ' .
\ '''puts RbConfig::CONFIG["rubyhdrdir"] || RbConfig::CONFIG["archdir"]''')
let s:cflags['ruby'] = substitute(s:cflags['ruby'], "\n", '', '')
let s:cflags['ruby'] = ' -I' . s:cflags['ruby']
@ -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)
@ -223,10 +223,10 @@ function! s:_get_cflags(ft, ck, opts) " {{{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 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)
if a:ft ==# 'c' || a:ft ==# 'cpp'
" 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()
@ -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 = []
@ -280,15 +280,15 @@ function! s:_search_headers() " {{{2
" search current buffer
for line in lines
let file = matchstr(line, '\m"\zs\S\+\ze"')
if file != ''
if file !=# ''
call add(files, file)
continue
endif
for handler in s:handlers
if line =~# handler["regex"]
let includes .= call(handler["func"], handler["args"])
call add(found, handler["regex"])
if line =~# handler['regex']
let includes .= call(handler['func'], handler['args'])
call add(found, handler['regex'])
break
endif
endfor
@ -296,7 +296,7 @@ function! s:_search_headers() " {{{2
" search included headers
for hfile in files
if hfile != ''
if hfile !=# ''
let filename = expand('%:p:h', 1) . syntastic#util#Slash() . hfile
try
@ -308,14 +308,14 @@ function! s:_search_headers() " {{{2
call filter(lines, 'v:val =~# ''\m^\s*#\s*include''')
for handler in s:handlers
if index(found, handler["regex"]) != -1
if index(found, handler['regex']) != -1
continue
endif
for line in lines
if line =~# handler["regex"]
let includes .= call(handler["func"], handler["args"])
call add(found, handler["regex"])
if line =~# handler['regex']
let includes .= call(handler['func'], handler['args'])
call add(found, handler['regex'])
break
endif
endfor

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_log_autoload") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_log_autoload') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_log_autoload = 1
@ -10,24 +10,24 @@ let s:one_time_notices_issued = []
" Public functions {{{1
function! syntastic#log#info(msg) " {{{2
echomsg "syntastic: info: " . a:msg
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
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
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
@ -88,7 +88,7 @@ function! syntastic#log#debugShowOptions(level, names) " {{{2
let leader = s:_log_timestamp()
call s:_logRedirect(1)
let vlist = copy(type(a:names) == type("") ? [a:names] : a:names)
let vlist = copy(type(a:names) == type('') ? [a:names] : a:names)
if !empty(vlist)
call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))")
echomsg leader . join(vlist, ', ')
@ -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
@ -104,10 +104,10 @@ function! syntastic#log#debugShowVariables(level, names) " {{{2
let leader = s:_log_timestamp()
call s:_logRedirect(1)
let vlist = type(a:names) == type("") ? [a:names] : a:names
let vlist = type(a:names) == type('') ? [a:names] : a:names
for name in vlist
let msg = s:_format_variable(name)
if msg != ''
if msg !=# ''
echomsg leader . msg
endif
endfor
@ -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,8 +139,8 @@ endfunction " }}}2
let s:_isDebugEnabled = function(exists('*and') ? 's:_isDebugEnabled_smart' : 's:_isDebugEnabled_dumb')
lockvar s:_isDebugEnabled
function! s:_logRedirect(on) " {{{2
if exists("g:syntastic_debug_file")
function! s:_logRedirect(on) abort " {{{2
if exists('g:syntastic_debug_file')
if a:on
try
execute 'redir >> ' . fnameescape(expand(g:syntastic_debug_file, 1))
@ -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})))

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_postprocess_autoload") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_postprocess_autoload') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_postprocess_autoload = 1
@ -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 = {}

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_preprocess_autoload") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_preprocess_autoload') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_preprocess_autoload = 1
@ -8,19 +8,19 @@ 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
if star
if err == ''
if err ==# ''
let star = 0
else
let out[-1] .= ' ' . err
endif
else
call add(out, err)
if err =~ '\m^*\s'
if err =~# '\m^*\s'
let star = 1
endif
endif
@ -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,23 +55,28 @@ 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
let null = ''
let 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, ''))
let errs = eval(join(a:errors[idx :], ''))
catch
let errs = {}
endtry
@ -88,7 +93,7 @@ function! syntastic#preprocess#flow(errors) " {{{2
\ m['path'] . ':' .
\ m['line'] . ':' .
\ m['start'] . ':' .
\ (m['line'] ==# m['endline'] ? m['end'] . ':' : '') .
\ (m['line'] ==# m['endline'] && str2nr(m['end']) > 0 ? m['end'] . ':' : '') .
\ ' ' . m['descr']
if len(t)
@ -123,11 +128,18 @@ endfunction " }}}2
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)
function! syntastic#preprocess#killEmpty(errors) " {{{2
return filter(copy(a:errors), 'v:val != ""')
function! syntastic#preprocess#iconv(errors) abort " {{{2
return
\ (has('iconv') || has('iconv/dyn')) && &encoding !=# '' && &encoding !=# 'utf-8' ?
\ map(a:errors, 'iconv(v:val, "utf-8", &encoding)') :
\ a:errors
endfunction " }}}2
function! syntastic#preprocess#perl(errors) " {{{2
function! syntastic#preprocess#killEmpty(errors) abort " {{{2
return filter(copy(a:errors), 'v:val !=# ""')
endfunction " }}}2
function! syntastic#preprocess#perl(errors) abort " {{{2
let out = []
for e in a:errors
@ -143,7 +155,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,7 +170,8 @@ function! syntastic#preprocess#prospector(errors) " {{{2
endtry
let out = []
if type(errs) == type({}) && has_key(errs, 'messages') && type(errs['messages']) == type([])
if type(errs) == type({}) && has_key(errs, 'messages')
if type(errs['messages']) == type([])
for e in errs['messages']
if type(e) == type({})
try
@ -189,6 +202,7 @@ function! syntastic#preprocess#prospector(errors) " {{{2
else
call syntastic#log#warn('checker python/prospector: unknown error format')
endif
endif
return out
endfunction " }}}2
@ -196,16 +210,16 @@ 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
let i = 0
while i < len(errlist)
if i > 0 && errlist[i][:1] == ' ' && errlist[i] !~ '\m\s\+\^$'
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
@ -222,7 +236,7 @@ function! syntastic#preprocess#rparse(errors) " {{{2
call add(out, 'E:' . fname . ':' . line . ': ' . parts[1])
endfor
endif
if len(parts) >= 5 && parts[4] != ''
if len(parts) >= 5 && parts[4] !=# ''
call add(out, 'E:' . fname . ':0: ' . parts[1] . ' - ' . parts[4] . ' messages not shown')
endif
elseif match(e, '\m^Lint checking: ') == 0
@ -235,11 +249,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 +268,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

@ -1,4 +1,4 @@
if exists('g:loaded_syntastic_util_autoload') || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_util_autoload') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_util_autoload = 1
@ -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
@ -21,28 +21,51 @@ endfunction " }}}2
" Get directory separator
function! syntastic#util#Slash() abort " {{{2
return (!exists("+shellslash") || &shellslash) ? '/' : '\'
return (!exists('+shellslash') || &shellslash) ? '/' : '\'
endfunction " }}}2
function! syntastic#util#CygwinPath(path) abort " {{{2
return substitute(syntastic#util#system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g')
endfunction " }}}2
function! syntastic#util#system(command) abort " {{{2
let old_shell = &shell
let old_lc_messages = $LC_MESSAGES
let old_lc_all = $LC_ALL
let &shell = syntastic#util#var('shell')
let $LC_MESSAGES = 'C'
let $LC_ALL = ''
let out = system(a:command)
let $LC_ALL = old_lc_all
let $LC_MESSAGES = old_lc_messages
let &shell = old_shell
return out
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')
" TODO: option "-t" to mktemp(1) is not portable
let tmp = $TMPDIR != '' ? $TMPDIR : $TMP != '' ? $TMP : '/tmp'
let out = split(system('mktemp -q -d ' . tmp . '/vim-syntastic-' . getpid() . '-XXXXXXXX'), "\n")
let tmp = $TMPDIR !=# '' ? $TMPDIR : $TMP !=# '' ? $TMP : '/tmp'
let out = split(syntastic#util#system('mktemp -q -d ' . tmp . '/vim-syntastic-' . getpid() . '-XXXXXXXX'), "\n")
if v:shell_error == 0 && len(out) == 1
let tempdir = out[0]
endif
endif
if tempdir == ''
if tempdir ==# ''
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())
elseif $TMPDIR != ''
let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . getpid())
elseif $TMPDIR !=# ''
let tempdir = $TMPDIR . '/vim-syntastic-' . getpid()
else
let tempdir = '/tmp/vim-syntastic-' . getpid()
@ -60,7 +83,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
@ -74,8 +97,8 @@ function! syntastic#util#rmrf(what) " {{{2
\ has('win16') || has('win95') || has('dos16') || has('dos32') ? 'deltree /Y' : ''
endif
if s:rmrf != ''
silent! call system(s:rmrf . ' ' . syntastic#util#shescape(a:what))
if s:rmrf !=# ''
silent! call syntastic#util#system(s:rmrf . ' ' . syntastic#util#shescape(a:what))
else
call s:_rmrf(a:what)
endif
@ -94,10 +117,10 @@ 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 =~ '^#!'
if line =~# '^#!'
let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '')
let exe = matchstr(line, '\m^\S*\ze')
let args = split(matchstr(line, '\m^\S*\zs.*'))
@ -109,7 +132,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,8 +140,8 @@ function! syntastic#util#var(name, ...) " {{{2
endfunction " }}}2
" Parse a version string. Return an array of version components.
function! syntastic#util#parseVersion(version) " {{{2
return map(split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)')
function! syntastic#util#parseVersion(version, ...) abort " {{{2
return map(split(matchstr( a:version, a:0 ? a:1 : '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)')
endfunction " }}}2
" Verify that the 'installed' version is at least the 'required' version.
@ -127,13 +150,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))
@ -141,7 +164,7 @@ function! syntastic#util#compareLexi(a, b) " {{{2
return a_element > b_element ? 1 : -1
endif
endfor
" Everything matched, so it is at least the required version.
" still here, thus everything matched
return 0
endfunction " }}}2
@ -150,7 +173,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,13 +184,13 @@ 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
"This is here because it is possible for some error messages to
"begin with \n which will cause a "press enter" prompt.
let msg = substitute(a:msg, "\n", "", "g")
let msg = substitute(a:msg, "\n", '', 'g')
"convert tabs to spaces so that the tabs count towards the window
"width as the proper amount of characters
@ -185,7 +208,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)
@ -203,13 +226,15 @@ function! syntastic#util#bufIsActive(buffer) " {{{2
return 0
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
" start in directory a:where and walk up the parent folders until it finds a
" file matching a:what; return path to that file; do NOT use this function if
" a:what doesn't contain wildcards, use findfile(a:what, escape(a:where, ' ') . ';')
" instead
function! syntastic#util#findInParent(what, where) abort " {{{2
let here = fnamemodify(a:where, ':p')
let root = syntastic#util#Slash()
if syntastic#util#isRunningWindows() && here[1] == ':'
if syntastic#util#isRunningWindows() && here[1] ==# ':'
" The drive letter is an ever-green source of fun. That's because
" we don't care about running syntastic on Amiga these days. ;)
let root = fnamemodify(root, ':p')
@ -217,7 +242,7 @@ function! syntastic#util#findInParent(what, where) " {{{2
endif
let old = ''
while here != ''
while here !=# ''
let p = split(globpath(here, a:what, 1), '\n')
if !empty(p)
@ -237,7 +262,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,18 +275,18 @@ 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
if type(a:opt) == type('') && a:opt != ''
function! syntastic#util#argsescape(opt) abort " {{{2
if type(a:opt) == type('') && a:opt !=# ''
return [a:opt]
elseif type(a:opt) == type([])
return map(copy(a:opt), 'syntastic#util#shescape(v:val)')
@ -271,7 +296,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 +306,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 +314,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
@ -300,18 +325,17 @@ function! syntastic#util#dictFilter(errors, filter) " {{{2
endtry
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
return reltime(g:_SYNTASTIC_START)
" Return a [seconds, fractions] list of strings, representing the
" (hopefully high resolution) time since program start
function! syntastic#util#stamp() abort " {{{2
return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' )
endfunction " }}}2
" }}}1
" 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([])
@ -322,14 +346,14 @@ function! s:_translateFilter(filters) " {{{2
endfor
if conditions == []
let conditions = ["1"]
let conditions = ['1']
endif
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] == '!'
if fkey[0] ==# '!'
let fkey = fkey[1:]
let not = 1
else
@ -354,18 +378,18 @@ function! s:_translateElement(key, term) " {{{2
let op = not ? ' =~# ' : ' !~# '
let ret = 'bufname(str2nr(v:val["bufnr"]))'
let mod = fkey[4:]
if mod != ''
if mod !=# ''
let ret = 'fnamemodify(' . ret . ', ' . string(mod) . ')'
endif
let ret .= op . string(a:term)
else
call syntastic#log#warn('quiet_messages: ignoring invalid key ' . strtrans(string(fkey)))
let ret = "1"
let ret = '1'
endif
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
@ -378,7 +402,7 @@ function! s:_rmrf(what) " {{{2
for f in split(globpath(a:what, '*', 1), "\n")
call s:_rmrf(f)
endfor
silent! call system(s:rmdir . ' ' . syntastic#util#shescape(a:what))
silent! call syntastic#util#system(s:rmdir . ' ' . syntastic#util#shescape(a:what))
else
silent! call delete(a:what)
endif

@ -39,16 +39,23 @@ CONTENTS *syntastic-contents*
6.Notes........................................|syntastic-notes|
6.1.Handling of composite filetypes........|syntastic-composite|
6.2.Editing files over network.............|syntastic-netrw|
6.3.Interaction with python-mode...........|syntastic-pymode|
6.4.Interaction with YouCompleteMe.........|syntastic-ycm|
6.5.Interaction with the fish shell........|syntastic-fish|
6.6.Interaction with PowerShell............|syntastic-powershell|
6.7.Using syntastic with the fizsh shell...|syntastic-fizsh|
6.8.Interaction with Eclim.................|syntastic-eclim|
6.9.Interaction with vim-virtualenv........|syntastic-vim-virtualenv|
6.10.Interaction with vim-auto-save........|syntastic-vim-auto-save|
7.About........................................|syntastic-about|
8.License......................................|syntastic-license|
6.3.The 'shellslash' option................|syntastic-shellslash|
6.4.Saving Vim sessions....................|syntastic-sessions|
7.Compatibility with other software............|syntastic-compatibility|
7.1.The csh and tcsh shells................|syntastic-csh|
7.2.Eclim..................................|syntastic-eclim|
7.3.The fish shell.........................|syntastic-fish|
7.4.The fizsh shell........................|syntastic-fizsh|
7.5.powerline..............................|syntastic-powerline|
7.6.The PowerShell shell...................|syntastic-powershell|
7.7.python-mode............................|syntastic-pymode|
7.8.vim-auto-save..........................|syntastic-vim-auto-save|
7.9.vim-go.................................|syntastic-vim-go|
7.10.vim-virtualenv........................|syntastic-vim-virtualenv|
7.11.YouCompleteMe.........................|syntastic-ycm|
7.12.The zsh shell and rvm.................|syntastic-zsh|
8.About........................................|syntastic-about|
9.License......................................|syntastic-license|
==============================================================================
@ -602,6 +609,20 @@ looking at their exit codes. The "cmd.exe" shell on Windows make these checks
meaningless, by returning 1 to Vim when the checkers exit with non-zero codes.
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
compatible shells are "zsh", "bash", "ksh", and of course the original Bourne
"sh".
This shell is independent of Vim's 'shell', and it isn't used for interactive
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_debug'*
Default: 0
Set this to the sum of one or more of the following flags to enable
@ -782,96 +803,162 @@ of operation. It can only check files that can be accessed directly by local
checkers, without any translation or conversion.
------------------------------------------------------------------------------
6.3 Interaction with python-mode *syntastic-pymode*
6.3 The 'shellslash' option *syntastic-shellslash*
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
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
"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.
------------------------------------------------------------------------------
6.4 Saving Vim sessions *syntastic-sessions*
If you use |:mksession| to save Vim sessions you should probably make sure to
remove option "blank" from 'sessionoptions': >
set sessionoptions-=blank
<
This will prevent |:mksession| from saving |syntastic-error-window| as empty
quickfix windows.
==============================================================================
7. Compatibility with other software *syntastic-compatibility*
------------------------------------------------------------------------------
6.4 Interaction with YouCompleteMe *syntastic-ycm*
7.1 The csh and tcsh shells *syntastic-csh*
Syntastic can be used together with the 'YouCompleteMe' Vim plugin (see
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.: >
let g:ycm_show_diagnostics_ui = 0
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,
such as "zsh", "bash", "ksh", or even the original Bourne "sh": >
let g:syntastic_shell = "/bin/sh"
<
------------------------------------------------------------------------------
6.5 Interaction with the fish shell *syntastic-fish*
7.2. Eclim *syntastic-eclim*
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 don't need to change your login
shell to address this problem, but you do have to point Vim's 'shell' to a more
traditional shell, such as "zsh", "bash", "ksh", or even the original Bourne
"sh": >
set shell=bash
Syntastic can be used together with "Eclim" (see http://eclim.org/). However,
by default Eclim disables syntastic's checks for the filetypes it supports, in
order to run its own validation. If you'd prefer to use Eclim but still run
syntastic's checks, set |g:EclimFileTypeValidate| to 0: >
let g:EclimFileTypeValidate = 0
<
It is also possible to re-enable syntastic checks only for some filetypes, and
run Eclim's validation for others. Please consult Eclim's documentation for
details.
------------------------------------------------------------------------------
6.6. Interaction with PowerShell *syntastic-powershell*
7.3 The fish shell *syntastic-fish*
At the time of this writing, syntastic is not compatible with using 'Windows
PowerShell' (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's
'shell'. You may still run Vim from 'PowerShell', but you do have to point
Vim's 'shell' to a more traditional program, such as 'cmd.exe': >
set shell=cmd.exe
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|
to a more traditional shell, such as "zsh", "bash", "ksh", or even the
original Bourne "sh": >
let g:syntastic_shell = "/bin/sh"
<
------------------------------------------------------------------------------
6.7. Using syntastic with the fizsh shell *syntastic-fizsh*
7.4. The fizsh shell *syntastic-fizsh*
Using syntastic with the 'fizsh' shell (see https://github.com/zsh-users/fizsh)
Using syntastic with the "fizsh" shell (see https://github.com/zsh-users/fizsh)
is possible, but potentially problematic. In order to do it you'll need to set
'shellredir' like this: >
set shellredir=>%s\ 2>&1
<
Please keep in mind however that Vim can't take advantage of any of the
interactive features of 'fizsh'. Using a more traditional shell such as "zsh",
interactive features of "fizsh". Using a more traditional shell such as "zsh",
"bash", "ksh", or the original Bourne "sh" might be a better choice: >
set shell=zsh
let g:syntastic_shell = "/bin/sh"
<
------------------------------------------------------------------------------
6.8. Interaction with Eclim *syntastic-eclim*
7.5. powerline *syntastic-powerline*
The "powerline" Vim plugin (https://github.com/powerline/powerline) comes
packaged with a syntastic segment. To customize this segment create a file
~/.config/powerline/themes/vim/default.json, with a content like this: >
{
"segment_data" : {
"powerline.segments.vim.plugin.syntastic.syntastic" : {
"args" : {
"err_format" : "Err: {first_line} #{num} ",
"warn_format" : "Warn: {first_line} #{num} "
}
}
}
}
<
------------------------------------------------------------------------------
7.6. The PowerShell shell *syntastic-powershell*
Syntastic can be used together with 'Eclim' (see http://eclim.org/). However,
by default Eclim disables syntastic's checks for the filetypes it supports, in
order to run its own validation. If you'd prefer to use Eclim but still run
syntastic's checks, set |g:EclimFileTypeValidate| to 0: >
let g:EclimFileTypeValidate = 0
At the time of this writing, syntastic is not compatible with using "Windows
PowerShell" (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's
'shell'. You may still run Vim from 'PowerShell', but you do have to point
Vim's 'shell' to a more traditional program, such as "cmd.exe": >
set shell=cmd.exe
<
It is also possible to re-enable syntastic checks only for some filetypes, and
run Eclim's validation for others. Please consult Eclim's documentation for
details.
------------------------------------------------------------------------------
7.7 python-mode *syntastic-pymode*
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
<
------------------------------------------------------------------------------
7.8. vim-auto-save *syntastic-vim-auto-save*
Syntastic can be used together with the "vim-auto-save" Vim plugin (see
https://github.com/907th/vim-auto-save). However, syntastic checks in active
mode only work with "vim-auto-save" version 0.1.7 or later.
------------------------------------------------------------------------------
6.9. Interaction with vim-virtualenv *syntastic-vim-virtualenv*
7.9. vim-go *syntastic-vim-go*
The "vim-go" Vim plugin (https://github.com/fatih/vim-go) uses |quickfix|
lists, and thus doesn't conflict with syntastic (which uses |location-list|
lists). However, both "vim-go" and syntastic run syntax checks by default
when you save buffers to disk, and this can have confusing results. To
avoid both plugins opening error windows, you can either set passive
mode for go in syntastic (see |syntastic_mode_map|), or prevent "vim-go"
from showing a quickfix window when |g:go_fmt_command| fails, by setting
|g:go_fmt_fail_silently| to 1. E.g.: >
let g:go_fmt_fail_silently = 1
<
------------------------------------------------------------------------------
7.10. vim-virtualenv *syntastic-vim-virtualenv*
At the time of this writing, syntastic can't run checkers installed
in Python virtual environments activated by 'vim-virtualenv' (see
in Python virtual environments activated by "vim-virtualenv" (see
https://github.com/jmcantrell/vim-virtualenv). This is a limitation of
'vim-virtualenv'.
"vim-virtualenv".
------------------------------------------------------------------------------
7.11 YouCompleteMe *syntastic-ycm*
Syntastic can be used together with the "YouCompleteMe" Vim plugin (see
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.: >
let g:ycm_show_diagnostics_ui = 0
<
------------------------------------------------------------------------------
6.10. Interaction with vim-auto-save *syntastic-vim-auto-save*
At the time of this writing, syntastic checks in active mode are not triggered
by 'vim-auto-save' (see https://github.com/907th/vim-auto-save). The reason is
a limitation in 'vim-auto-save', namely a missing flag to an 'autocmd' (see
|autocmd-nested|). Fortunately it's pretty easy to achieve a similar effect
without 'vim-auto-save'': >
augroup syntastic
autocmd CursorHold * nested update
augroup END
set updatetime=200
7.12 The zsh shell and rvm *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 set your shell to
"sh": >
let g:syntastic_shell = "/bin/sh"
<
==============================================================================
7. About *syntastic-about*
8. About *syntastic-about*
The core maintainers of syntastic are:
Martin Grenfell (GitHub: scrooloose)
@ -883,9 +970,9 @@ Find the latest version of syntastic at:
http://github.com/scrooloose/syntastic
==============================================================================
8. License *syntastic-license*
9. License *syntastic-license*
Syntastic is released under the wtfpl.
Syntastic is released under the WTFPL.
See http://sam.zoy.org/wtfpl/COPYING.
vim:tw=78:sw=4:ft=help:norl:

@ -9,7 +9,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_plugin = 1
@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.6.0-5'
let g:_SYNTASTIC_VERSION = '3.6.0-102'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1
@ -34,7 +34,7 @@ for s:feature in [
\ 'user_commands'
\ ]
if !has(s:feature)
call syntastic#log#error("need Vim compiled with feature " . s:feature)
call syntastic#log#error('need Vim compiled with feature ' . s:feature)
finish
endif
endfor
@ -42,15 +42,25 @@ endfor
let s:_running_windows = syntastic#util#isRunningWindows()
lockvar s:_running_windows
if !s:_running_windows && executable('uname')
if !exists('g:syntastic_shell')
let g:syntastic_shell = &shell
endif
if s:_running_windows
let g:_SYNTASTIC_UNAME = 'Windows'
elseif executable('uname')
try
let s:_uname = system('uname')
let g:_SYNTASTIC_UNAME = split(syntastic#util#system('uname'), "\n")[0]
catch /\m^Vim\%((\a\+)\)\=:E484/
call syntastic#log#error("your shell " . &shell . " can't handle traditional UNIX syntax for redirections")
call syntastic#log#error("your shell " . syntastic#util#var('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
@ -61,7 +71,6 @@ let g:_SYNTASTIC_DEFAULTS = {
\ 'always_populate_loc_list': 0,
\ 'auto_jump': 0,
\ 'auto_loc_list': 2,
\ 'bash_hack': 0,
\ 'check_on_open': 0,
\ 'check_on_wq': 1,
\ 'cursor_columns': 1,
@ -71,7 +80,7 @@ let g:_SYNTASTIC_DEFAULTS = {
\ 'enable_highlighting': 1,
\ 'enable_signs': 1,
\ 'error_symbol': '>>',
\ 'exit_checks': !(s:_running_windows && &shell =~? '\m\<cmd\.exe$'),
\ 'exit_checks': !(s:_running_windows && syntastic#util#var('shell', &shell) =~? '\m\<cmd\.exe$'),
\ 'filetype_map': {},
\ 'full_redraws': !(has('gui_running') || has('gui_macvim')),
\ 'id_checkers': 1,
@ -80,6 +89,7 @@ let g:_SYNTASTIC_DEFAULTS = {
\ 'loc_list_height': 10,
\ 'quiet_messages': {},
\ 'reuse_loc_lists': 0,
\ 'shell': &shell,
\ 'sort_aggregated_errors': 1,
\ 'stl_format': '[Syntax: line:%F (%t)]',
\ 'style_error_symbol': 'S>',
@ -94,7 +104,7 @@ for s:key in keys(g:_SYNTASTIC_DEFAULTS)
endif
endfor
if exists("g:syntastic_quiet_warnings")
if exists('g:syntastic_quiet_warnings')
call syntastic#log#oneTimeWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead")
if g:syntastic_quiet_warnings
let s:quiet_warnings = get(g:syntastic_quiet_messages, 'type', [])
@ -152,7 +162,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 +177,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 +195,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,32 +243,32 @@ 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("")))))
\ 'autocmd: BufReadPost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
call s:UpdateErrors(1, [])
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("")))))
\ '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("")))) .
\ 'autocmd: BufEnter, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))) .
\ ', &buftype = ' . string(&buftype))
if &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
let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1')
let owner = str2nr(getbufvar(bufnr(""), 'syntastic_owner_buffer'))
let owner = str2nr(getbufvar(bufnr(''), 'syntastic_owner_buffer'))
let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : []))
if get(w:, 'syntastic_loclist_set', 0) && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
call SyntasticLoclistHide()
@ -266,9 +276,9 @@ 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("")))))
\ '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')
if get(w:, 'syntastic_loclist_set', 0)
call SyntasticLoclistHide()
@ -280,7 +290,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)
@ -294,6 +304,9 @@ function! s:UpdateErrors(auto_invoked, checker_names) " {{{2
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
endif
let loclist = g:SyntasticLoclist.current()
@ -325,7 +338,7 @@ function! s:UpdateErrors(auto_invoked, checker_names) " {{{2
" order, which can lead to missing filetype when jumping
" to a new file; the following is a workaround for the
" resulting brain damage
if &filetype == ''
if &filetype ==# ''
silent! filetype detect
endif
endif
@ -336,13 +349,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 +364,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,20 +466,15 @@ 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
let old_shellredir = &shellredir
let old_local_errorformat = &l:errorformat
let old_errorformat = &errorformat
let old_cwd = getcwd()
let old_lc_messages = $LC_MESSAGES
let old_lc_all = $LC_ALL
" }}}3
call s:_bash_hack()
if has_key(a:options, 'errorformat')
let &errorformat = a:options['errorformat']
endif
@ -479,23 +488,19 @@ 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
let $LC_MESSAGES = 'C'
let $LC_ALL = ''
" }}}3
let err_lines = split(system(a:options['makeprg']), "\n", 1)
let err_lines = split(syntastic#util#system(a:options['makeprg']), "\n", 1)
" restore environment variables {{{3
let $LC_ALL = old_lc_all
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
@ -540,10 +545,9 @@ function! SyntasticMake(options) " {{{2
" restore options {{{3
let &errorformat = old_errorformat
let &l:errorformat = old_local_errorformat
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 +586,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 +594,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,9 +610,9 @@ 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 != '') ||
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
if skip
@ -618,7 +622,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)
@ -626,7 +630,7 @@ function! s:_explain_skip(filetypes) " {{{2
if get(b:, 'syntastic_skip_checks', 0)
call add(why, 'b:syntastic_skip_checks set')
endif
if &buftype != ''
if &buftype !=# ''
call add(why, 'buftype = ' . string(&buftype))
endif
if !filereadable(fname)
@ -647,7 +651,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])
@ -659,30 +663,8 @@ function! s:_add_to_errors(errors, options) " {{{2
return a:errors
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
if g:syntastic_bash_hack
if !exists('s:shell_is_bash')
let s:shell_is_bash =
\ !s:_running_windows &&
\ (s:_os_name() !~# "FreeBSD") && (s:_os_name() !~# "OpenBSD") &&
\ &shell =~# '\m\<bash$'
endif
if s:shell_is_bash
let &shellredir = '&>'
endif
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

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_autoloclist") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifier_autoloclist') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifier_autoloclist = 1
@ -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

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_balloons") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifier_balloons') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifier_balloons = 1
@ -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

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_checker") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_checker') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_checker = 1
@ -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,32 +40,56 @@ 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.getExec() abort " {{{2
return self._exec
endfunction " }}}2
function! g:SyntasticChecker.getExecEscaped() " {{{2
return syntastic#util#shescape(self.getExec())
function! g:SyntasticChecker.getExecEscaped() abort " {{{2
return syntastic#util#shescape(self._exec)
endfunction " }}}2
function! g:SyntasticChecker.getLocListRaw() " {{{2
function! g:SyntasticChecker.getLocListRaw() abort " {{{2
let name = self._filetype . '/' . self._name
try
let list = self._locListFunc()
if self._exec !=# ''
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' returned ' . v:shell_error)
endif
catch /\m\C^Syntastic: checker error$/
let list = []
if self._exec !=# ''
call syntastic#log#error('checker ' . name . ' returned abnormal status ' . v:shell_error)
else
call syntastic#log#error('checker ' . name . ' aborted')
endif
endtry
call self._populateHighlightRegexes(list)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, name . ' raw:', list)
@ -73,16 +97,15 @@ 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)
call syntastic#log#debug( g:_SYNTASTIC_DEBUG_CHECKERS,
\ self._filetype . '/' . self._name . ': output of ' . string(command) . ': ' .
let version_output = syntastic#util#system(command)
call self.log('getVersion: ' . string(command) . ': ' .
\ string(split(version_output, "\n", 1)) .
\ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : '') )
call self.setVersion(syntastic#util#parseVersion(version_output))
@ -90,7 +113,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)
@ -99,7 +122,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)
@ -108,7 +131,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 = []
@ -121,20 +144,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
@ -144,7 +168,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({})
@ -169,12 +193,12 @@ 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']
let term = self._highlightRegexFunc(e)
if term != ''
if term !=# ''
let e['hl'] = term
endif
endif
@ -182,7 +206,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) )) )

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_cursor") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifier_cursor') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifier_cursor = 1
@ -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

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_highlighting") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifier_highlighting') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifier_highlighting = 1
@ -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
" Sets error highlights in the current window
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'])

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_loclist") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_loclist') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_loclist = 1
@ -7,13 +7,13 @@ 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')
for e in llist
if get(e, 'type', '') == ''
if get(e, 'type', '') ==# ''
let e['type'] = 'E'
endif
endfor
@ -27,20 +27,20 @@ function! g:SyntasticLoclist.New(rawLoclist) " {{{2
return newObj
endfunction " }}}2
function! g:SyntasticLoclist.current() " {{{2
if !exists("b:syntastic_loclist") || empty(b:syntastic_loclist)
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,39 +52,39 @@ 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
if !exists("self._stamp")
function! g:SyntasticLoclist.isNewerThan(stamp) abort " {{{2
if !exists('self._stamp')
let self._stamp = []
return 0
endif
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
if !exists("self._stl_format")
function! g:SyntasticLoclist.getStatuslineFlag() abort " {{{2
if !exists('self._stl_format')
let self._stl_format = ''
endif
if !exists("self._stl_flag")
if !exists('self._stl_flag')
let self._stl_flag = ''
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,21 +172,21 @@ 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
if !exists("self._cachedBalloons")
let sep = has("balloon_multiline") ? "\n" : ' | '
function! g:SyntasticLoclist.balloons() abort " {{{2
if !exists('self._cachedBalloons')
let sep = has('balloon_multiline') ? "\n" : ' | '
let self._cachedBalloons = {}
for e in self._rawLoclist
@ -207,29 +207,29 @@ function! g:SyntasticLoclist.balloons() " {{{2
return get(self._cachedBalloons, bufnr(''), {})
endfunction " }}}2
function! g:SyntasticLoclist.errors() " {{{2
if !exists("self._cachedErrors")
let self._cachedErrors = self.filter({'type': "E"})
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
if !exists("self._cachedWarnings")
let self._cachedWarnings = self.filter({'type': "W"})
function! g:SyntasticLoclist.warnings() abort " {{{2
if !exists('self._cachedWarnings')
let self._cachedWarnings = self.filter({'type': 'W'})
endif
return self._cachedWarnings
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
if !exists("self._cachedMessages")
function! g:SyntasticLoclist.messages(buf) abort " {{{2
if !exists('self._cachedMessages')
let self._cachedMessages = {}
let errors = self.errors() + self.warnings()
@ -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,15 +298,15 @@ 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()
if !self.isEmpty()
let num = winnr()
execute "lopen " . syntastic#util#var('loc_list_height')
execute 'lopen ' . syntastic#util#var('loc_list_height')
if num != winnr()
wincmd p
execute num . 'wincmd w'
endif
" try to find the loclist window and set w:quickfix_title
@ -320,7 +320,7 @@ function! g:SyntasticLoclist.show() " {{{2
" errors == getloclist(0) is the only somewhat safe way to
" achieve that
if strpart(title, 0, 16) ==# ':SyntasticCheck ' ||
\ ( (title == '' || title ==# ':setloclist()') && errors == getloclist(0) )
\ ( (title ==# '' || title ==# ':setloclist()') && errors == getloclist(0) )
call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name)
call setbufvar(buf, 'syntastic_owner_buffer', self._owner)
endif
@ -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']

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_modemap") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_modemap') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_modemap = 1
@ -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
echo "Syntastic: " . self._mode . " mode enabled"
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

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifiers") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifiers') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifiers = 1
@ -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', '')

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_registry") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_registry') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_registry = 1
@ -6,8 +6,9 @@ let g:loaded_syntastic_registry = 1
" Initialisation {{{1
let s:_DEFAULT_CHECKERS = {
\ 'actionscript':['mxmlc'],
\ 'actionscript': ['mxmlc'],
\ 'ada': ['gcc'],
\ 'apiblueprint': ['snowcrash'],
\ 'applescript': ['osacompile'],
\ 'asciidoc': ['asciidoc'],
\ 'asm': ['gcc'],
@ -52,7 +53,9 @@ let s:_DEFAULT_CHECKERS = {
\ 'lua': ['luac'],
\ 'markdown': ['mdl'],
\ 'matlab': ['mlint'],
\ 'mercury': ['mmc'],
\ 'nasm': ['nasm'],
\ 'nix': ['nix'],
\ 'nroff': ['mandoc'],
\ 'objc': ['gcc'],
\ 'objcpp': ['gcc'],
@ -73,6 +76,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'scss': ['sass', 'scss_lint'],
\ 'sh': ['sh', 'shellcheck'],
\ 'slim': ['slimrb'],
\ 'sml': ['smlnj'],
\ 'spec': ['rpmlint'],
\ 'tcl': ['nagelfar'],
\ 'tex': ['lacheck', 'chktex'],
@ -91,7 +95,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'yaml': ['jsyaml'],
\ 'z80': ['z80syntaxchecker'],
\ 'zpt': ['zptlint'],
\ 'zsh': ['zsh', 'shellcheck'],
\ 'zsh': ['zsh'],
\ }
lockvar! s:_DEFAULT_CHECKERS
@ -102,6 +106,7 @@ let s:_DEFAULT_FILETYPE_MAP = {
\ 'litcoffee': 'coffee',
\ 'mail': 'text',
\ 'mkd': 'markdown',
\ 'pe-puppet': 'puppet',
\ 'sgml': 'docbk',
\ 'sgmllnx': 'docbk',
\ }
@ -136,7 +141,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 = {}
@ -145,7 +150,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)
@ -155,7 +160,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)
@ -178,11 +183,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))
@ -198,13 +203,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 = []
@ -273,16 +278,16 @@ 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
execute "runtime! syntax_checkers/" . a:filetype . "/*.vim"
execute 'runtime! syntax_checkers/' . a:filetype . '/*.vim'
if !has_key(self._checkerMap, a:filetype)
let self._checkerMap[a:filetype] = {}
@ -290,7 +295,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')
@ -303,14 +308,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'
@ -320,7 +325,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

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_signs") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifier_signs') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifier_signs = 1
@ -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()
@ -107,7 +107,7 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2
let sign_subtype = get(i, 'subtype', '')
let sign_type = 'Syntastic' . sign_subtype . sign_severity
execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr']
execute 'sign place ' . s:next_sign_id . ' line=' . i['lnum'] . ' name=' . sign_type . ' buffer=' . i['bufnr']
call add(self._bufSignIds(), s:next_sign_id)
let s:next_sign_id += 1
endif
@ -116,18 +116,18 @@ 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
execute 'sign unplace ' . s
call remove(self._bufSignIds(), index(self._bufSignIds(), s))
endfor
endif
endfunction " }}}2
" Get all the ids of the SyntaxError signs in the buffer
function! g:SyntasticSignsNotifier._bufSignIds() " {{{2
if !exists("b:syntastic_private_sign_ids")
function! g:SyntasticSignsNotifier._bufSignIds() abort " {{{2
if !exists('b:syntastic_private_sign_ids')
let b:syntastic_private_sign_ids = []
endif
return b:syntastic_private_sign_ids

@ -37,7 +37,7 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item)
endif
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict

@ -0,0 +1,66 @@
"============================================================================
"File: snowcrash.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_apiblueprint_snowcrash_checker')
finish
endif
let g:loaded_syntastic_apiblueprint_snowcrash_checker = 1
if !exists('g:syntastic_apiblueprint_snowcrash_sort')
let g:syntastic_apiblueprint_snowcrash_sort = 1
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_apiblueprint_snowcrash_GetLocList() dict
let makeprg = self.makeprgBuild({ 'post_args': '-u -l' })
let errorformat =
\ '%trror: (%n) %m,' .
\ '%tarning: (%n) %m,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 2] })
for e in loclist
let matches = matchlist(e['text'], '\v^(.+); line (\d+), column (\d+) - line (\d+), column (\d+)$')
if len(matches) > 5
let e['lnum'] = str2nr(matches[2])
let e['col'] = str2nr(matches[3])
let e['vcol'] = 0
if matches[2] == matches[4]
let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . matches[5] . 'c'
endif
let e['text'] = matches[1]
else
let e['valid'] = 0
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'apiblueprint',
\ 'name': 'snowcrash'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -25,7 +25,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_applescript_osacompile_checker")
if exists('g:loaded_syntastic_applescript_osacompile_checker')
finish
endif
let g:loaded_syntastic_applescript_osacompile_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_asciidoc_asciidoc_checker")
if exists('g:loaded_syntastic_asciidoc_asciidoc_checker')
finish
endif
let g:loaded_syntastic_asciidoc_asciidoc_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_bemhtml_bemhtmllint_checker")
if exists('g:loaded_syntastic_bemhtml_bemhtmllint_checker')
finish
endif

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_bro_bro_checker")
if exists('g:loaded_syntastic_bro_bro_checker')
finish
endif
let g:loaded_syntastic_bro_bro_checker = 1
@ -20,7 +20,7 @@ set cpo&vim
function! SyntaxCheckers_bro_bro_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m at or near "\zs[^"]\+\ze"')
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_bro_bro_IsAvailable() dict
@ -28,7 +28,7 @@ function! SyntaxCheckers_bro_bro_IsAvailable() dict
return 0
endif
if system(self.getExecEscaped() . ' --help') !~# '--parse-only'
if syntastic#util#system(self.getExecEscaped() . ' --help') !~# '--parse-only'
call self.log('unknown option "--parse-only"')
return 0
endif

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_checkpatch_checker")
if exists('g:loaded_syntastic_c_checkpatch_checker')
finish
endif
let g:loaded_syntastic_c_checkpatch_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_clang_check_checker")
if exists('g:loaded_syntastic_c_clang_check_checker')
finish
endif
let g:loaded_syntastic_c_clang_check_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_clang_tidy_checker")
if exists('g:loaded_syntastic_c_clang_tidy_checker')
finish
endif
let g:loaded_syntastic_c_clang_tidy_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_cppcheck_checker")
if exists('g:loaded_syntastic_c_cppcheck_checker')
finish
endif
let g:loaded_syntastic_c_cppcheck_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_oclint_checker")
if exists('g:loaded_syntastic_c_oclint_checker')
finish
endif
let g:loaded_syntastic_c_oclint_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_c_pc_lint_checker")
if exists('g:loaded_syntastic_c_pc_lint_checker')
finish
endif
let g:loaded_syntastic_c_pc_lint_checker = 1
@ -23,7 +23,7 @@ if !exists('g:syntastic_pc_lint_config_file')
endif
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
let config = findfile(g:syntastic_pc_lint_config_file, '.;')
let config = findfile(g:syntastic_pc_lint_config_file, escape(expand('%:p:h', 1), ' ') . ';')
call self.log('config =', config)
" -hFs1 - show filename, add space after messages, try to make message 1 line

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_sparse_checker")
if exists('g:loaded_syntastic_c_sparse_checker')
finish
endif
let g:loaded_syntastic_c_sparse_checker = 1
@ -33,7 +33,7 @@ function! SyntaxCheckers_c_sparse_GetLocList() dict
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")},
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
return loclist
endfunction

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_splint_checker")
if exists('g:loaded_syntastic_c_splint_checker')
finish
endif
let g:loaded_syntastic_c_splint_checker = 1

@ -20,11 +20,11 @@ set cpo&vim
function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item)
let field = matchstr(a:item['text'], "\\vParse of field '\\zs[^']+")
if field != ''
if field !=# ''
return '\v\c^\s*' . field . '\s*:\s*\zs.*$'
endif
let field = matchstr(a:item['text'], "\\v(^|\\s)'\\zs[^']+\\ze'")
if field != ''
if field !=# ''
return '\V\c\<' . escape(field, '\') . '\>'
endif
return ''

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_chef_foodcritic_checker")
if exists('g:loaded_syntastic_chef_foodcritic_checker')
finish
endif
let g:loaded_syntastic_chef_foodcritic_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_co_coco_checker")
if exists('g:loaded_syntastic_co_coco_checker')
finish
endif
let g:loaded_syntastic_co_coco_checker = 1

@ -13,7 +13,7 @@
" Note: this script requires CoffeeScript version 1.6.2 or newer.
"
if exists("g:loaded_syntastic_coffee_coffee_checker")
if exists('g:loaded_syntastic_coffee_coffee_checker')
finish
endif
let g:loaded_syntastic_coffee_coffee_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_coffee_coffeelint_checker")
if exists('g:loaded_syntastic_coffee_coffeelint_checker')
finish
endif
let g:loaded_syntastic_coffee_coffeelint_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_coq_coqtop_checker")
if exists('g:loaded_syntastic_coq_coqtop_checker')
finish
endif
let g:loaded_syntastic_coq_coqtop_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_cpp_clang_check_checker")
if exists('g:loaded_syntastic_cpp_clang_check_checker')
finish
endif
let g:loaded_syntastic_cpp_clang_check_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_cpp_clang_tidy_checker")
if exists('g:loaded_syntastic_cpp_clang_tidy_checker')
finish
endif
let g:loaded_syntastic_cpp_clang_tidy_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_cpp_cppcheck_checker")
if exists('g:loaded_syntastic_cpp_cppcheck_checker')
finish
endif
let g:loaded_syntastic_cpp_cppcheck_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_cpp_cpplint_checker")
if exists('g:loaded_syntastic_cpp_cpplint_checker')
finish
endif
let g:loaded_syntastic_cpp_cpplint_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_cpp_oclint_checker")
if exists('g:loaded_syntastic_cpp_oclint_checker')
finish
endif
let g:loaded_syntastic_cpp_oclint_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_cpp_pc_lint_checker")
if exists('g:loaded_syntastic_cpp_pc_lint_checker')
finish
endif
let g:loaded_syntastic_cpp_pc_lint_checker = 1

@ -0,0 +1,48 @@
"============================================================================
"File: verapp.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Lucas Verney <phyks@phyks.me>
"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.
"
" Tested with Vera++ 1.3.0
"============================================================================
if exists('g:loaded_syntastic_cpp_verapp_checker')
finish
endif
let g:loaded_syntastic_cpp_verapp_checker = 1
if !exists('g:syntastic_verapp_config_file')
let g:syntastic_verapp_config_file = '.syntastic_verapp_config'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cpp_verapp_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': syntastic#c#ReadConfig(g:syntastic_verapp_config_file),
\ 'args_after': '--show-rule --no-duplicate -S -c -' })
let errorformat = '%f:%t:%l:%c:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'checkstyle',
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'verapp',
\ 'exec': 'vera++'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_cs_mcs_checker")
if exists('g:loaded_syntastic_cs_mcs_checker')
finish
endif
let g:loaded_syntastic_cs_mcs_checker = 1
@ -26,7 +26,7 @@ function! SyntaxCheckers_cs_mcs_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -33,7 +33,7 @@ function! SyntaxCheckers_css_csslint_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
endfunction

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_css_phpcs_checker")
if exists('g:loaded_syntastic_css_phpcs_checker')
finish
endif
let g:loaded_syntastic_css_phpcs_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_css_prettycss_checker")
if exists('g:loaded_syntastic_css_prettycss_checker')
finish
endif
let g:loaded_syntastic_css_prettycss_checker = 1
@ -23,8 +23,8 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item)
let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$')
if term != ''
let term = matchstr(a:item['text'], '\m (\zs[^)]\+\ze)$')
if term !=# ''
let term = '\V' . escape(term, '\')
endif
return term
@ -42,10 +42,10 @@ function! SyntaxCheckers_css_prettycss_GetLocList() dict
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
for e in loclist
let e["text"] .= ')'
let e['text'] .= ')'
endfor
return loclist

@ -11,7 +11,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_css_recess_checker")
if exists('g:loaded_syntastic_css_recess_checker')
finish
endif
let g:loaded_syntastic_css_recess_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_cucumber_cucumber_checker")
if exists('g:loaded_syntastic_cucumber_cucumber_checker')
finish
endif
let g:loaded_syntastic_cucumber_cucumber_checker = 1

@ -6,7 +6,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_cuda_nvcc_checker")
if exists('g:loaded_syntastic_cuda_nvcc_checker')
finish
endif
let g:loaded_syntastic_cuda_nvcc_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_dart_dartanalyzer_checker")
if exists('g:loaded_syntastic_dart_dartanalyzer_checker')
finish
endif
let g:loaded_syntastic_dart_dartanalyzer_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_docbk_xmllint_checker")
if exists('g:loaded_syntastic_docbk_xmllint_checker')
finish
endif
let g:loaded_syntastic_docbk_xmllint_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_dustjs_swiffer_checker")
if exists('g:loaded_syntastic_dustjs_swiffer_checker')
finish
endif

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_elixir_elixir_checker")
if exists('g:loaded_syntastic_elixir_elixir_checker')
finish
endif
let g:loaded_syntastic_elixir_elixir_checker = 1
@ -35,7 +35,7 @@ function! SyntaxCheckers_elixir_elixir_GetLocList() dict
let make_options = {}
let compile_command = 'elixir'
let mix_file = syntastic#util#findInParent('mix.exs', expand('%:p:h', 1))
let mix_file = findfile('mix.exs', escape(expand('%:p:h', 1), ' ') . ';')
if filereadable(mix_file)
let compile_command = 'mix compile'
@ -44,7 +44,9 @@ function! SyntaxCheckers_elixir_elixir_GetLocList() dict
let make_options['makeprg'] = self.makeprgBuild({ 'exe': compile_command })
let make_options['errorformat'] = '** %*[^\ ] %f:%l: %m'
let make_options['errorformat'] =
\ '%E** %*[^\ ] %f:%l: %m,' .
\ '%W%f:%l: warning: %m'
return SyntasticMake(make_options)
endfunction

@ -1,56 +1,66 @@
#!/usr/bin/env escript
-export([main/1]).
main([FileName]) ->
LibDirs = (["ebin", "include", "src", "test"] ++
filelib:wildcard("{apps,deps,lib}/*/{ebin,include}")),
compile(FileName, LibDirs);
main([File]) ->
Dir = get_root(filename:dirname(File)),
Defs = [strong_validation,
warn_export_all,
warn_export_vars,
warn_shadow_vars,
warn_obsolete_guard,
warn_unused_import,
report,
{i, Dir ++ "/include"}],
RebarFile = rebar_file(Dir),
RebarOpts = rebar_opts(Dir ++ "/" ++ RebarFile),
code:add_patha(filename:absname("ebin")),
compile:file(File, Defs ++ RebarOpts);
main([FileName, "-rebar", Path, LibDirs]) ->
{ok, L} = file:consult(Path),
P = dict:from_list(L),
Root = filename:dirname(Path),
main(_) ->
io:format("Usage: ~s <file>~n", [escript:script_name()]),
halt(1).
Lib1 = case dict:find(lib_dirs, P) of
{ok, X} -> lists:map(fun(Sub) -> Root ++ "/" ++ Sub end, X);
_ -> []
end,
rebar_file(Dir) ->
DirList = filename:split(Dir),
case lists:last(DirList) of
"test" ->
"rebar.test.config";
_ ->
"rebar.config"
end.
Lib2 = case dict:find(sub_dirs, P) of
{ok, Y} -> lists:foldl(
fun(Sub,Sofar) ->
Sofar ++ [
Root ++ "/" ++ Sub,
Root ++ "/" ++ Sub ++ "/include",
Root ++ "/" ++ Sub ++ "/deps",
Root ++ "/" ++ Sub ++ "/lib"
] end, [], Y);
_ -> []
end,
rebar_opts(RebarFile) ->
Dir = get_root(filename:dirname(RebarFile)),
case file:consult(RebarFile) of
{ok, Terms} ->
RebarLibDirs = proplists:get_value(lib_dirs, Terms, []),
lists:foreach(
fun(LibDir) ->
code:add_pathsa(filelib:wildcard(LibDir ++ "/*/ebin"))
end, RebarLibDirs),
RebarDepsDir = proplists:get_value(deps_dir, Terms, "deps"),
code:add_pathsa(filelib:wildcard(RebarDepsDir ++ "/*/ebin")),
IncludeDeps = {i, filename:join(Dir, RebarDepsDir)},
proplists:get_value(erl_opts, Terms, []) ++ [IncludeDeps];
{error, _} when RebarFile == "rebar.config" ->
fallback_opts();
{error, _} ->
rebar_opts("rebar.config")
end.
LibDirs1 = LibDirs ++ Lib1 ++ Lib2,
%io:format("~p~n", [LibDirs1]),
compile(FileName, LibDirs1);
fallback_opts() ->
code:add_pathsa(filelib:wildcard("deps/*/ebin")),
code:add_pathsa(nested_app_ebins()),
[
{ i, filename:absname("apps") }, { i, filename:absname("deps") } | [ { i, filename:absname(Path) } || Path <- filelib:wildcard("deps/*/apps")]
].
main([FileName | LibDirs]) ->
compile(FileName, LibDirs).
nested_app_ebins() ->
DetectedAppSrcFiles = filelib:wildcard("deps/*/apps/**/*.app.src"),
[apps_dir_from_src(AppSrcFile)||AppSrcFile<-DetectedAppSrcFiles].
compile(FileName, LibDirs) ->
Root = get_root(filename:dirname(FileName)),
ok = code:add_pathsa(LibDirs),
compile:file(FileName,
[warn_obsolete_guard,
warn_unused_import,
warn_shadow_vars,
warn_export_vars,
strong_validation,
report] ++
[{i, filename:join(Root, I)} || I <- LibDirs] ++
case lists:member("deps/pmod_transform/include", LibDirs) of
true -> [{parse_transform, pmod_pt}];
_ -> []
end
).
apps_dir_from_src(SrcFile) ->
SrcDir = filename:dirname(SrcFile),
filename:join(SrcDir, "../../ebin").
get_root(Dir) ->
Path = filename:split(filename:absname(Dir)),

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_erlang_syntaxerl_checker")
if exists('g:loaded_syntastic_erlang_syntaxerl_checker')
finish
endif

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_eruby_ruby_checker")
if exists('g:loaded_syntastic_eruby_ruby_checker')
finish
endif
let g:loaded_syntastic_eruby_ruby_checker = 1
@ -35,7 +35,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
" TODO: encodings became useful in ruby 1.9 :)
if s:ruby_new
let enc = &fileencoding != '' ? &fileencoding : &encoding
let enc = &fileencoding !=# '' ? &fileencoding : &encoding
let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"'
else
let encoding_spec = ''
@ -69,7 +69,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } })
\ 'defaults': { 'bufnr': bufnr(''), 'vcol': 1 } })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -10,37 +10,84 @@
"
"============================================================================
if exists("g:loaded_syntastic_fortran_gfortran_checker")
if exists('g:loaded_syntastic_fortran_gfortran_checker')
finish
endif
let g:loaded_syntastic_fortran_gfortran_checker=1
let g:loaded_syntastic_fortran_gfortran_checker = 1
if !exists('g:syntastic_fortran_compiler_options')
let g:syntastic_fortran_compiler_options = ''
endif
let s:type_map = {}
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_fortran_gfortran_IsAvailable() dict
function! SyntaxCheckers_fortran_gfortran_IsAvailable() dict " {{{1
if !exists('g:syntastic_fortran_compiler')
let g:syntastic_fortran_compiler = self.getExec()
endif
call self.log('g:syntastic_fortran_compiler = ', g:syntastic_fortran_compiler)
return executable(expand(g:syntastic_fortran_compiler, 1))
endfunction
endfunction " }}}1
function! SyntaxCheckers_fortran_gfortran_GetLocList() dict
return syntastic#c#GetLocList('fortran', 'gfortran', {
\ 'errorformat':
" @vimlint(EVL104, 1, l:errorformat)
function! SyntaxCheckers_fortran_gfortran_GetLocList() dict " {{{1
call s:SetCompilerType(g:syntastic_fortran_compiler)
if !has_key(s:type_map, g:syntastic_fortran_compiler)
call syntastic#log#error("checker fortran/gfortran: can't parse version string (abnormal termination?)")
return []
endif
if s:type_map[g:syntastic_fortran_compiler] ==# 'gfortran'
let errorformat =
\ '%-C %#,'.
\ '%-C %#%.%#,'.
\ '%A%f:%l.%c:,'.
\ '%Z%trror: %m,'.
\ '%Z%tarning: %m,'.
\ '%-G%.%#',
\ '%-G%.%#'
if !exists('g:syntastic_fortran_gfortran_sort')
let g:syntastic_fortran_gfortran_sort = 0
endif
elseif s:type_map[g:syntastic_fortran_compiler] ==# 'ifort'
let errorformat =
\ '%E%f(%l): error #%n: %m,'.
\ '%W%f(%l): warning #%n: %m,'.
\ '%W%f(%l): remark #%n: %m,'.
\ '%-Z%p^,'.
\ '%-G%.%#'
if !exists('g:syntastic_fortran_gfortran_sort')
let g:syntastic_fortran_gfortran_sort = 1
endif
endif
return syntastic#c#GetLocList('fortran', 'gfortran', {
\ 'errorformat': errorformat,
\ 'main_flags': '-fsyntax-only' })
endfunction
endfunction " }}}1
" @vimlint(EVL104, 0, l:errorformat)
" Utilities {{{1
function! s:SetCompilerType(exe) " {{{2
if !has_key(s:type_map, a:exe)
try
let ver = filter( split(syntastic#util#system(syntastic#util#shescape(a:exe) . ' --version'), '\n'),
\ 'v:val =~# "\\v^%(GNU Fortran|ifort) "' )[0]
if ver =~# '\m^GNU Fortran '
let s:type_map[a:exe] = 'gfortran'
elseif ver =~# '\m^ifort '
let s:type_map[a:exe] = 'ifort'
endif
catch /\m^Vim\%((\a\+)\)\=:E684/
" do nothing
endtry
endif
endfunction " }}}2
" }}}
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'fortran',

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_glsl_cgc_checker")
if exists('g:loaded_syntastic_glsl_cgc_checker')
finish
endif
let g:loaded_syntastic_glsl_cgc_checker = 1
@ -33,8 +33,8 @@ function! SyntaxCheckers_glsl_cgc_GetLocList() dict " {{{1
\ 'args': (exists('g:syntastic_glsl_options') ? ' ' . g:syntastic_glsl_options : '') })
let errorformat =
\ "%E%f(%l) : error %m," .
\ "%W%f(%l) : warning %m"
\ '%E%f(%l) : error %m,' .
\ '%W%f(%l) : warning %m'
return SyntasticMake({
\ 'makeprg': makeprg,

@ -14,7 +14,7 @@
" Use a BufWritePre autocommand to that end:
" autocmd FileType go autocmd BufWritePre <buffer> Fmt
if exists("g:loaded_syntastic_go_go_checker")
if exists('g:loaded_syntastic_go_go_checker')
finish
endif
let g:loaded_syntastic_go_go_checker = 1
@ -58,8 +58,8 @@ function! SyntaxCheckers_go_go_GetLocList() dict
let opts = syntastic#util#var('go_go_test_args')
let cleanup = 1
endif
let opt_str = (type(opts) != type('') || opts != '') ? join(syntastic#util#argsescape(opts)) : opts
let makeprg = self.getExec() . ' ' . cmd . ' ' . opt_str . ' ' . syntastic#c#NullOutput()
let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts
let makeprg = self.getExec() . ' ' . cmd . ' ' . opt_str
" The first pattern is for warnings from C compilers.
let errorformat =

@ -14,7 +14,7 @@
" Use a BufWritePre autocommand to that end:
" autocmd FileType go autocmd BufWritePre <buffer> Fmt
if exists("g:loaded_syntastic_go_gofmt_checker")
if exists('g:loaded_syntastic_go_gofmt_checker')
finish
endif
let g:loaded_syntastic_go_gofmt_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_go_golint_checker")
if exists('g:loaded_syntastic_go_golint_checker')
finish
endif
let g:loaded_syntastic_go_golint_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_go_gotype_checker")
if exists('g:loaded_syntastic_go_gotype_checker')
finish
endif
let g:loaded_syntastic_go_gotype_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_go_govet_checker")
if exists('g:loaded_syntastic_go_govet_checker')
finish
endif
let g:loaded_syntastic_go_govet_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_haml_haml_lint_checker")
if exists('g:loaded_syntastic_haml_haml_lint_checker')
finish
endif
let g:loaded_syntastic_haml_haml_lint_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_handlebars_handlebars_checker")
if exists('g:loaded_syntastic_handlebars_handlebars_checker')
finish
endif
let g:loaded_syntastic_handlebars_handlebars_checker = 1
@ -21,8 +21,8 @@ function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-f ' . syntastic#util#DevNull() })
let errorformat =
\ '%EError: %m on line %l:,'.
\ "%EError: %m,".
\ '%EError: %m on line %l:,' .
\ '%EError: %m,' .
\ '%Z%p^,' .
\ '%-G%.%#'
@ -30,7 +30,7 @@ function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -30,10 +30,10 @@ function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
" know the version in order to know how to find out the version. :)
" Try "ghc-mod version".
let ver = filter(split(system(self.getExecEscaped() . ' version'), '\n'), 'v:val =~# ''\m\sversion''')
let ver = filter(split(syntastic#util#system(self.getExecEscaped() . ' version'), '\n'), 'v:val =~# ''\m\sversion''')
if !len(ver)
" That didn't work. Try "ghc-mod" alone.
let ver = filter(split(system(self.getExecEscaped()), '\n'), 'v:val =~# ''\m\sversion''')
let ver = filter(split(syntastic#util#system(self.getExecEscaped()), '\n'), 'v:val =~# ''\m\sversion''')
endif
if len(ver)
@ -68,6 +68,7 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'iconv',
\ 'postprocess': ['compressWhitespace'],
\ 'returns': [0] })
endfunction

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_haskell_hdevtools_checker")
if exists('g:loaded_syntastic_haskell_hdevtools_checker')
finish
endif
let g:loaded_syntastic_haskell_hdevtools_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_haxe_haxe_checker")
if exists('g:loaded_syntastic_haxe_haxe_checker')
finish
endif
let g:loaded_syntastic_haxe_haxe_checker = 1
@ -30,7 +30,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict
call self.log('hxml =', hxml)
if hxml != ''
if hxml !=# ''
let makeprg = self.makeprgBuild({
\ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')) })

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_hss_hss_checker")
if exists('g:loaded_syntastic_hss_hss_checker')
finish
endif
let g:loaded_syntastic_hss_hss_checker = 1

@ -9,16 +9,8 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" Note: if you need to check HTML5 sources, you might consider installing a
" fork of HTML Tidy, named "HTML Tidy for HTML5":
"
" http://w3c.github.io/tidy-html5/
"
" HTML Tidy for HTML5 can be used without changes by this checker, just install
" it and point g:syntastic_html_tidy_exec to the executable.
if exists("g:loaded_syntastic_html_tidy_checker")
if exists('g:loaded_syntastic_html_tidy_checker')
finish
endif
let g:loaded_syntastic_html_tidy_checker = 1
@ -102,40 +94,40 @@ let s:IGNORE_ERRORS = [
lockvar! s:IGNORE_ERRORS
let s:BLOCKLEVEL_TAGS = [
\ "main",
\ "section",
\ "article",
\ "aside",
\ "header",
\ "footer",
\ "nav",
\ "figure",
\ "figcaption"
\ 'main',
\ 'section',
\ 'article',
\ 'aside',
\ 'header',
\ 'footer',
\ 'nav',
\ 'figure',
\ 'figcaption'
\ ]
lockvar! s:BLOCKLEVEL_TAGS
let s:INLINE_TAGS = [
\ "video",
\ "audio",
\ "source",
\ "embed",
\ "mark",
\ "progress",
\ "meter",
\ "time",
\ "ruby",
\ "rt",
\ "rp",
\ "canvas",
\ "command",
\ "details",
\ "datalist"
\ 'video',
\ 'audio',
\ 'source',
\ 'embed',
\ 'mark',
\ 'progress',
\ 'meter',
\ 'time',
\ 'ruby',
\ 'rt',
\ 'rp',
\ 'canvas',
\ 'command',
\ 'details',
\ 'datalist'
\ ]
lockvar! s:INLINE_TAGS
let s:EMPTY_TAGS = [
\ "wbr",
\ "keygen"
\ 'wbr',
\ 'keygen'
\ ]
lockvar! s:EMPTY_TAGS
@ -152,7 +144,7 @@ function! SyntaxCheckers_html_tidy_GetLocList() dict " {{{1
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")},
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1, 2] })
" filter out valid HTML5 from the errors

@ -10,13 +10,13 @@
"
"============================================================================
if exists("g:loaded_syntastic_html_validator_checker")
if exists('g:loaded_syntastic_html_validator_checker')
finish
endif
let g:loaded_syntastic_html_validator_checker=1
if !exists('g:syntastic_html_validator_api')
let g:syntastic_html_validator_api = 'http://validator.nu/'
let g:syntastic_html_validator_api = 'https://validator.nu/'
endif
if !exists('g:syntastic_html_validator_parser')
@ -32,9 +32,9 @@ set cpo&vim
function! SyntaxCheckers_html_validator_GetLocList() dict
let fname = syntastic#util#shexpand('%')
let makeprg = self.getExecEscaped() . ' -q -s --compressed -F out=gnu -F asciiquotes=yes' .
\ (g:syntastic_html_validator_parser != '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
\ (g:syntastic_html_validator_nsfilter != '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F out=gnu -F asciiquotes=yes' .
\ (g:syntastic_html_validator_parser !=# '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
\ (g:syntastic_html_validator_nsfilter !=# '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
\ ' -F doc=@' . fname . '\;type=text/html\;filename=' . fname . ' ' . g:syntastic_html_validator_api
let errorformat =

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_html_w3_checker")
if exists('g:loaded_syntastic_html_w3_checker')
finish
endif
let g:loaded_syntastic_html_w3_checker = 1
@ -23,7 +23,7 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_html_w3_GetLocList() dict
let makeprg = self.getExecEscaped() . ' -q -s -F output=json ' .
let makeprg = self.getExecEscaped() . ' -q -L -s -F output=json ' .
\ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' .
\ g:syntastic_html_w3_api
@ -41,7 +41,7 @@ function! SyntaxCheckers_html_w3_GetLocList() dict
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")},
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0] })
for e in loclist

@ -11,16 +11,16 @@
" Tested with checkstyle 5.5
"============================================================================
if exists("g:loaded_syntastic_java_checkstyle_checker")
if exists('g:loaded_syntastic_java_checkstyle_checker')
finish
endif
let g:loaded_syntastic_java_checkstyle_checker = 1
if !exists("g:syntastic_java_checkstyle_classpath")
if !exists('g:syntastic_java_checkstyle_classpath')
let g:syntastic_java_checkstyle_classpath = 'checkstyle-5.5-all.jar'
endif
if !exists("g:syntastic_java_checkstyle_conf_file")
if !exists('g:syntastic_java_checkstyle_conf_file')
let g:syntastic_java_checkstyle_conf_file = 'sun_checks.xml'
endif
@ -46,7 +46,7 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() dict
let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) )
if has('win32unix')
let fname = substitute(system('cygpath -m ' . fname), '\m\%x00', '', 'g')
let fname = substitute(syntastic#util#system('cygpath -m ' . fname), '\m\%x00', '', 'g')
endif
let makeprg = self.makeprgBuild({

@ -103,7 +103,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
let javac_classpath = ''
for path in split(g:syntastic_java_javac_classpath, s:ClassSep())
if path != ''
if path !=# ''
try
let ps = glob(path, 1, 1)
catch
@ -128,8 +128,8 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
" }}}2
" load custom classpath {{{2
if g:syntastic_java_javac_custom_classpath_command != ''
let lines = system(g:syntastic_java_javac_custom_classpath_command)
if g:syntastic_java_javac_custom_classpath_command !=# ''
let lines = syntastic#util#system(g:syntastic_java_javac_custom_classpath_command)
if syntastic#util#isRunningWindows() || has('win32unix')
let lines = substitute(lines, "\r\n", "\n", 'g')
endif
@ -138,7 +138,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
endfor
endif
if javac_classpath != ''
if javac_classpath !=# ''
let javac_opts .= ' -cp ' . syntastic#util#shexpand(javac_classpath)
endif
" }}}2
@ -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,14 +155,14 @@ 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%.%#'
if output_dir != ''
if output_dir !=# ''
silent! call mkdir(output_dir, 'p')
endif
let errors = SyntasticMake({
@ -170,7 +170,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
\ 'errorformat': errorformat,
\ 'postprocess': ['cygwinRemoveCR'] })
if output_dir != ''
if output_dir !=# ''
call syntastic#util#rmrf(output_dir)
endif
return errors
@ -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
@ -192,10 +188,10 @@ function! s:ClassSep() " {{{2
endfunction " }}}2
function! s:AddToClasspath(classpath, path) " {{{2
if a:path == ''
if a:path ==# ''
return a:classpath
endif
return (a:classpath != '') ? a:classpath . s:ClassSep() . a:path : a:path
return (a:classpath !=# '') ? a:classpath . s:ClassSep() . a:path : a:path
endfunction " }}}2
function! s:SplitClasspath(classpath) " {{{2
@ -303,14 +299,14 @@ endfunction " }}}2
function! s:GetMavenProperties() " {{{2
let mvn_properties = {}
let pom = findfile('pom.xml', '.;')
let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
if s:has_maven && filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_properties, pom)
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
\ ' -f ' . syntastic#util#shescape(pom) .
\ ' ' . g:syntastic_java_maven_options
let mvn_is_managed_tag = 1
let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n")
let mvn_settings_output = split(syntastic#util#system(mvn_cmd . ' help:effective-pom'), "\n")
let current_path = 'project'
for line in mvn_settings_output
let matches = matchlist(line, '\m^\s*<\([a-zA-Z0-9\-\.]\+\)>\s*$')
@ -338,13 +334,13 @@ function! s:GetMavenProperties() " {{{2
endfunction " }}}2
function! s:GetMavenClasspath() " {{{2
let pom = findfile('pom.xml', '.;')
let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
if s:has_maven && filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom)
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(system(mvn_cmd . ' dependency:build-classpath'), "\n")
let mvn_classpath_output = split(syntastic#util#system(mvn_cmd . ' dependency:build-classpath'), "\n")
let mvn_classpath = ''
let class_path_next = 0
@ -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
@ -381,28 +378,30 @@ function! s:GetMavenClasspath() " {{{2
endfunction " }}}2
function! s:MavenOutputDirectory() " {{{2
let pom = findfile('pom.xml', '.;')
let pom = findfile('pom.xml', escape(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
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

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_closurecompiler_checker")
if exists('g:loaded_syntastic_javascript_closurecompiler_checker')
finish
endif
let g:loaded_syntastic_javascript_closurecompiler_checker = 1

@ -21,9 +21,20 @@ endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_flow_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 6])
endfunction
function! SyntaxCheckers_javascript_flow_GetLocList() dict
if findfile('.flowconfig', escape(expand('%:p:h', 1), ' ') . ';') ==# ''
return []
endif
let makeprg = self.makeprgBuild({
\ 'exe_after': 'check',
\ 'exe': self.getExecEscaped() . ' status',
\ 'args_after': '--show-all-errors --json' })
let errorformat =

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_gjslint_checker")
if exists('g:loaded_syntastic_javascript_gjslint_checker')
finish
endif
let g:loaded_syntastic_javascript_gjslint_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_jscs_checker")
if exists('g:loaded_syntastic_javascript_jscs_checker')
finish
endif
let g:loaded_syntastic_javascript_jscs_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_jsl_checker")
if exists('g:loaded_syntastic_javascript_jsl_checker')
finish
endif
let g:loaded_syntastic_javascript_jsl_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_javascript_jslint_checker")
if exists('g:loaded_syntastic_javascript_jslint_checker')
finish
endif
@ -21,7 +21,7 @@ set cpo&vim
function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''')
if term != ''
if term !=# ''
let term = '\V\<' . escape(term, '\') . '\>'
endif
return term
@ -38,7 +38,7 @@ function! SyntaxCheckers_javascript_jslint_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -18,7 +18,7 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
let jsxhint_version = system(self.getExecEscaped() . ' --version')
let jsxhint_version = syntastic#util#system(self.getExecEscaped() . ' --version')
if v:shell_error || (jsxhint_version !~# '\m^JSXHint\>')
return 0
endif

@ -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:

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_json_jsonlint_checker")
if exists('g:loaded_syntastic_json_jsonlint_checker')
finish
endif
let g:loaded_syntastic_json_jsonlint_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_json_jsonval_checker")
if exists('g:loaded_syntastic_json_jsonval_checker')
finish
endif
let g:loaded_syntastic_json_jsonval_checker = 1
@ -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({

@ -10,16 +10,16 @@
"
"============================================================================
if exists("g:loaded_syntastic_less_lessc_checker")
if exists('g:loaded_syntastic_less_lessc_checker')
finish
endif
let g:loaded_syntastic_less_lessc_checker = 1
if !exists("g:syntastic_less_options")
let g:syntastic_less_options = ""
if !exists('g:syntastic_less_options')
let g:syntastic_less_options = ''
endif
if !exists("g:syntastic_less_use_less_lint")
if !exists('g:syntastic_less_use_less_lint')
let g:syntastic_less_use_less_lint = 0
endif
@ -53,7 +53,7 @@ function! SyntaxCheckers_less_lessc_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} })
\ 'defaults': {'bufnr': bufnr(''), 'text': 'Syntax error'} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_lex_flex_checker")
if exists('g:loaded_syntastic_lex_flex_checker')
finish
endif
let g:loaded_syntastic_lex_flex_checker = 1
@ -21,12 +21,12 @@ set cpo&vim
function! SyntaxCheckers_lex_flex_GetHighlightRegex(item)
let term = matchstr(a:item['text'],
\ '\m^\(unrecognized %option\|bad <start condition>\|bad character\( class expression\)\=\): \zs.*')
if term == ''
if term ==# ''
let term = matchstr(a:item['text'],
\ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze')
endif
return term != '' ? '\V' . escape(term, '\') : ''
return term !=# '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_lex_flex_GetLocList() dict

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_limbo_limbo_checker")
if exists('g:loaded_syntastic_limbo_limbo_checker')
finish
endif
let g:loaded_syntastic_limbo_limbo_checker = 1
@ -19,7 +19,7 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_limbo_limbo_GetLocList() dict
let include = $INFERNO_HOME != '' ? '-I$INFERNO_HOME ' : ''
let include = $INFERNO_HOME !=# '' ? '-I$INFERNO_HOME ' : ''
" don't generate .dis in current dir while checking syntax,
" .dis should be generated by `mk`
let output = filereadable('mkfile') ? (' ' . syntastic#c#NullOutput()) : ''

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_lisp_clisp_checker")
if exists('g:loaded_syntastic_lisp_clisp_checker')
finish
endif
let g:loaded_syntastic_lisp_clisp_checker = 1
@ -20,7 +20,7 @@ set cpo&vim
function! SyntaxCheckers_lisp_clisp_GetLocList() dict
let tmpdir = syntastic#util#tmpdir()
let out = tmpdir != '.' ? ('-o ' . syntastic#util#shescape(tmpdir . syntastic#util#Slash() . 'syntastic_' . getpid())) : ''
let out = tmpdir !=# '.' ? ('-o ' . syntastic#util#shescape(tmpdir . syntastic#util#Slash() . 'syntastic_' . getpid())) : ''
let makeprg = self.makeprgBuild({
\ 'args_after': '-q',

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_llvm_llvm_checker")
if exists('g:loaded_syntastic_llvm_llvm_checker')
finish
endif
let g:loaded_syntastic_llvm_llvm_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_lua_luac_checker")
if exists('g:loaded_syntastic_lua_luac_checker')
finish
endif
let g:loaded_syntastic_lua_luac_checker = 1
@ -21,7 +21,7 @@ set cpo&vim
function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
let result = ''
let near = matchstr(a:pos['text'], '\mnear ''\zs[^'']\+\ze''')
if near != ''
if near !=# ''
if near ==# '<eof>'
let p = getpos('$')
let a:pos['lnum'] = p[1]

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_lua_luacheck_checker")
if exists('g:loaded_syntastic_lua_luacheck_checker')
finish
endif
let g:loaded_syntastic_lua_luacheck_checker = 1
@ -19,27 +19,27 @@ set cpo&vim
function! SyntaxCheckers_lua_luacheck_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m''\zs\S\+\ze''')
if term != ''
if term !=# ''
return '\V\<' . escape(term, '\') . '\>'
endif
let term = matchstr(a:item['text'], '\m\(accessing undefined\|setting non-standard global\|' .
\ 'setting non-module global\|unused global\) variable \zs\S\+')
if term == ''
if term ==# ''
let term = matchstr(a:item['text'], '\mvariable \zs\S\+\ze was previously defined')
endif
if term == ''
if term ==# ''
let term = matchstr(a:item['text'], '\munused \(variable\|argument\|loop variable\) \zs\S\+')
endif
if term == ''
if term ==# ''
let term = matchstr(a:item['text'], '\m\(value assigned to variable\|value of argument\|' .
\ 'value of loop variable\) \zs\S\+')
endif
if term == ''
if term ==# ''
let term = matchstr(a:item['text'], '\mvariable \zs\S\+\ze is never set')
endif
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_lua_luacheck_GetLocList() dict

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_markdown_mdl_checker")
if exists('g:loaded_syntastic_markdown_mdl_checker')
finish
endif
let g:loaded_syntastic_markdown_mdl_checker = 1

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_matlab_mlint_checker")
if exists('g:loaded_syntastic_matlab_mlint_checker')
finish
endif
let g:loaded_syntastic_matlab_mlint_checker = 1
@ -28,7 +28,7 @@ function! SyntaxCheckers_matlab_mlint_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -0,0 +1,49 @@
"============================================================================
"File: mercury.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Joshua Rahm (joshuarahm@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_mercury_mmc_checker')
finish
endif
let g:loaded_syntastic_mercury_mmc_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_mercury_mmc_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_before': '-e' })
let errorformat =
\ '%C%f:%l: %m,' .
\ '%E%f:%l: %m,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
for e in loclist
if stridx(e['text'], ' warning:') >= 0
let e['type'] = 'W'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'mercury',
\ 'name': 'mmc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_nasm_nasm_checker")
if exists('g:loaded_syntastic_nasm_nasm_checker')
finish
endif
let g:loaded_syntastic_nasm_nasm_checker = 1
@ -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'

@ -0,0 +1,44 @@
"============================================================================
"File: nix.vim
"Description: Check nix syntax using 'nix-instantiate --eval-only'
"Maintainer: Tim Cuthbertson <tim@gfxmonk.net>
"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_nix_nix_checker')
finish
endif
let g:loaded_syntastic_nix_nix_checker = 1
let s:save_cpo = &cpo
set cpo&vim
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'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'nix',
\ 'name': 'nix',
\ 'exec': 'nix-instantiate' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_nroff_mandoc_checker")
if exists('g:loaded_syntastic_nroff_mandoc_checker')
finish
endif
let g:loaded_syntastic_nroff_mandoc_checker = 1

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save