mirror of
https://github.com/amix/vimrc
synced 2025-06-23 23:15:01 +08:00
Updated plugins
This commit is contained in:
@ -40,11 +40,12 @@ 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, MATLAB, NASM, Objective-C,
|
||||
Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X
|
||||
and iOS property lists, Puppet, Python, Racket, R, reStructuredText, 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.
|
||||
Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and
|
||||
iOS property lists, Puppet, Python, Racket, R, 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.
|
||||
|
||||
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
|
||||
@ -127,6 +128,16 @@ 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 name="faqpython3"></a>
|
||||
|
||||
__Q. The `python` checker complains about syntactically valid Python 3 constructs...__
|
||||
|
||||
A. Configure the `python` checker to call a Python 3 interpreter rather than
|
||||
Python 2, e.g:
|
||||
```vim
|
||||
let g:syntastic_python_python_exec = '/path/to/python3'
|
||||
```
|
||||
|
||||
<a name="faqperl"></a>
|
||||
|
||||
__Q. The `perl` checker has stopped working...__
|
||||
@ -153,7 +164,8 @@ automatically by syntastic.
|
||||
|
||||
<a name="faqloclist"></a>
|
||||
|
||||
__Q. I run a checker and the location list is not updated...__
|
||||
__Q. I run a checker and the location list is not updated...__
|
||||
__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
|
||||
@ -200,8 +212,7 @@ To tell syntastic to use `pylint`, you would use this setting:
|
||||
let g:syntastic_python_checkers = ['pylint']
|
||||
```
|
||||
|
||||
Some filetypes, like PHP, have style checkers as well as syntax checkers. These
|
||||
can be chained together like this:
|
||||
Checkers can be chained together like this:
|
||||
```vim
|
||||
let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd']
|
||||
```
|
||||
@ -219,7 +230,37 @@ e.g. to run `phpcs` and `phpmd`:
|
||||
This works for any checkers available for the current filetype, even if they
|
||||
aren't listed in `g:syntastic_<filetype>_checkers`. You can't run checkers for
|
||||
"foreign" filetypes though (e.g. you can't run, say, a Python checker if the
|
||||
current filetype is `php`).
|
||||
filetype of the current file is `php`).
|
||||
|
||||
<a name="faqstyle"></a>
|
||||
|
||||
__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
|
||||
arbitrary. There is an ongoing effort to keep things consistent, so you can
|
||||
_generally_ expect messages produced by syntax checkers to be _mostly_ related
|
||||
to syntax, and messages produced by style checkers to be _mostly_ about style.
|
||||
But there can be no formal guarantee that, say, a style checker that runs into
|
||||
a syntax error wouldn't die with a fatal message, nor that a syntax checker
|
||||
wouldn't give you warnings against using some constructs as being bad practice.
|
||||
There is also no guarantee that messages marked as "style" are less severe than
|
||||
the ones marked as "syntax" (whatever that might mean). And there are even a
|
||||
few Frankenstein checkers (for example `flake8` and `pylama`) that, by their
|
||||
nature, produce both kinds of messages. Syntastic is not smart enough to be
|
||||
able to sort out these things by itself.
|
||||
|
||||
In fact it's more useful to look at this from the perspective of filtering
|
||||
unwanted messages, rather than as an indicator of severity levels. The
|
||||
distinction between syntax and style is orthogonal to the distinction between
|
||||
errors and warnings, and thus you can turn off messages based on level, on
|
||||
type, or both.
|
||||
|
||||
e.g. To disable all style messages:
|
||||
```vim
|
||||
let g:syntastic_quiet_messages = { "type": "style" }
|
||||
```
|
||||
See `:help syntastic_quiet_messages` for details.
|
||||
|
||||
<a name="faqaggregate"></a>
|
||||
|
||||
@ -238,29 +279,13 @@ See `:help syntastic-aggregating-errors` for more details.
|
||||
__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
|
||||
A. Vim provides several built-in commands for this. See `:help :lnext` and
|
||||
`:help :lprev`.
|
||||
|
||||
If you use these commands a lot then you may want to add shortcut mappings to
|
||||
your vimrc, or install something like [unimpaired][2], which provides such
|
||||
mappings (among other things).
|
||||
|
||||
<a name="faqstyle"></a>
|
||||
|
||||
__Q. A syntax checker is giving me unwanted/strange style tips?__
|
||||
|
||||
A. Some filetypes (e.g. php) have style checkers as well as syntax
|
||||
checkers. You can usually configure the options that are passed to the style
|
||||
checkers, or just disable them. Take a look at the [wiki][3] to see what
|
||||
options are available.
|
||||
|
||||
Alternatively, you can use `g:syntastic_quiet_messages` to filter out the
|
||||
messages you don't want to see. e.g. To turn off all style messages:
|
||||
```vim
|
||||
let g:syntastic_quiet_messages = { "type": "style" }
|
||||
```
|
||||
See `:help syntastic_quiet_messages` for details.
|
||||
|
||||
<a name="faqbdelete"></a>
|
||||
|
||||
__Q. The error window is closed automatically when I :quit the current buffer
|
||||
@ -303,3 +328,7 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
|
||||
[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/
|
||||
|
||||
<!--
|
||||
vim:tw=79:sw=4:
|
||||
-->
|
||||
|
@ -62,7 +62,7 @@ endfunction " }}}2
|
||||
" GetLocList() for C-like compilers
|
||||
function! syntastic#c#GetLocList(filetype, subchecker, options) " {{{2
|
||||
try
|
||||
let flags = s:getCflags(a:filetype, a:subchecker, a:options)
|
||||
let flags = s:_getCflags(a:filetype, a:subchecker, a:options)
|
||||
catch /\m\C^Syntastic: skip checks$/
|
||||
return []
|
||||
endtry
|
||||
@ -70,9 +70,9 @@ function! syntastic#c#GetLocList(filetype, subchecker, options) " {{{2
|
||||
let makeprg = syntastic#util#shexpand(g:syntastic_{a:filetype}_compiler) .
|
||||
\ ' ' . flags . ' ' . syntastic#util#shexpand('%')
|
||||
|
||||
let errorformat = s:getCheckerVar('g', a:filetype, a:subchecker, 'errorformat', a:options['errorformat'])
|
||||
let errorformat = s:_getCheckerVar('g', a:filetype, a:subchecker, 'errorformat', a:options['errorformat'])
|
||||
|
||||
let postprocess = s:getCheckerVar('g', a:filetype, a:subchecker, 'remove_include_errors', 0) ?
|
||||
let postprocess = s:_getCheckerVar('g', a:filetype, a:subchecker, 'remove_include_errors', 0) ?
|
||||
\ ['filterForeignErrors'] : []
|
||||
|
||||
" process makeprg
|
||||
@ -87,29 +87,29 @@ endfunction " }}}2
|
||||
" Private functions {{{1
|
||||
|
||||
" initialize c/cpp syntax checker handlers
|
||||
function! s:init() " {{{2
|
||||
function! s:_init() " {{{2
|
||||
let s:handlers = []
|
||||
let s:cflags = {}
|
||||
|
||||
call s:regHandler('\m\<cairo', 'syntastic#c#checkPKG', ['cairo', 'cairo'])
|
||||
call s:regHandler('\m\<freetype', 'syntastic#c#checkPKG', ['freetype', 'freetype2', 'freetype'])
|
||||
call s:regHandler('\m\<glade', 'syntastic#c#checkPKG', ['glade', 'libglade-2.0', 'libglade'])
|
||||
call s:regHandler('\m\<glib', 'syntastic#c#checkPKG', ['glib', 'glib-2.0', 'glib'])
|
||||
call s:regHandler('\m\<gtk', 'syntastic#c#checkPKG', ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib'])
|
||||
call s:regHandler('\m\<libsoup', 'syntastic#c#checkPKG', ['libsoup', 'libsoup-2.4', 'libsoup-2.2'])
|
||||
call s:regHandler('\m\<libxml', 'syntastic#c#checkPKG', ['libxml', 'libxml-2.0', 'libxml'])
|
||||
call s:regHandler('\m\<pango', 'syntastic#c#checkPKG', ['pango', 'pango'])
|
||||
call s:regHandler('\m\<SDL', 'syntastic#c#checkPKG', ['sdl', 'sdl'])
|
||||
call s:regHandler('\m\<opengl', 'syntastic#c#checkPKG', ['opengl', 'gl'])
|
||||
call s:regHandler('\m\<webkit', 'syntastic#c#checkPKG', ['webkit', 'webkit-1.0'])
|
||||
call s:_regHandler('\m\<cairo', 'syntastic#c#checkPKG', ['cairo', 'cairo'])
|
||||
call s:_regHandler('\m\<freetype', 'syntastic#c#checkPKG', ['freetype', 'freetype2', 'freetype'])
|
||||
call s:_regHandler('\m\<glade', 'syntastic#c#checkPKG', ['glade', 'libglade-2.0', 'libglade'])
|
||||
call s:_regHandler('\m\<glib', 'syntastic#c#checkPKG', ['glib', 'glib-2.0', 'glib'])
|
||||
call s:_regHandler('\m\<gtk', 'syntastic#c#checkPKG', ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib'])
|
||||
call s:_regHandler('\m\<libsoup', 'syntastic#c#checkPKG', ['libsoup', 'libsoup-2.4', 'libsoup-2.2'])
|
||||
call s:_regHandler('\m\<libxml', 'syntastic#c#checkPKG', ['libxml', 'libxml-2.0', 'libxml'])
|
||||
call s:_regHandler('\m\<pango', 'syntastic#c#checkPKG', ['pango', 'pango'])
|
||||
call s:_regHandler('\m\<SDL', 'syntastic#c#checkPKG', ['sdl', 'sdl'])
|
||||
call s:_regHandler('\m\<opengl', 'syntastic#c#checkPKG', ['opengl', 'gl'])
|
||||
call s:_regHandler('\m\<webkit', 'syntastic#c#checkPKG', ['webkit', 'webkit-1.0'])
|
||||
|
||||
call s:regHandler('\m\<php\.h\>', 'syntastic#c#checkPHP', [])
|
||||
call s:regHandler('\m\<Python\.h\>', 'syntastic#c#checkPython', [])
|
||||
call s:regHandler('\m\<ruby', 'syntastic#c#checkRuby', [])
|
||||
call s:_regHandler('\m\<php\.h\>', 'syntastic#c#checkPHP', [])
|
||||
call s:_regHandler('\m\<Python\.h\>', 'syntastic#c#checkPython', [])
|
||||
call s:_regHandler('\m\<ruby', 'syntastic#c#checkRuby', [])
|
||||
endfunction " }}}2
|
||||
|
||||
" return a handler dictionary object
|
||||
function! s:regHandler(regex, function, args) " {{{2
|
||||
function! s:_regHandler(regex, function, args) " {{{2
|
||||
let handler = {}
|
||||
let handler["regex"] = a:regex
|
||||
let handler["func"] = function(a:function)
|
||||
@ -118,7 +118,7 @@ function! s:regHandler(regex, function, args) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" resolve checker-related user variables
|
||||
function! s:getCheckerVar(scope, filetype, subchecker, name, default) " {{{2
|
||||
function! s:_getCheckerVar(scope, filetype, subchecker, name, default) " {{{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}
|
||||
@ -130,10 +130,10 @@ function! s:getCheckerVar(scope, filetype, subchecker, name, default) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" resolve user CFLAGS
|
||||
function! s:getCflags(ft, ck, opts) " {{{2
|
||||
function! s:_getCflags(ft, ck, opts) " {{{2
|
||||
" determine whether to parse header files as well
|
||||
if has_key(a:opts, 'header_names') && expand('%') =~? a:opts['header_names']
|
||||
if s:getCheckerVar('g', a:ft, a:ck, 'check_header', 0)
|
||||
if s:_getCheckerVar('g', a:ft, a:ck, 'check_header', 0)
|
||||
let flags = get(a:opts, 'header_flags', '') . ' -c ' . syntastic#c#NullOutput()
|
||||
else
|
||||
" checking headers when check_header is unset: bail out
|
||||
@ -143,21 +143,21 @@ function! s:getCflags(ft, ck, opts) " {{{2
|
||||
let flags = get(a:opts, 'main_flags', '')
|
||||
endif
|
||||
|
||||
let flags .= ' ' . s:getCheckerVar('g', a:ft, a:ck, 'compiler_options', '') . ' ' . s:getIncludeDirs(a:ft)
|
||||
let flags .= ' ' . s:_getCheckerVar('g', a:ft, a:ck, 'compiler_options', '') . ' ' . s:_getIncludeDirs(a:ft)
|
||||
|
||||
" check if the user manually set some cflags
|
||||
let b_cflags = s:getCheckerVar('b', a:ft, a:ck, 'cflags', '')
|
||||
let b_cflags = s:_getCheckerVar('b', a:ft, a:ck, 'cflags', '')
|
||||
if b_cflags == ''
|
||||
" check whether to search for include files at all
|
||||
if !s:getCheckerVar('g', a:ft, a:ck, 'no_include_search', 0)
|
||||
if !s:_getCheckerVar('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:getCheckerVar('g', a:ft, a:ck, 'auto_refresh_includes', 0)
|
||||
let flags .= ' ' . s:searchHeaders()
|
||||
if s:_getCheckerVar('g', a:ft, a:ck, 'auto_refresh_includes', 0)
|
||||
let flags .= ' ' . s:_searchHeaders()
|
||||
else
|
||||
" search for header includes if not cached already
|
||||
if !exists('b:syntastic_' . a:ft . '_includes')
|
||||
let b:syntastic_{a:ft}_includes = s:searchHeaders()
|
||||
let b:syntastic_{a:ft}_includes = s:_searchHeaders()
|
||||
endif
|
||||
let flags .= ' ' . b:syntastic_{a:ft}_includes
|
||||
endif
|
||||
@ -169,7 +169,7 @@ function! s:getCflags(ft, ck, opts) " {{{2
|
||||
endif
|
||||
|
||||
" add optional config file parameters
|
||||
let config_file = s:getCheckerVar('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
|
||||
let config_file = s:_getCheckerVar('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
|
||||
let flags .= ' ' . syntastic#c#ReadConfig(config_file)
|
||||
|
||||
return flags
|
||||
@ -177,7 +177,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:getIncludeDirs(filetype) " {{{2
|
||||
function! s:_getIncludeDirs(filetype) " {{{2
|
||||
let include_dirs = []
|
||||
|
||||
if a:filetype =~# '\v^%(c|cpp|objc|objcpp)$' &&
|
||||
@ -195,7 +195,7 @@ endfunction " }}}2
|
||||
|
||||
" search the first 100 lines for include statements that are
|
||||
" given in the handlers dictionary
|
||||
function! s:searchHeaders() " {{{2
|
||||
function! s:_searchHeaders() " {{{2
|
||||
let includes = ''
|
||||
let files = []
|
||||
let found = []
|
||||
@ -324,7 +324,7 @@ let s:default_includes = [
|
||||
\ '..' . syntastic#util#Slash() . 'include',
|
||||
\ '..' . syntastic#util#Slash() . 'includes' ]
|
||||
|
||||
call s:init()
|
||||
call s:_init()
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
@ -65,8 +65,8 @@ function! syntastic#log#debug(level, msg, ...) " {{{2
|
||||
return
|
||||
endif
|
||||
|
||||
let leader = s:logTimestamp()
|
||||
call s:logRedirect(1)
|
||||
let leader = s:_logTimestamp()
|
||||
call s:_logRedirect(1)
|
||||
|
||||
if a:0 > 0
|
||||
" filter out dictionary functions
|
||||
@ -77,7 +77,7 @@ function! syntastic#log#debug(level, msg, ...) " {{{2
|
||||
echomsg leader . a:msg
|
||||
endif
|
||||
|
||||
call s:logRedirect(0)
|
||||
call s:_logRedirect(0)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#debugShowOptions(level, names) " {{{2
|
||||
@ -85,15 +85,15 @@ function! syntastic#log#debugShowOptions(level, names) " {{{2
|
||||
return
|
||||
endif
|
||||
|
||||
let leader = s:logTimestamp()
|
||||
call s:logRedirect(1)
|
||||
let leader = s:_logTimestamp()
|
||||
call s:_logRedirect(1)
|
||||
|
||||
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, ', ')
|
||||
endif
|
||||
call s:logRedirect(0)
|
||||
call s:_logRedirect(0)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#debugShowVariables(level, names) " {{{2
|
||||
@ -101,18 +101,18 @@ function! syntastic#log#debugShowVariables(level, names) " {{{2
|
||||
return
|
||||
endif
|
||||
|
||||
let leader = s:logTimestamp()
|
||||
call s:logRedirect(1)
|
||||
let leader = s:_logTimestamp()
|
||||
call s:_logRedirect(1)
|
||||
|
||||
let vlist = type(a:names) == type("") ? [a:names] : a:names
|
||||
for name in vlist
|
||||
let msg = s:formatVariable(name)
|
||||
let msg = s:_formatVariable(name)
|
||||
if msg != ''
|
||||
echomsg leader . msg
|
||||
endif
|
||||
endfor
|
||||
|
||||
call s:logRedirect(0)
|
||||
call s:_logRedirect(0)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#debugDump(level) " {{{2
|
||||
@ -127,19 +127,19 @@ endfunction " }}}2
|
||||
|
||||
" Private functions {{{1
|
||||
|
||||
function! s:isDebugEnabled_smart(level) " {{{2
|
||||
function! s:_isDebugEnabled_smart(level) " {{{2
|
||||
return and(g:syntastic_debug, a:level)
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:isDebugEnabled_dumb(level) " {{{2
|
||||
function! s:_isDebugEnabled_dumb(level) " {{{2
|
||||
" poor man's bit test for bit N, assuming a:level == 2**N
|
||||
return (g:syntastic_debug / a:level) % 2
|
||||
endfunction " }}}2
|
||||
|
||||
let s:isDebugEnabled = function(exists('*and') ? 's:isDebugEnabled_smart' : 's:isDebugEnabled_dumb')
|
||||
let s:isDebugEnabled = function(exists('*and') ? 's:_isDebugEnabled_smart' : 's:_isDebugEnabled_dumb')
|
||||
lockvar s:isDebugEnabled
|
||||
|
||||
function! s:logRedirect(on) " {{{2
|
||||
function! s:_logRedirect(on) " {{{2
|
||||
if exists("g:syntastic_debug_file")
|
||||
if a:on
|
||||
try
|
||||
@ -154,11 +154,11 @@ function! s:logRedirect(on) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:logTimestamp() " {{{2
|
||||
function! s:_logTimestamp() " {{{2
|
||||
return 'syntastic: ' . split(reltimestr(reltime(g:syntastic_start)))[0] . ': '
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:formatVariable(name) " {{{2
|
||||
function! s:_formatVariable(name) " {{{2
|
||||
let vals = []
|
||||
if exists('g:syntastic_' . a:name)
|
||||
call add(vals, 'g:syntastic_' . a:name . ' = ' . strtrans(string(g:syntastic_{a:name})))
|
||||
|
@ -46,6 +46,25 @@ function! syntastic#postprocess#filterForeignErrors(errors) " {{{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
|
||||
let buffers = syntastic#util#unique(map(filter(copy(a:errors), 'v:val["valid"]'), 'str2nr(v:val["bufnr"])'))
|
||||
|
||||
let guards = {}
|
||||
for b in buffers
|
||||
let guards[b] = len(getbufline(b, 1, '$'))
|
||||
endfor
|
||||
|
||||
for e in a:errors
|
||||
if e['valid'] && e['lnum'] > guards[e['bufnr']]
|
||||
let e['lnum'] = guards[e['bufnr']]
|
||||
endif
|
||||
endfor
|
||||
|
||||
return a:errors
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
@ -96,6 +96,16 @@ endfunction " }}}2
|
||||
let s:width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
|
||||
lockvar s:width
|
||||
|
||||
function! syntastic#util#screenWidth(str, tabstop) " {{{2
|
||||
let chunks = split(a:str, "\t", 1)
|
||||
let width = s:width(chunks[-1])
|
||||
for c in chunks[:-2]
|
||||
let cwidth = s:width(c)
|
||||
let width += cwidth + a:tabstop - cwidth % a:tabstop
|
||||
endfor
|
||||
return width
|
||||
endfunction " }}}2
|
||||
|
||||
"print as much of a:msg as possible without "Press Enter" prompt appearing
|
||||
function! syntastic#util#wideMsg(msg) " {{{2
|
||||
let old_ruler = &ruler
|
||||
@ -215,7 +225,7 @@ function! syntastic#util#redraw(full) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#dictFilter(errors, filter) " {{{2
|
||||
let rules = s:translateFilter(a:filter)
|
||||
let rules = s:_translateFilter(a:filter)
|
||||
" call syntastic#log#debug(g:SyntasticDebugFilters, "applying filter:", rules)
|
||||
try
|
||||
call filter(a:errors, rules)
|
||||
@ -225,13 +235,6 @@ function! syntastic#util#dictFilter(errors, filter) " {{{2
|
||||
endtry
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#sortLoclist(errors) " {{{2
|
||||
for e in a:errors
|
||||
call s:setScreenColumn(e)
|
||||
endfor
|
||||
call sort(a:errors, 's:compareErrorItems')
|
||||
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.
|
||||
@ -243,13 +246,13 @@ endfunction " }}}2
|
||||
|
||||
" Private functions {{{1
|
||||
|
||||
function! s:translateFilter(filters) " {{{2
|
||||
function! s:_translateFilter(filters) " {{{2
|
||||
let conditions = []
|
||||
for k in keys(a:filters)
|
||||
if type(a:filters[k]) == type([])
|
||||
call extend(conditions, map(copy(a:filters[k]), 's:translateElement(k, v:val)'))
|
||||
call extend(conditions, map(copy(a:filters[k]), 's:_translateElement(k, v:val)'))
|
||||
else
|
||||
call add(conditions, s:translateElement(k, a:filters[k]))
|
||||
call add(conditions, s:_translateElement(k, a:filters[k]))
|
||||
endif
|
||||
endfor
|
||||
|
||||
@ -259,7 +262,7 @@ function! s:translateFilter(filters) " {{{2
|
||||
return len(conditions) == 1 ? conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:translateElement(key, term) " {{{2
|
||||
function! s:_translateElement(key, term) " {{{2
|
||||
if a:key ==? 'level'
|
||||
let ret = 'v:val["type"] !=? ' . string(a:term[0])
|
||||
elseif a:key ==? 'type'
|
||||
@ -275,49 +278,6 @@ function! s:translateElement(key, term) " {{{2
|
||||
return ret
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:screenWidth(str, tabstop) " {{{2
|
||||
let chunks = split(a:str, "\t", 1)
|
||||
let width = s:width(chunks[-1])
|
||||
for c in chunks[:-2]
|
||||
let cwidth = s:width(c)
|
||||
let width += cwidth + a:tabstop - cwidth % a:tabstop
|
||||
endfor
|
||||
return width
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:setScreenColumn(item) " {{{2
|
||||
if !has_key(a:item, 'scol')
|
||||
let col = get(a:item, 'col', 0)
|
||||
if col != 0 && a:item['vcol'] == 0
|
||||
let buf = str2nr(a:item['bufnr'])
|
||||
try
|
||||
let line = getbufline(buf, a:item['lnum'])[0]
|
||||
catch /\m^Vim\%((\a\+)\)\=:E684/
|
||||
let line = ''
|
||||
endtry
|
||||
let a:item['scol'] = s:screenWidth(strpart(line, 0, col), getbufvar(buf, '&tabstop'))
|
||||
else
|
||||
let a:item['scol'] = col
|
||||
endif
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:compareErrorItems(a, b) " {{{2
|
||||
if a:a['bufnr'] != a:b['bufnr']
|
||||
" group by file
|
||||
return a:a['bufnr'] - a:b['bufnr']
|
||||
elseif a:a['lnum'] != a:b['lnum']
|
||||
" sort by line
|
||||
return a:a['lnum'] - a:b['lnum']
|
||||
elseif a:a['type'] !=? a:b['type']
|
||||
" errors take precedence over warnings
|
||||
return a:a['type'] ==? 'E' ? -1 : 1
|
||||
else
|
||||
" sort by screen column
|
||||
return a:a['scol'] - a:b['scol']
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
@ -67,7 +67,7 @@ Take a look at the wiki for a list of supported filetypes and checkers:
|
||||
https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
|
||||
|
||||
Note: This doc only deals with using syntastic. To learn how to write syntax
|
||||
checker integrations, see the guide on the github wiki:
|
||||
checker integrations, see the guide on the GitHub wiki:
|
||||
|
||||
https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
|
||||
|
||||
@ -78,16 +78,17 @@ Syntastic comes preconfigured with a default list of enabled checkers per
|
||||
filetype. This list is kept reasonably short to prevent slowing down Vim or
|
||||
trying to use conflicting checkers.
|
||||
|
||||
You can see the list checkers available for the current filetype with the
|
||||
You can see the list of checkers available for the current filetype with the
|
||||
|:SyntasticInfo| command.
|
||||
|
||||
If you want to override the configured list of checkers for a filetype then
|
||||
see |syntastic-checker-options| for details. You can also change the arguments
|
||||
passed to a specific checker as well.
|
||||
You probably want to override the configured list of checkers for the
|
||||
filetypes you use, and also change the arguments passed to specific checkers
|
||||
to suit your needs. See |syntastic-checker-options| for details.
|
||||
|
||||
Use |:SyntasticCheck| to manually check right now. Use |:SyntasticToggleMode|
|
||||
to switch between active (checking on writing the buffer) and passive (manual)
|
||||
checking.
|
||||
Use |:SyntasticCheck| to manually check right now. Use |:Errors| to open the
|
||||
|location-list| window, and |:lclose| to close it. You can clear the error
|
||||
list with |:SyntasticReset|, and you can use |:SyntasticToggleMode| to switch
|
||||
between active (checking on writing the buffer) and passive (manual) checking.
|
||||
|
||||
==============================================================================
|
||||
2. Functionality provided *syntastic-functionality*
|
||||
@ -155,13 +156,21 @@ Example: >
|
||||
highlight SyntasticErrorLine guibg=#2f0000
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
2.3. The error window *:Errors* *syntastic-error-window*
|
||||
2.3. The error window *syntastic-error-window*
|
||||
|
||||
You can use the :Errors command to display the errors for the current buffer
|
||||
You can use the |:Errors| command to display the errors for the current buffer
|
||||
in the |location-list|.
|
||||
|
||||
Note that when you use :Errors, the current location list is overwritten with
|
||||
Syntastic's own location list.
|
||||
Note that when you use |:Errors|, the current location list is overwritten
|
||||
with Syntastic's own location list.
|
||||
|
||||
By default syntastic doesn't fill the |location-list| with the errors found by
|
||||
the checkers, in order to reduce clashes with other plugins. Consequently, if
|
||||
you run |:lopen| or |:lwindow| rather than |:Errors| to open the error window you
|
||||
wouldn't see syntastic's list of errors. If you insist on using |:lopen| or
|
||||
|:lwindow| you should either run |:SyntasticSetLoclist| after running the checks,
|
||||
or set |syntastic_always_populate_loc_list| which tells syntastic to update the
|
||||
|location-list| automatically.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.4. Error highlighting *syntastic-highlighting*
|
||||
@ -212,11 +221,14 @@ See also: |'syntastic_<filetype>_<checker>_quiet_messages'|.
|
||||
==============================================================================
|
||||
3. Commands *syntastic-commands*
|
||||
|
||||
:Errors *:SyntasticErrors*
|
||||
:Errors *:Errors*
|
||||
|
||||
When errors have been detected, use this command to pop up the |location-list|
|
||||
and display the error messages.
|
||||
|
||||
Please note that the |:Errors| command overwrites the current location list with
|
||||
syntastic's own location list.
|
||||
|
||||
:SyntasticToggleMode *:SyntasticToggleMode*
|
||||
|
||||
Toggles syntastic between active and passive mode. See |'syntastic_mode_map'|
|
||||
@ -239,7 +251,7 @@ the order specified. The rules of |syntastic_aggregate_errors| still apply.
|
||||
Example: >
|
||||
:SyntasticCheck flake8 pylint
|
||||
<
|
||||
:SyntasticInfo *:SyntasticInfo*
|
||||
:SyntasticInfo *:SyntasticInfo*
|
||||
|
||||
The command takes an optional argument, and outputs information about the
|
||||
checkers available for the filetype named by said argument, or for the current
|
||||
@ -303,9 +315,22 @@ messages grouped by checker output, set this variable to 0. >
|
||||
<
|
||||
*'syntastic_echo_current_error'*
|
||||
Default: 1
|
||||
If enabled, syntastic will echo the error associated with the current line to
|
||||
the command window. If multiple errors are found, the first will be used. >
|
||||
If enabled, syntastic will echo current error to the command window. If
|
||||
multiple errors are found on the same line, |syntastic_cursor_columns| is used
|
||||
to decide which one is shown. >
|
||||
let g:syntastic_echo_current_error = 1
|
||||
<
|
||||
*'syntastic_cursor_columns'*
|
||||
Default: 1
|
||||
This option controls which errors are echoed to the command window if
|
||||
|syntastic_echo_current_error| is set and multiple errors are found on the same
|
||||
line. When the option is enabled, the first error corresponding to the current
|
||||
column is show. Otherwise, the first error on the current line is echoed,
|
||||
regardless of the cursor position on the current line.
|
||||
|
||||
When dealing with very large lists of errors, disabling this option can speed
|
||||
up navigation significantly: >
|
||||
let g:syntastic_cursor_column = 0
|
||||
<
|
||||
*'syntastic_enable_signs'*
|
||||
Default: 1
|
||||
@ -407,7 +432,6 @@ default behaviour of running both checkers against the input file: >
|
||||
Default: { "mode": "active",
|
||||
"active_filetypes": [],
|
||||
"passive_filetypes": [] }
|
||||
|
||||
Use this option to fine tune when automatic syntax checking is done (or not
|
||||
done).
|
||||
|
||||
@ -436,7 +460,6 @@ active and passive modes.
|
||||
|
||||
*'syntastic_quiet_messages'*
|
||||
Default: {}
|
||||
|
||||
Use this option to filter out some of the messages produced by checkers. The
|
||||
option should be set to something like: >
|
||||
let g:syntastic_quiet_messages = { "level": "warnings",
|
||||
@ -505,6 +528,12 @@ statusline: >
|
||||
<
|
||||
If the buffer had 2 warnings, starting on line 5 then this would appear: >
|
||||
[Warn: 5 #2]
|
||||
<
|
||||
*'b:syntastic_skip_checks'*
|
||||
Default: unset
|
||||
Only the local form |'b:syntastic_skip_checks'| is used. When set to a true
|
||||
value, no checks are run against the corresponding buffer. Example: >
|
||||
let b:syntastic_skip_checks = 1
|
||||
<
|
||||
*'syntastic_full_redraws'*
|
||||
Default: 0 in GUI Vim and MacVim, 1 otherwise
|
||||
@ -513,6 +542,13 @@ Changing it can in principle make screen redraws smoother, but it can also
|
||||
cause screen to flicker, or cause ghost characters. Leaving it to the default
|
||||
should be safe.
|
||||
|
||||
*'syntastic_exit_checks'*
|
||||
Default: 0 when running under "cmd.exe" on Windows, 1 otherwise
|
||||
Syntastic attempts to catch abnormal termination conditions from checkers by
|
||||
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_debug'*
|
||||
Default: 0
|
||||
Set this to the sum of one or more of the following flags to enable
|
||||
@ -580,11 +616,19 @@ Use |:SyntasticInfo| to see which checkers are available for a given filetype.
|
||||
5.2 Choosing the executable *syntastic-config-exec*
|
||||
|
||||
*'syntastic_<filetype>_<checker>_exec'*
|
||||
The executable used by a checker is normally defined automatically, when the
|
||||
checkers is registered. You can however override it by setting the variable
|
||||
The executable run by a checker is normally defined automatically, when the
|
||||
checker is registered. You can however override it, by setting the variable
|
||||
'g:syntastic_<filetype>_<checker>_exec': >
|
||||
let g:syntastic_ruby_mri_exec = '~/bin/ruby2'
|
||||
<
|
||||
This variable has a local version, 'b:syntastic_<filetype>_<checker>_exec',
|
||||
which takes precedence over the global one in the corresponding buffer.
|
||||
|
||||
*'b:syntastic_<checker>_exec'*
|
||||
And there is also a local variable named 'b:syntastic_<checker>_exec', which
|
||||
takes precedence over both 'b:syntastic_<filetype>_<checker>_exec' and
|
||||
'g:syntastic_<filetype>_<checker>_exec' in the buffers where it is defined.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.3 Configuring specific checkers *syntastic-config-makeprg*
|
||||
|
||||
@ -609,21 +653,20 @@ have local versions 'b:syntastic_<filetype>_<checker-name>_<option-name>',
|
||||
which take precedence over the global ones in the corresponding buffers.
|
||||
|
||||
If one of these variables has a non-empty default and you want it to be empty,
|
||||
you can set it to a space, e.g.: >
|
||||
let g:syntastic_javascript_jslint_args = " "
|
||||
you can set it to an empty string, e.g.: >
|
||||
let g:syntastic_javascript_jslint_args = ""
|
||||
<
|
||||
(setting it to an empty string doesn't work, for implementation reasons).
|
||||
|
||||
*'syntastic_<filetype>_<checker>_exe'*
|
||||
The 'exe' is normally the same as the 'exec' attribute described above, in
|
||||
which case it may be omitted. However, you can use it to add environment
|
||||
variables or additional parameters, e.g. to tell the mri checker to use KANJI
|
||||
encoding you could do something like this: >
|
||||
let g:syntastic_ruby_mri_exe = 'RUBYOPT="-Ke" ruby'
|
||||
variables, or to change the way the checker is run. For example this setup
|
||||
allows you to run PC-Lint under Wine emulation on Linux: >
|
||||
let g:syntastic_c_pc_lint_exec = "wine"
|
||||
let g:syntastic_c_pc_lint_exe = "wine c:/path/to/lint-nt.exe"
|
||||
<
|
||||
To override the args and the tail: >
|
||||
let g:syntastic_ruby_mri_args = "--my --args --here"
|
||||
let g:syntastic_ruby_mri_tail = "> /tmp/my-output-file-biatch"
|
||||
let g:syntastic_c_pc_lint_args = "-w5 -Iz:/usr/include/linux"
|
||||
let g:syntastic_c_pc_lint_tail = "2>/dev/null"
|
||||
<
|
||||
The general form of the override options is: >
|
||||
syntastic_<filetype>_<checker>_<option-name>
|
||||
@ -740,9 +783,9 @@ https://github.com/jmcantrell/vim-virtualenv). This is a limitation of
|
||||
7. About *syntastic-about*
|
||||
|
||||
The core maintainers of syntastic are:
|
||||
Martin Grenfell (github: scrooloose)
|
||||
Gregor Uhlenheuer (github: kongo2002)
|
||||
LCD 047 (github: lcd047)
|
||||
Martin Grenfell (GitHub: scrooloose)
|
||||
Gregor Uhlenheuer (GitHub: kongo2002)
|
||||
LCD 047 (GitHub: lcd047)
|
||||
|
||||
Find the latest version of syntastic at:
|
||||
|
||||
|
@ -19,7 +19,7 @@ if has('reltime')
|
||||
lockvar! g:syntastic_start
|
||||
endif
|
||||
|
||||
let g:syntastic_version = '3.4.0-117'
|
||||
let g:syntastic_version = '3.5.0-37'
|
||||
lockvar g:syntastic_version
|
||||
|
||||
" Sanity checks {{{1
|
||||
@ -56,12 +56,14 @@ let g:syntastic_defaults = {
|
||||
\ 'bash_hack': 1,
|
||||
\ 'check_on_open': 0,
|
||||
\ 'check_on_wq': 1,
|
||||
\ 'cursor_columns': 1,
|
||||
\ 'debug': 0,
|
||||
\ 'echo_current_error': 1,
|
||||
\ 'enable_balloons': 1,
|
||||
\ 'enable_highlighting': 1,
|
||||
\ 'enable_signs': 1,
|
||||
\ 'error_symbol': '>>',
|
||||
\ 'exit_checks': !(s:running_windows && &shell =~? '\m\<cmd\.exe$'),
|
||||
\ 'filetype_map': {},
|
||||
\ 'full_redraws': !(has('gui_running') || has('gui_macvim')),
|
||||
\ 'id_checkers': 1,
|
||||
@ -228,7 +230,7 @@ endfunction " }}}2
|
||||
function! s:QuitPreHook() " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugAutocommands,
|
||||
\ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
let b:syntastic_skip_checks = !g:syntastic_check_on_wq
|
||||
let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
|
||||
call SyntasticLoclistHide()
|
||||
endfunction " }}}2
|
||||
|
||||
@ -481,7 +483,15 @@ function! SyntasticMake(options) " {{{2
|
||||
execute 'lcd ' . fnameescape(old_cwd)
|
||||
endif
|
||||
|
||||
silent! lolder
|
||||
try
|
||||
silent lolder
|
||||
catch /\m^Vim\%((\a\+)\)\=:E380/
|
||||
" E380: At bottom of quickfix stack
|
||||
call setloclist(0, [], 'r')
|
||||
catch /\m^Vim\%((\a\+)\)\=:E776/
|
||||
" E776: No location list
|
||||
" do nothing
|
||||
endtry
|
||||
|
||||
" restore options {{{3
|
||||
let &errorformat = old_errorformat
|
||||
@ -496,7 +506,7 @@ function! SyntasticMake(options) " {{{2
|
||||
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'raw loclist:', errors)
|
||||
|
||||
if has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1
|
||||
if syntastic#util#var('exit_checks') && has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1
|
||||
throw 'Syntastic: checker error'
|
||||
endif
|
||||
|
||||
@ -555,9 +565,9 @@ endfunction " }}}2
|
||||
" Skip running in special buffers
|
||||
function! s:skipFile() " {{{2
|
||||
let fname = expand('%')
|
||||
let skip = (exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0) ||
|
||||
\ (&buftype != '') || !filereadable(fname) || getwinvar(0, '&diff') ||
|
||||
\ s:ignoreFile(fname) || fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype != '') ||
|
||||
\ !filereadable(fname) || getwinvar(0, '&diff') || s:ignoreFile(fname) ||
|
||||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
if skip
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'skipFile: skipping')
|
||||
endif
|
||||
|
@ -46,11 +46,9 @@ function! g:SyntasticChecker.getName() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getExec() " {{{2
|
||||
if exists('g:syntastic_' . self._filetype . '_' . self._name . '_exec')
|
||||
return expand(g:syntastic_{self._filetype}_{self._name}_exec)
|
||||
endif
|
||||
|
||||
return self._exec
|
||||
return
|
||||
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
|
||||
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec', self._exec) )
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getExecEscaped() " {{{2
|
||||
@ -147,10 +145,9 @@ function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker._getOpt(opts, basename, name, default) " {{{2
|
||||
let user_val = syntastic#util#var(a:basename . a:name)
|
||||
let ret = []
|
||||
call extend( ret, self._shescape(get(a:opts, a:name . '_before', '')) )
|
||||
call extend( ret, self._shescape(user_val != '' ? user_val : get(a:opts, a:name, a:default)) )
|
||||
call extend( ret, self._shescape(syntastic#util#var( a:basename . a:name, get(a:opts, a:name, a:default) )) )
|
||||
call extend( ret, self._shescape(get(a:opts, a:name . '_after', '')) )
|
||||
|
||||
return ret
|
||||
|
@ -20,7 +20,8 @@ function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2
|
||||
if self.enabled() && !a:loclist.isEmpty()
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: refresh')
|
||||
let b:syntastic_messages = copy(a:loclist.messages(bufnr('')))
|
||||
let b:oldLine = -1
|
||||
let b:syntastic_line = -1
|
||||
let b:syntastic_cursor_columns = a:loclist.getCursorColumns()
|
||||
autocmd! syntastic CursorMoved
|
||||
autocmd syntastic CursorMoved * call SyntasticRefreshCursor()
|
||||
endif
|
||||
@ -31,7 +32,7 @@ function! g:SyntasticCursorNotifier.reset(loclist) " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: reset')
|
||||
autocmd! syntastic CursorMoved
|
||||
unlet! b:syntastic_messages
|
||||
let b:oldLine = -1
|
||||
let b:syntastic_line = -1
|
||||
endfunction " }}}2
|
||||
" @vimlint(EVL103, 0, a:loclist)
|
||||
|
||||
@ -39,29 +40,99 @@ endfunction " }}}2
|
||||
|
||||
" Private methods {{{1
|
||||
|
||||
" The following defensive nonsense is needed because of the nature of autocmd
|
||||
function! SyntasticRefreshCursor() " {{{2
|
||||
if !exists('b:syntastic_messages') || empty(b:syntastic_messages)
|
||||
" file not checked
|
||||
return
|
||||
endif
|
||||
|
||||
if !exists('b:oldLine')
|
||||
let b:oldLine = -1
|
||||
if !exists('b:syntastic_line')
|
||||
let b:syntastic_line = -1
|
||||
endif
|
||||
let l = line('.')
|
||||
if l == b:oldLine
|
||||
return
|
||||
endif
|
||||
let b:oldLine = l
|
||||
let current_messages = get(b:syntastic_messages, l, {})
|
||||
|
||||
if has_key(b:syntastic_messages, l)
|
||||
call syntastic#util#wideMsg(b:syntastic_messages[l])
|
||||
if !exists('b:syntastic_cursor_columns')
|
||||
let b:syntastic_cursor_columns = g:syntastic_cursor_columns
|
||||
endif
|
||||
|
||||
if b:syntastic_cursor_columns
|
||||
let c = virtcol('.')
|
||||
if !exists('b:syntastic_idx')
|
||||
let b:syntastic_idx = -1
|
||||
endif
|
||||
|
||||
if s:_isSameIndex(l, b:syntastic_line, c, b:syntastic_idx, current_messages)
|
||||
return
|
||||
else
|
||||
let b:syntastic_line = l
|
||||
endif
|
||||
|
||||
if !empty(current_messages)
|
||||
let b:syntastic_idx = s:_findIndex(c, current_messages)
|
||||
call syntastic#util#wideMsg(current_messages[b:syntastic_idx].text)
|
||||
else
|
||||
let b:syntastic_idx = -1
|
||||
echo
|
||||
endif
|
||||
else
|
||||
echo
|
||||
if l == b:syntastic_line
|
||||
return
|
||||
endif
|
||||
let b:syntastic_line = l
|
||||
|
||||
if !empty(current_messages)
|
||||
call syntastic#util#wideMsg(current_messages[0].text)
|
||||
else
|
||||
echo
|
||||
endif
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
" Private functions {{{1
|
||||
|
||||
function! s:_isSameIndex(line, old_line, column, idx, messages) " {{{2
|
||||
if a:old_line >= 0 && a:line == a:old_line && a:idx >= 0
|
||||
if len(a:messages) <= 1
|
||||
return 1
|
||||
endif
|
||||
|
||||
if a:messages[a:idx].scol <= a:column || a:idx == 0
|
||||
if a:idx == len(a:messages) - 1 || a:column < a:messages[a:idx + 1].scol
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_findIndex(column, messages) " {{{2
|
||||
let max = len(a:messages) - 1
|
||||
if max == 0
|
||||
return 0
|
||||
endif
|
||||
let min = 0
|
||||
|
||||
" modified binary search: assign index 0 to columns to the left of the first error
|
||||
while min < max - 1
|
||||
let mid = (min + max) / 2
|
||||
if a:column < a:messages[mid].scol
|
||||
let max = mid
|
||||
else
|
||||
let min = mid
|
||||
endif
|
||||
endwhile
|
||||
|
||||
return a:column < a:messages[max].scol ? min : max
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -21,6 +21,8 @@ function! g:SyntasticLoclist.New(rawLoclist) " {{{2
|
||||
let newObj._rawLoclist = llist
|
||||
let newObj._name = ''
|
||||
let newObj._owner = bufnr('')
|
||||
let newObj._sorted = 0
|
||||
let newObj._columns = g:syntastic_cursor_columns
|
||||
|
||||
return newObj
|
||||
endfunction " }}}2
|
||||
@ -39,7 +41,15 @@ function! g:SyntasticLoclist.extend(other) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.sort() " {{{2
|
||||
call syntastic#util#sortLoclist(self._rawLoclist)
|
||||
if !self._sorted
|
||||
for e in self._rawLoclist
|
||||
call s:_setScreenColumn(e)
|
||||
endfor
|
||||
|
||||
call sort(self._rawLoclist, self._columns ? 's:_compareErrorItemsByColumns' : 's:_compareErrorItemsByLines')
|
||||
|
||||
let self._sorted = 1
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.isEmpty() " {{{2
|
||||
@ -66,6 +76,10 @@ function! g:SyntasticLoclist.getBuffers() " {{{2
|
||||
return syntastic#util#unique(map(copy(self._rawLoclist), 'str2nr(v:val["bufnr"])') + [self._owner])
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.getCursorColumns() " {{{2
|
||||
return self._columns
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.getStatuslineFlag() " {{{2
|
||||
if !exists("self._stl_format")
|
||||
let self._stl_format = ''
|
||||
@ -183,8 +197,8 @@ endfunction " }}}2
|
||||
function! g:SyntasticLoclist.messages(buf) " {{{2
|
||||
if !exists("self._cachedMessages")
|
||||
let self._cachedMessages = {}
|
||||
let errors = self.errors() + self.warnings()
|
||||
|
||||
let errors = self.errors() + self.warnings()
|
||||
for e in errors
|
||||
let b = e['bufnr']
|
||||
let l = e['lnum']
|
||||
@ -194,9 +208,32 @@ function! g:SyntasticLoclist.messages(buf) " {{{2
|
||||
endif
|
||||
|
||||
if !has_key(self._cachedMessages[b], l)
|
||||
let self._cachedMessages[b][l] = e['text']
|
||||
let self._cachedMessages[b][l] = [e]
|
||||
elseif self._columns
|
||||
call add(self._cachedMessages[b][l], e)
|
||||
endif
|
||||
endfor
|
||||
|
||||
if self._columns
|
||||
if !self._sorted
|
||||
for b in keys(self._cachedMessages)
|
||||
for l in keys(self._cachedMessages[b])
|
||||
if len(self._cachedMessages[b][l]) > 1
|
||||
for e in self._cachedMessages[b][l]
|
||||
call s:_setScreenColumn(e)
|
||||
endfor
|
||||
call sort(self._cachedMessages[b][l], 's:_compareErrorItemsByColumns')
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
|
||||
for b in keys(self._cachedMessages)
|
||||
for l in keys(self._cachedMessages[b])
|
||||
call s:_removeShadowedItems(self._cachedMessages[b][l])
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
endif
|
||||
|
||||
return get(self._cachedMessages, a:buf, {})
|
||||
@ -210,7 +247,7 @@ endfunction " }}}2
|
||||
"
|
||||
"Note that all comparisons are done with ==?
|
||||
function! g:SyntasticLoclist.filter(filters) " {{{2
|
||||
let conditions = values(map(copy(a:filters), 's:translate(v:key, v:val)'))
|
||||
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)
|
||||
@ -271,10 +308,93 @@ endfunction " }}}2
|
||||
|
||||
" Private functions {{{1
|
||||
|
||||
function! s:translate(key, val) " {{{2
|
||||
function! s:_translate(key, val) " {{{2
|
||||
return 'get(v:val, ' . string(a:key) . ', "") ==? ' . string(a:val)
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_setScreenColumn(item) " {{{2
|
||||
if !has_key(a:item, 'scol')
|
||||
let col = get(a:item, 'col', 0)
|
||||
if col != 0 && get(a:item, 'vcol', 0) == 0
|
||||
let buf = str2nr(a:item['bufnr'])
|
||||
try
|
||||
let line = getbufline(buf, a:item['lnum'])[0]
|
||||
catch /\m^Vim\%((\a\+)\)\=:E684/
|
||||
let line = ''
|
||||
endtry
|
||||
let a:item['scol'] = syntastic#util#screenWidth(strpart(line, 0, col), getbufvar(buf, '&tabstop'))
|
||||
else
|
||||
let a:item['scol'] = col
|
||||
endif
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_removeShadowedItems(errors) " {{{2
|
||||
" keep only the first message at a given column
|
||||
let i = 0
|
||||
while i < len(a:errors) - 1
|
||||
let j = i + 1
|
||||
let dupes = 0
|
||||
while j < len(a:errors) && a:errors[j].scol == a:errors[i].scol
|
||||
let dupes = 1
|
||||
let j += 1
|
||||
endwhile
|
||||
if dupes
|
||||
call remove(a:errors, i + 1, j - 1)
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
|
||||
" merge messages with the same text
|
||||
let i = 0
|
||||
while i < len(a:errors) - 1
|
||||
let j = i + 1
|
||||
let dupes = 0
|
||||
while j < len(a:errors) && a:errors[j].text == a:errors[i].text
|
||||
let dupes = 1
|
||||
let j += 1
|
||||
endwhile
|
||||
if dupes
|
||||
call remove(a:errors, i + 1, j - 1)
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_compareErrorItemsByColumns(a, b) " {{{2
|
||||
if a:a['bufnr'] != a:b['bufnr']
|
||||
" group by file
|
||||
return a:a['bufnr'] - a:b['bufnr']
|
||||
elseif a:a['lnum'] != a:b['lnum']
|
||||
" sort by line
|
||||
return a:a['lnum'] - a:b['lnum']
|
||||
elseif a:a['scol'] != a:b['scol']
|
||||
" sort by screen column
|
||||
return a:a['scol'] - a:b['scol']
|
||||
elseif a:a['type'] !=? a:b['type']
|
||||
" errors take precedence over warnings
|
||||
return a:a['type'] ==? 'E' ? -1 : 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_compareErrorItemsByLines(a, b) " {{{2
|
||||
if a:a['bufnr'] != a:b['bufnr']
|
||||
" group by file
|
||||
return a:a['bufnr'] - a:b['bufnr']
|
||||
elseif a:a['lnum'] != a:b['lnum']
|
||||
" sort by line
|
||||
return a:a['lnum'] - a:b['lnum']
|
||||
elseif a:a['type'] !=? a:b['type']
|
||||
" errors take precedence over warnings
|
||||
return a:a['type'] ==? 'E' ? -1 : 1
|
||||
else
|
||||
" sort by screen column
|
||||
return a:a['scol'] - a:b['scol']
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -72,10 +72,11 @@ let s:defaultCheckers = {
|
||||
\ 'scss': ['sass', 'scss_lint'],
|
||||
\ 'sh': ['sh', 'shellcheck'],
|
||||
\ 'slim': ['slimrb'],
|
||||
\ 'spec': ['rpmlint'],
|
||||
\ 'tcl': ['nagelfar'],
|
||||
\ 'tex': ['lacheck', 'chktex'],
|
||||
\ 'texinfo': ['makeinfo'],
|
||||
\ 'text': ['atdtool'],
|
||||
\ 'text': [],
|
||||
\ 'twig': ['twiglint'],
|
||||
\ 'typescript': ['tsc'],
|
||||
\ 'vala': ['valac'],
|
||||
@ -96,7 +97,8 @@ lockvar! s:defaultCheckers
|
||||
let s:defaultFiletypeMap = {
|
||||
\ 'gentoo-metadata': 'xml',
|
||||
\ 'lhaskell': 'haskell',
|
||||
\ 'litcoffee': 'coffee'
|
||||
\ 'litcoffee': 'coffee',
|
||||
\ 'mail': 'text'
|
||||
\ }
|
||||
lockvar! s:defaultFiletypeMap
|
||||
|
||||
@ -130,7 +132,7 @@ endfunction " }}}2
|
||||
" not checked for availability (that is, the corresponding IsAvailable() are
|
||||
" not run).
|
||||
function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) " {{{2
|
||||
let ft = s:normaliseFiletype(a:ftalias)
|
||||
let ft = s:_normaliseFiletype(a:ftalias)
|
||||
call self._loadCheckersFor(ft)
|
||||
|
||||
let checkers_map = self._checkerMap[ft]
|
||||
@ -173,13 +175,13 @@ function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2
|
||||
let ft = s:normaliseFiletype(a:ftalias)
|
||||
let ft = s:_normaliseFiletype(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
|
||||
let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:normaliseFiletype(v:val)' ))
|
||||
let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:_normaliseFiletype(v:val)' ))
|
||||
if len(ft_list) != 1
|
||||
let available = []
|
||||
let active = []
|
||||
@ -253,7 +255,7 @@ endfunction " }}}2
|
||||
|
||||
"resolve filetype aliases, and replace - with _ otherwise we cant name
|
||||
"syntax checker functions legally for filetypes like "gentoo-metadata"
|
||||
function! s:normaliseFiletype(ftalias) " {{{2
|
||||
function! s:_normaliseFiletype(ftalias) " {{{2
|
||||
let ft = get(s:defaultFiletypeMap, a:ftalias, a:ftalias)
|
||||
let ft = get(g:syntastic_filetype_map, ft, ft)
|
||||
let ft = substitute(ft, '\m-', '_', 'g')
|
||||
|
@ -18,7 +18,7 @@ let g:loaded_syntastic_arduino_avrgcc_checker = 1
|
||||
runtime! syntax_checkers/c/*.vim
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'c',
|
||||
\ 'filetype': 'arduino',
|
||||
\ 'name': 'avrgcc',
|
||||
\ 'exec': 'avr-gcc',
|
||||
\ 'redirect': 'c/avrgcc'})
|
||||
|
@ -0,0 +1,65 @@
|
||||
"============================================================================
|
||||
"File: clang_check.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Benjamin Bannier <bbannier 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_c_clang_check_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_c_clang_check_checker = 1
|
||||
|
||||
if !exists('g:syntastic_clang_check_config_file')
|
||||
let g:syntastic_clang_check_config_file = '.syntastic_clang_check_config'
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_c_clang_check_IsAvailable() dict
|
||||
return executable(self.getExec())
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_c_clang_check_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'post_args':
|
||||
\ '-- ' .
|
||||
\ syntastic#c#ReadConfig(g:syntastic_clang_check_config_file) . ' ' .
|
||||
\ '-fshow-column ' .
|
||||
\ '-fshow-source-location ' .
|
||||
\ '-fno-caret-diagnostics ' .
|
||||
\ '-fno-color-diagnostics ' .
|
||||
\ '-fdiagnostics-format=clang' })
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l:%c: fatal error: %m,' .
|
||||
\ '%E%f:%l:%c: error: %m,' .
|
||||
\ '%W%f:%l:%c: warning: %m,' .
|
||||
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
|
||||
\ '%E%m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr('')},
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'c',
|
||||
\ 'name': 'clang_check',
|
||||
\ 'exec': 'clang-check'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -0,0 +1,65 @@
|
||||
"============================================================================
|
||||
"File: clang_tidy.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Benjamin Bannier <bbannier 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_c_clang_tidy_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_c_clang_tidy_checker = 1
|
||||
|
||||
if !exists('g:syntastic_clang_tidy_config_file')
|
||||
let g:syntastic_clang_tidy_config_file = '.syntastic_clang_tidy_config'
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_c_clang_tidy_IsAvailable() dict
|
||||
return executable(self.getExec())
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_c_clang_tidy_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'post_args':
|
||||
\ '-- ' .
|
||||
\ syntastic#c#ReadConfig(g:syntastic_clang_tidy_config_file) . ' ' .
|
||||
\ '-fshow-column ' .
|
||||
\ '-fshow-source-location ' .
|
||||
\ '-fno-caret-diagnostics ' .
|
||||
\ '-fno-color-diagnostics ' .
|
||||
\ '-fdiagnostics-format=clang' })
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l:%c: fatal error: %m,' .
|
||||
\ '%E%f:%l:%c: error: %m,' .
|
||||
\ '%W%f:%l:%c: warning: %m,' .
|
||||
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
|
||||
\ '%E%m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr('')},
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'c',
|
||||
\ 'name': 'clang_tidy',
|
||||
\ 'exec': 'clang-tidy'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -30,15 +30,13 @@ set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_c_oclint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'post_args_before': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) })
|
||||
\ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) })
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l:%c: %m P1 ,' .
|
||||
\ '%E%f:%l:%c: %m P2 ,' .
|
||||
\ '%W%f:%l:%c: %m P3 ,' .
|
||||
\ '%E%f:%l:%c: fatal error: %m,' .
|
||||
\ '%E%f:%l:%c: error: %m,' .
|
||||
\ '%W%f:%l:%c: warning: %m,' .
|
||||
\ '%E%f:%l:%c: %m,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
@ -48,6 +46,15 @@ function! SyntaxCheckers_c_oclint_GetLocList() dict
|
||||
\ 'postprocess': ['compressWhitespace'],
|
||||
\ 'returns': [0, 3, 5] })
|
||||
|
||||
for e in loclist
|
||||
if e['text'] =~# '\v P3( |$)'
|
||||
let e['type'] = 'W'
|
||||
endif
|
||||
|
||||
let e['text'] = substitute(e['text'], '\m\C P[1-3]$', '', '')
|
||||
let e['text'] = substitute(e['text'], '\m\C P[1-3] ', ': ', '')
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
|
65
sources_non_forked/syntastic/syntax_checkers/c/pc_lint.vim
Normal file
65
sources_non_forked/syntastic/syntax_checkers/c/pc_lint.vim
Normal file
@ -0,0 +1,65 @@
|
||||
"============================================================================
|
||||
"File: pc_lint.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Steve Bragg <steve at empresseffects 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_c_pc_lint_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_c_pc_lint_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if !exists('g:syntastic_pc_lint_config_file')
|
||||
let g:syntastic_pc_lint_config_file = 'options.lnt'
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
|
||||
let config = findfile(g:syntastic_pc_lint_config_file, '.;')
|
||||
|
||||
" -hFs1 - show filename, add space after messages, try to make message 1 line
|
||||
" -width(0,0) - make sure there are no line breaks
|
||||
" -t - set tab size
|
||||
" -v - turn off verbosity
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': (filereadable(config) ? syntastic#util#shescape(fnamemodify(config, ':p')) : ''),
|
||||
\ 'args_after': ['-hFs1', '-width(0,0)', '-t' . &tabstop, '-format=%f:%l:%C:%t:%n:%m'] })
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l:%v:Error:%n:%m,' .
|
||||
\ '%W%f:%l:%v:Warning:%n:%m,' .
|
||||
\ '%I%f:%l:%v:Info:%n:%m,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['cygwinRemoveCR'] })
|
||||
|
||||
for e in loclist
|
||||
if e['type'] ==? 'I'
|
||||
let e['type'] = 'W'
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'c',
|
||||
\ 'name': 'pc_lint',
|
||||
\ 'exec': 'lint-nt'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -0,0 +1,25 @@
|
||||
"============================================================================
|
||||
"File: clang_check.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Benjamin Bannier <bbannier 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_cpp_clang_check_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_cpp_clang_check_checker = 1
|
||||
|
||||
runtime! syntax_checkers/c/*.vim
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'cpp',
|
||||
\ 'name': 'clang_check',
|
||||
\ 'exec': 'clang-check',
|
||||
\ 'redirect': 'c/clang_check'})
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -0,0 +1,25 @@
|
||||
"============================================================================
|
||||
"File: clang_tidy.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Benjamin Bannier <bbannier 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_cpp_clang_tidy_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_cpp_clang_tidy_checker = 1
|
||||
|
||||
runtime! syntax_checkers/c/*.vim
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'cpp',
|
||||
\ 'name': 'clang_tidy',
|
||||
\ 'exec': 'clang-tidy',
|
||||
\ 'redirect': 'c/clang_tidy'})
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
26
sources_non_forked/syntastic/syntax_checkers/cpp/pc_lint.vim
Normal file
26
sources_non_forked/syntastic/syntax_checkers/cpp/pc_lint.vim
Normal file
@ -0,0 +1,26 @@
|
||||
"============================================================================
|
||||
"File: pc_lint.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Steve Bragg <steve at empresseffects 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_cpp_pc_lint_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_cpp_pc_lint_checker = 1
|
||||
|
||||
runtime! syntax_checkers/c/*.vim
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'cpp',
|
||||
\ 'name': 'pc_lint',
|
||||
\ 'exec': 'lint-nt',
|
||||
\ 'redirect': 'c/pc_lint'})
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -32,7 +32,7 @@ main([FileName, "-rebar", Path, LibDirs]) ->
|
||||
%io:format("~p~n", [LibDirs1]),
|
||||
compile(FileName, LibDirs1);
|
||||
|
||||
main([FileName, LibDirs]) ->
|
||||
main([FileName | LibDirs]) ->
|
||||
compile(FileName, LibDirs).
|
||||
|
||||
compile(FileName, LibDirs) ->
|
||||
@ -45,7 +45,12 @@ compile(FileName, LibDirs) ->
|
||||
warn_export_vars,
|
||||
strong_validation,
|
||||
report] ++
|
||||
[{i, filename:join(Root, I)} || I <- LibDirs]).
|
||||
[{i, filename:join(Root, I)} || I <- LibDirs] ++
|
||||
case lists:member("deps/pmod_transform/include", LibDirs) of
|
||||
true -> [{parse_transform, pmod_pt}];
|
||||
_ -> []
|
||||
end
|
||||
).
|
||||
|
||||
get_root(Dir) ->
|
||||
Path = filename:split(filename:absname(Dir)),
|
||||
|
@ -42,9 +42,16 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
|
||||
\ syntastic#util#shescape('puts ERB.new(File.read(' .
|
||||
\ fname . encoding_spec .
|
||||
\ ').gsub(''<%='',''<%''), nil, ''-'').src') .
|
||||
\ ' | ' . self.getExecEscaped() . ' -c'
|
||||
\ ' | ' . self.getExecEscaped() . ' -w -c'
|
||||
|
||||
let errorformat =
|
||||
let errorformat = '%-G%\m%.%#warning: %\%%(possibly %\)%\?useless use of a literal in void context,'
|
||||
|
||||
" filter out lines starting with ...
|
||||
" long lines are truncated and wrapped in ... %p then returns the wrong
|
||||
" column offset
|
||||
let errorformat .= '%-G%\%.%\%.%\%.%.%#,'
|
||||
|
||||
let errorformat .=
|
||||
\ '%-GSyntax OK,'.
|
||||
\ '%E-:%l: syntax error\, %m,%Z%p^,'.
|
||||
\ '%W-:%l: warning: %m,'.
|
||||
|
@ -29,6 +29,7 @@ function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['guards'],
|
||||
\ 'defaults': {'bufnr': bufnr("")} })
|
||||
endfunction
|
||||
|
||||
|
@ -27,19 +27,27 @@ endif
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_java_checkstyle_IsAvailable() dict
|
||||
return
|
||||
\ executable(self.getExec()) &&
|
||||
\ filereadable(expand(g:syntastic_java_checkstyle_classpath)) &&
|
||||
\ filereadable(expand(g:syntastic_java_checkstyle_conf_file))
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_java_checkstyle_GetLocList() dict
|
||||
|
||||
let fname = syntastic#util#shescape( expand('%:p:h') . '/' . expand('%:t') )
|
||||
let fname = syntastic#util#shescape( expand('%:p:h') . syntastic#util#Slash() . expand('%:t') )
|
||||
|
||||
if has('win32unix')
|
||||
let fname = substitute(system('cygpath -m ' . fname), '\m\%x00', '', 'g')
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': '-cp ' . g:syntastic_java_checkstyle_classpath .
|
||||
\ ' com.puppycrawl.tools.checkstyle.Main -c ' .
|
||||
\ syntastic#util#shexpand(g:syntastic_java_checkstyle_conf_file) .
|
||||
\ ' -f xml',
|
||||
\ 'args_after': [
|
||||
\ '-cp', expand(g:syntastic_java_checkstyle_classpath),
|
||||
\ 'com.puppycrawl.tools.checkstyle.Main',
|
||||
\ '-c', expand(g:syntastic_java_checkstyle_conf_file),
|
||||
\ '-f', 'xml'],
|
||||
\ 'fname': fname })
|
||||
|
||||
let errorformat = '%f:%t:%l:%c:%m'
|
||||
|
@ -35,7 +35,8 @@ function! SyntaxCheckers_javascript_eslint_GetLocList() dict
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['guards'] })
|
||||
|
||||
for e in loclist
|
||||
let e['col'] += 1
|
||||
|
@ -58,6 +58,7 @@ function! SyntaxCheckers_less_lessc_GetLocList() dict
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['guards'],
|
||||
\ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} })
|
||||
endfunction
|
||||
|
||||
|
@ -71,7 +71,7 @@ if !exists('g:syntastic_ocaml_use_ocamlc') || !executable('ocamlc')
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_ocaml_use_janestreet_core')
|
||||
let g:syntastic_ocaml_use_ocamlc = 0
|
||||
let g:syntastic_ocaml_use_janestreet_core = 0
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable("ocamlbuild")
|
||||
|
@ -38,7 +38,8 @@ function! SyntaxCheckers_php_php_GetLocList() dict
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['guards'] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
91
sources_non_forked/syntastic/syntax_checkers/php/phplint.vim
Normal file
91
sources_non_forked/syntastic/syntax_checkers/php/phplint.vim
Normal file
@ -0,0 +1,91 @@
|
||||
"============================================================================
|
||||
"File: phplint.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_php_phplint_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_php_phplint_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_php_phplint_GetHighlightRegex(item)
|
||||
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
|
||||
if term != ''
|
||||
return '\V' . escape(term, '\')
|
||||
endif
|
||||
let term = matchstr(a:item['text'], '\m\(class\|function\|method\) \zs\S\+\ze was declared as')
|
||||
if term != ''
|
||||
return '\V' . escape(term, '\')
|
||||
endif
|
||||
let term = matchstr(a:item['text'], '\maccess forbidden to \(private\|protected\) \(class\|constant\|method\|variable\|\(private\|protected\) property\) \zs\S\+\ze')
|
||||
if term != ''
|
||||
return '\V' . escape(term, '\')
|
||||
endif
|
||||
let term = matchstr(a:item['text'], '\musing deprecated \(class\|constant\|method\|property\|variable\) \zs\S\+\ze')
|
||||
if term != ''
|
||||
return '\V' . escape(term, '\')
|
||||
endif
|
||||
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
|
||||
if term != ''
|
||||
return '\V' . escape(term, '\')
|
||||
endif
|
||||
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
|
||||
if term != ''
|
||||
return '\V' . escape(term, '\')
|
||||
endif
|
||||
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
|
||||
return term != '' ? '\V' . escape(term, '\') : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_php_phplint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after':
|
||||
\ '--print-file-name ' .
|
||||
\ '--print-line-numbers ' .
|
||||
\ '--print-column-number ' .
|
||||
\ '--print-errors ' .
|
||||
\ '--print-warnings ' .
|
||||
\ '--no-print-notices ' .
|
||||
\ '--no-print-context ' .
|
||||
\ '--no-print-source ' .
|
||||
\ '--tab-size ' . &tabstop })
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l:%v: %tRROR: %m,' .
|
||||
\ '%W%f:%l:%v: %tarning: %m,' .
|
||||
\ '%+C%\t%.%#,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['compressWhitespace'],
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
for e in loclist
|
||||
let e['text'] = substitute(e['text'], '\m \(Hint\|Examples\):.*', '', '')
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'php',
|
||||
\ 'name': 'phplint',
|
||||
\ 'exec': 'phpl' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -32,8 +32,8 @@ function! SyntaxCheckers_puppet_puppet_GetLocList() dict
|
||||
let errorformat =
|
||||
\ '%-Gerr: Try ''puppet help parser validate'' for usage,' .
|
||||
\ '%-GError: Try ''puppet help parser validate'' for usage,' .
|
||||
\ '%Eerr: Could not parse for environment %*[a-z]: %m at %f:%l,' .
|
||||
\ '%EError: Could not parse for environment %*[a-z]: %m at %f:%l'
|
||||
\ '%A%t%*[a-zA-Z]: %m at %f:%l:%c,' .
|
||||
\ '%A%t%*[a-zA-Z]: %m at %f:%l'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
|
@ -42,7 +42,7 @@ function! SyntaxCheckers_python_frosted_GetLocList() dict
|
||||
if len(parts) >= 4
|
||||
let e["type"] = parts[1][0]
|
||||
let e["text"] = parts[3] . ' [' . parts[1] . ']'
|
||||
let e["hl"] = '\V' . escape(parts[2], '\')
|
||||
let e["hl"] = '\V\<' . escape(parts[2], '\') . '\>'
|
||||
elseif e["text"] =~? '\v^I\d+:'
|
||||
let e["valid"] = 0
|
||||
else
|
||||
|
@ -69,8 +69,10 @@ function! s:PylintNew(exe)
|
||||
" On Gentoo Linux it's "pylint-python2.7 0.28.0".
|
||||
" On NixOS, that would be ".pylint-wrapped 0.26.0".
|
||||
" On Arch Linux it's "pylint2 1.1.0".
|
||||
" On new-ish Fedora it's "python3-pylint 1.2.0".
|
||||
" Have you guys considered switching to creative writing yet? ;)
|
||||
let pylint_version = filter(split(system(exe . ' --version'), '\m, \=\|\n'), 'v:val =~# ''\m^\.\=pylint[-0-9]*\>''')[0]
|
||||
let pylint_version = filter( split(system(exe . ' --version'), '\m, \=\|\n'),
|
||||
\ 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0]
|
||||
let pylint_version = substitute(pylint_version, '\v^\S+\s+', '', '')
|
||||
let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1])
|
||||
catch /\m^Vim\%((\a\+)\)\=:E684/
|
||||
|
@ -44,7 +44,7 @@ function! SyntaxCheckers_ruby_mri_GetLocList() dict
|
||||
"
|
||||
"Which always generate the warning below. Note that ruby >= 1.9.3 includes
|
||||
"the word "possibly" in the warning
|
||||
let errorformat = '%-G%.%#warning: %\(possibly %\)%\?useless use of == in void context,'
|
||||
let errorformat = '%-G%\m%.%#warning: %\%%(possibly %\)%\?useless use of == in void context,'
|
||||
|
||||
" filter out lines starting with ...
|
||||
" long lines are truncated and wrapped in ... %p then returns the wrong
|
||||
|
@ -43,7 +43,7 @@ function! SyntaxCheckers_sass_sass_GetLocList() dict
|
||||
\ 'args_before': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check' })
|
||||
|
||||
let errorformat =
|
||||
\ '%ESyntax %trror: %m,' .
|
||||
\ '%E%\m%\%%(Syntax %\)%\?%trror: %m,' .
|
||||
\ '%+C %.%#,' .
|
||||
\ '%C on line %l of %f\, %.%#,' .
|
||||
\ '%C on line %l of %f,' .
|
||||
|
@ -0,0 +1,71 @@
|
||||
"============================================================================
|
||||
"File: scalastyle.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_scala_scalastyle_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_scala_scalastyle_checker = 1
|
||||
|
||||
if !exists('g:syntastic_scala_scalastyle_jar')
|
||||
let g:syntastic_scala_scalastyle_jar = 'scalastyle-batch_2.10.jar'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_scala_scalastyle_config_file')
|
||||
let g:syntastic_scala_scalastyle_config_file = 'scalastyle_config.xml'
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_scala_scalastyle_IsAvailable() dict
|
||||
return
|
||||
\ executable(self.getExec()) &&
|
||||
\ filereadable(expand(g:syntastic_scala_scalastyle_jar)) &&
|
||||
\ filereadable(expand(g:syntastic_scala_scalastyle_config_file))
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_scala_scalastyle_GetLocList() dict
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_after': ['-jar', expand(g:syntastic_scala_scalastyle_jar)],
|
||||
\ 'args_before': ['-q', 'true', '-c', expand(g:syntastic_scala_scalastyle_config_file)] })
|
||||
|
||||
let errorformat =
|
||||
\ '%trror file=%f message=%m line=%l column=%c,' .
|
||||
\ '%trror file=%f message=%m line=%l,' .
|
||||
\ '%tarning file=%f message=%m line=%l column=%c,' .
|
||||
\ '%tarning file=%f message=%m line=%l'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
for e in loclist
|
||||
if has_key(e, 'col')
|
||||
let e['col'] += 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'scala',
|
||||
\ 'name': 'scalastyle',
|
||||
\ 'exec': 'java'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -31,7 +31,7 @@ function! SyntaxCheckers_scss_scss_lint_GetLocList() dict
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0, 1, 65] })
|
||||
\ 'returns': [0, 1, 2, 65, 66] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -57,7 +57,7 @@ function! s:GetShell()
|
||||
endif
|
||||
" try to use env variable in case no shebang could be found
|
||||
if b:shell == ''
|
||||
let b:shell = fnamemodify(expand('$SHELL'), ':t')
|
||||
let b:shell = fnamemodify($SHELL, ':t')
|
||||
endif
|
||||
endif
|
||||
return b:shell
|
||||
|
@ -0,0 +1,43 @@
|
||||
"============================================================================
|
||||
"File: rpmlint.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_spec_rpmlint_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_spec_rpmlint_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_spec_rpmlint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l: E: %m,' .
|
||||
\ '%E%f: E: %m,' .
|
||||
\ '%W%f:%l: W: %m,' .
|
||||
\ '%W%f: W: %m,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'spec',
|
||||
\ 'name': 'rpmlint'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -44,6 +44,8 @@ function! SyntaxCheckers_text_atdtool_GetLocList() dict
|
||||
let e['text'] = substitute(e['text'], '\m\n\s\+', ' | ', 'g')
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
|
Reference in New Issue
Block a user