1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-18 12:00:30 +01:00

Plugins update

This commit is contained in:
2012-03-12 17:00:46 +01:00
parent c2500d764e
commit 7cbe6dca6d
37 changed files with 977 additions and 589 deletions

View File

@@ -55,7 +55,7 @@ Installation
cd ~/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git
Then reload vim, run `:helptags`, and check out `:help syntastic.txt`.
Then reload vim, run `:Helptags`, and check out `:help syntastic.txt`.
Google group
@@ -64,6 +64,16 @@ Google group
To get information or make suggestions check out the [google group](https://groups.google.com/group/vim-syntastic).
FAQ
---
__Q. I installed syntastic but it isn't reporting any errors ...__
A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/<filetype>.vim`.
Another reason it could fail is that the error output for the 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.
Changelog
---------
2.3.0 (16-feb-2012)

View File

@@ -38,6 +38,34 @@ function! s:Init()
call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', [])
endfunction
" default include directories
let s:default_includes = [ '.', '..', 'include', 'includes',
\ '../include', '../includes' ]
" uniquify the input list
function! s:Unique(list)
let l = []
for elem in a:list
if index(l, elem) == -1
let l = add(l, elem)
endif
endfor
return l
endfunction
" get the gcc include directory argument depending on the default
" includes and the optional user-defined 'g:syntastic_c_include_dirs'
function! syntastic#c#GetIncludeDirs(filetype)
let include_dirs = copy(s:default_includes)
if exists('g:syntastic_'.a:filetype.'_include_dirs')
call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs)
endif
return join(map(s:Unique(include_dirs), '"-I" . v:val'), ' ')
endfunction
" search the first 100 lines for include statements that are
" given in the handlers dictionary
function! syntastic#c#SearchHeaders()

View File

@@ -127,6 +127,10 @@ function! s:UpdateErrors(auto_invoked)
call s:RefreshSigns()
endif
if g:syntastic_enable_highlighting
call s:HightlightErrors()
endif
if g:syntastic_auto_jump && s:BufHasErrorsOrWarningsToDisplay()
silent! ll
endif
@@ -160,8 +164,10 @@ function! s:LocList()
endfunction
"clear the loc list for the buffer
function! s:ClearLocList()
function! s:ClearCache()
let b:syntastic_loclist = []
unlet! b:syntastic_errors
unlet! b:syntastic_warnings
endfunction
"detect and cache all syntax errors in this buffer
@@ -169,7 +175,7 @@ endfunction
"depends on a function called SyntaxCheckers_{&ft}_GetLocList() existing
"elsewhere
function! s:CacheErrors()
call s:ClearLocList()
call s:ClearCache()
if filereadable(expand("%"))
@@ -195,7 +201,7 @@ function! s:ToggleMode()
let g:syntastic_mode_map['mode'] = "active"
endif
call s:ClearLocList()
call s:ClearCache()
call s:UpdateErrors(1)
echo "Syntastic: " . g:syntastic_mode_map['mode'] . " mode enabled"
@@ -217,30 +223,22 @@ function! s:ModeMapAllowsAutoChecking()
endif
endfunction
"return true if there are cached errors/warnings for this buf
function! s:BufHasErrorsOrWarnings()
return !empty(s:LocList())
endfunction
"return true if there are cached errors for this buf
function! s:BufHasErrors()
return len(s:ErrorsForType('E')) > 0
endfunction
function! s:BufHasErrorsOrWarningsToDisplay()
return s:BufHasErrors() || (!g:syntastic_quiet_warnings && s:BufHasErrorsOrWarnings())
endfunction
function! s:ErrorsForType(type)
return s:FilterLocList({'type': a:type})
return len(s:Errors()) || (!g:syntastic_quiet_warnings && !empty(s:LocList()))
endfunction
function! s:Errors()
return s:ErrorsForType("E")
if !exists("b:syntastic_errors")
let b:syntastic_errors = s:FilterLocList({'type': "E"})
endif
return b:syntastic_errors
endfunction
function! s:Warnings()
return s:ErrorsForType("W")
if !exists("b:syntastic_warnings")
let b:syntastic_warnings = s:FilterLocList({'type': "W"})
endif
return b:syntastic_warnings
endfunction
"Filter a loc list (defaults to s:LocList()) by a:filters
@@ -253,16 +251,21 @@ endfunction
function! s:FilterLocList(filters, ...)
let llist = a:0 ? a:1 : s:LocList()
let rv = deepcopy(llist)
for error in llist
for key in keys(a:filters)
let rhs = a:filters[key]
if type(rhs) == 1 "string
let rhs = '"' . rhs . '"'
endif
let rv = []
call filter(rv, "v:val['".key."'] ==? " . rhs)
for error in llist
let passes_filters = 1
for key in keys(a:filters)
if error[key] !=? a:filters[key]
let passes_filters = 0
break
endif
endfor
if passes_filters
call add(rv, error)
endif
endfor
return rv
endfunction
@@ -351,6 +354,43 @@ function! s:ShowLocList()
endif
endfunction
"highlight the current errors using matchadd()
"
"The function `Syntastic_{&ft}_GetHighlightRegex` is used to get the regex to
"highlight errors that do not have a 'col' key (and hence cant be done
"automatically). This function must take one arg (an error item) and return a
"regex to match that item in the buffer.
"
"If the 'force_highlight_callback' key is set for an error item, then invoke
"the callback even if it can be highlighted automatically.
function! s:HightlightErrors()
call s:ClearErrorHighlights()
let fts = substitute(&ft, '-', '_', 'g')
for ft in split(fts, '\.')
for item in s:LocList()
let force_callback = has_key(item, 'force_highlight_callback') && item['force_highlight_callback']
let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning'
if item['col'] && !force_callback
let lastcol = col([item['lnum'], '$'])
let lcol = min([lastcol, item['col']])
call matchadd(group, '\%'.item['lnum'].'l\%'.lcol.'c')
else
if exists("*SyntaxCheckers_". ft ."_GetHighlightRegex")
let term = SyntaxCheckers_{ft}_GetHighlightRegex(item)
if len(term) > 0
call matchadd(group, '\%' . item['lnum'] . 'l' . term)
endif
endif
endif
endfor
endfor
endfunction
"remove all error highlights from the window
function! s:ClearErrorHighlights()
for match in getmatches()
@@ -439,30 +479,33 @@ function! SyntasticStatuslineFlag()
let errors = s:Errors()
let warnings = s:Warnings()
let num_errors = len(errors)
let num_warnings = len(warnings)
let output = g:syntastic_stl_format
"hide stuff wrapped in %E(...) unless there are errors
let output = substitute(output, '\C%E{\([^}]*\)}', len(errors) ? '\1' : '' , 'g')
let output = substitute(output, '\C%E{\([^}]*\)}', num_errors ? '\1' : '' , 'g')
"hide stuff wrapped in %W(...) unless there are warnings
let output = substitute(output, '\C%W{\([^}]*\)}', len(warnings) ? '\1' : '' , 'g')
let output = substitute(output, '\C%W{\([^}]*\)}', num_warnings ? '\1' : '' , 'g')
"hide stuff wrapped in %B(...) unless there are both errors and warnings
let output = substitute(output, '\C%B{\([^}]*\)}', (len(warnings) && len(errors)) ? '\1' : '' , 'g')
let output = substitute(output, '\C%B{\([^}]*\)}', (num_warnings && num_errors) ? '\1' : '' , 'g')
"sub in the total errors/warnings/both
let output = substitute(output, '\C%w', len(warnings), 'g')
let output = substitute(output, '\C%e', len(errors), 'g')
let output = substitute(output, '\C%w', num_warnings, 'g')
let output = substitute(output, '\C%e', num_errors, 'g')
let output = substitute(output, '\C%t', len(s:LocList()), 'g')
"first error/warning line num
let output = substitute(output, '\C%F', s:LocList()[0]['lnum'], 'g')
"first error line num
let output = substitute(output, '\C%fe', len(errors) ? errors[0]['lnum'] : '', 'g')
let output = substitute(output, '\C%fe', num_errors ? errors[0]['lnum'] : '', 'g')
"first warning line num
let output = substitute(output, '\C%fw', len(warnings) ? warnings[0]['lnum'] : '', 'g')
let output = substitute(output, '\C%fw', num_warnings ? warnings[0]['lnum'] : '', 'g')
return output
else
@@ -539,37 +582,6 @@ function! SyntasticErrorBalloonExpr()
return get(b:syntastic_balloons, v:beval_lnum, '')
endfunction
"highlight the list of errors (a:errors) using matchadd()
"
"a:termfunc is provided to highlight errors that do not have a 'col' key (and
"hence cant be done automatically). This function must take one arg (an error
"item) and return a regex to match that item in the buffer.
"
"an optional boolean third argument can be provided to force a:termfunc to be
"used regardless of whether a 'col' key is present for the error
function! SyntasticHighlightErrors(errors, termfunc, ...)
if !g:syntastic_enable_highlighting
return
endif
call s:ClearErrorHighlights()
let force_callback = a:0 && a:1
for item in a:errors
let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning'
if item['col'] && !force_callback
let lastcol = col([item['lnum'], '$'])
let lcol = min([lastcol, item['col']])
call matchadd(group, '\%'.item['lnum'].'l\%'.lcol.'c')
else
let term = a:termfunc(item)
if len(term) > 0
call matchadd(group, '\%' . item['lnum'] . 'l' . term)
endif
endif
endfor
endfunction
"take a list of errors and add default values to them from a:options
function! SyntasticAddToErrors(errors, options)
for i in range(0, len(a:errors)-1)

View File

@@ -64,56 +64,33 @@ endif
let s:save_cpo = &cpo
set cpo&vim
" default include directories
let s:default_includes = [ '.', '..', 'include', 'includes',
\ '../include', '../includes' ]
" uniquify the input list
function! s:Unique(list)
let l = []
for elem in a:list
if index(l, elem) == -1
let l = add(l, elem)
endif
endfor
return l
endfunction
" get the gcc include directory argument depending on the default
" includes and the optional user-defined 'g:syntastic_c_include_dirs'
function! s:GetIncludeDirs()
let include_dirs = s:default_includes
if exists('g:syntastic_c_include_dirs')
call extend(include_dirs, g:syntastic_c_include_dirs)
endif
return join(map(s:Unique(include_dirs), '"-I" . v:val'), ' ')
endfunction
if !exists('g:syntastic_c_compiler_options')
let g:syntastic_c_compiler_options = '-std=gnu99'
endif
function! SyntaxCheckers_c_GetLocList()
let makeprg = 'gcc -fsyntax-only -std=gnu99 '.shellescape(expand('%')).
\ ' '.s:GetIncludeDirs()
let makeprg = 'gcc -fsyntax-only '
let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '.
\ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '.
\ 'each function it appears%.%#,%-GIn file included%.%#,'.
\ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m'
" add optional user-defined compiler options
let makeprg .= g:syntastic_c_compiler_options
let makeprg .= ' '.shellescape(expand('%')).
\ ' '.syntastic#c#GetIncludeDirs('c')
" determine whether to parse header files as well
if expand('%') =~? '.h$'
if exists('g:syntastic_c_check_header')
let makeprg = 'gcc -c '.shellescape(expand('%')).
\ ' '.s:GetIncludeDirs()
\ ' '.syntastic#c#GetIncludeDirs('c')
else
return []
endif
endif
" add optional user-defined compiler options
if exists('g:syntastic_c_compiler_options')
let makeprg .= g:syntastic_c_compiler_options
endif
" check if the user manually set some cflags
if !exists('b:syntastic_c_cflags')
" check whether to search for include files at all

View File

@@ -20,6 +20,12 @@
"
" let g:syntastic_cpp_no_include_search = 1
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_cpp_include_dirs. This list can be used like this:
"
" let g:syntastic_cpp_include_dirs = [ 'includes', 'headers' ]
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
@@ -39,6 +45,12 @@
" checking execution via the variable 'g:syntastic_cpp_compiler_options':
"
" let g:syntastic_cpp_compiler_options = ' -std=c++0x'
"
" Using the global variable 'g:syntastic_cpp_remove_include_errors' you can
" specify whether errors of files included via the
" g:syntastic_cpp_include_dirs' setting are removed from the result set:
"
" let g:syntastic_cpp_remove_include_errors = 1
if exists('loaded_cpp_syntax_checker')
finish
@@ -53,21 +65,25 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cpp_GetLocList()
let makeprg = 'g++ -fsyntax-only '.shellescape(expand('%'))
let makeprg = 'g++ -fsyntax-only '
let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
if exists('g:syntastic_cpp_check_header')
let makeprg = 'g++ -c '.shellescape(expand('%'))
else
return []
endif
endif
if exists('g:syntastic_cpp_compiler_options')
let makeprg .= g:syntastic_cpp_compiler_options
endif
let makeprg .= ' ' . shellescape(expand('%')) .
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
if exists('g:syntastic_cpp_check_header')
let makeprg = 'g++ -c '.shellescape(expand('%')).
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
else
return []
endif
endif
if !exists('b:syntastic_cpp_cflags')
if !exists('g:syntastic_cpp_no_include_search') ||
\ g:syntastic_cpp_no_include_search != 1
@@ -85,7 +101,18 @@ function! SyntaxCheckers_cpp_GetLocList()
let makeprg .= b:syntastic_cpp_cflags
endif
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_cpp_remove_include_errors') &&
\ g:syntastic_cpp_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction
let &cpo = s:save_cpo

View File

@@ -23,9 +23,6 @@ endfunction
function! SyntaxCheckers_javascript_GetLocList()
let makeprg = "jslint " . g:syntastic_javascript_jslint_conf . " " . shellescape(expand('%'))
let errorformat='%E %##%n %m,%-Z%.%#Line %l\, Pos %c,%-G%.%#'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} })
call SyntasticHighlightErrors(errors, function('SyntaxCheckers_javascript_HighlightTerm'))
return errors
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} })
endfunction

View File

@@ -20,7 +20,7 @@ if !executable('luac')
finish
endif
function! SyntaxCheckers_lua_Term(pos)
function! SyntaxCheckers_lua_GetHighlightRegex(pos)
let near = matchstr(a:pos['text'], "near '[^']\\+'")
let result = ''
if len(near) > 0
@@ -47,12 +47,9 @@ function! SyntaxCheckers_lua_GetLocList()
let makeprg = 'luac -p ' . shellescape(expand('%'))
let errorformat = 'luac: %#%f:%l: %m'
let loclist = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } })
return SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } })
call SyntasticHighlightErrors(loclist, function("SyntaxCheckers_lua_Term"))
return loclist
endfunction

View File

@@ -0,0 +1,32 @@
"============================================================================
"File: nasm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Håvard Pettersson <haavard.pettersson 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("loaded_nasm_syntax_checker")
finish
endif
let loaded_nasm_syntax_checker = 1
"bail if the user doesnt have nasm installed
if !executable("nasm")
finish
endif
function! SyntaxCheckers_nasm_GetLocList()
if has("win32")
let outfile="NUL"
else
let outfile="/dev/null"
endif
let wd = shellescape(expand("%:p:h") . "/")
let makeprg = "nasm -X gnu -f elf -I " . wd . " -o " . outfile . " " . shellescape(expand("%"))
let errorformat = '%f:%l: %t%*[^:]: %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -28,9 +28,11 @@ if !exists("g:syntastic_phpcs_disable")
let g:syntastic_phpcs_disable = 0
endif
function! SyntaxCheckers_php_Term(item)
function! SyntaxCheckers_php_GetHighlightRegex(item)
let unexpected = matchstr(a:item['text'], "unexpected '[^']\\+'")
if len(unexpected) < 1 | return '' | end
if len(unexpected) < 1
return ''
endif
return '\V'.split(unexpected, "'")[1]
endfunction
@@ -38,7 +40,7 @@ function! SyntaxCheckers_php_GetLocList()
let errors = []
let makeprg = "php -l ".shellescape(expand('%'))
let makeprg = "php -l -d error_reporting=E_PARSE -d display_errors=0 -d error_log='' ".shellescape(expand('%'))
let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
@@ -46,8 +48,6 @@ function! SyntaxCheckers_php_GetLocList()
let errors = errors + s:GetPHPCSErrors()
endif
call SyntasticHighlightErrors(errors, function('SyntaxCheckers_php_Term'))
return errors
endfunction

View File

@@ -6,75 +6,22 @@
" kstep <me@kstep.me>
" Parantapa Bhattacharya <parantapa@gmail.com>
"
"============================================================================
"
" For forcing the use of flake8, pyflakes, or pylint set
"
" let g:syntastic_python_checker = 'pyflakes'
"
" in your .vimrc. Default is flake8.
"============================================================================
if exists("loaded_python_syntax_checker")
finish
endif
let loaded_python_syntax_checker = 1
"bail if the user doesnt have his favorite checker or flake8 or pyflakes installed
if !exists('g:syntastic_python_checker') || !executable(g:syntastic_python_checker)
if executable("flake8")
let g:syntastic_python_checker = 'flake8'
elseif executable("pyflakes")
let g:syntastic_python_checker = 'pyflakes'
elseif executable("pylint")
let g:syntastic_python_checker = 'pylint'
else
finish
endif
endif
if !exists('g:syntastic_python_checker_args')
let g:syntastic_python_checker_args = ''
endif
function! SyntaxCheckers_python_Term(i)
if a:i['type'] ==# 'E'
let a:i['text'] = "Syntax error"
endif
if match(a:i['text'], 'is assigned to but never used') > -1
\ || match(a:i['text'], 'imported but unused') > -1
\ || match(a:i['text'], 'undefined name') > -1
\ || match(a:i['text'], 'redefinition of') > -1
\ || match(a:i['text'], 'referenced before assignment') > -1
\ || match(a:i['text'], 'duplicate argument') > -1
\ || match(a:i['text'], 'after other statements') > -1
\ || match(a:i['text'], 'shadowed by loop variable') > -1
let term = split(a:i['text'], "'", 1)[1]
return '\V\<'.term.'\>'
endif
return ''
endfunction
if g:syntastic_python_checker == 'pylint'
function! SyntaxCheckers_python_GetLocList()
let makeprg = 'pylint -f parseable -r n -i y ' .
\ shellescape(expand('%')) .
\ ' \| sed ''s_: \[[RC]_: \[W_''' .
\ ' \| sed ''s_: \[[F]_:\ \[E_'''
let errorformat = '%f:%l: [%t%n] %m,%-GNo config%m'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
return errors
endfunction
else
function! SyntaxCheckers_python_GetLocList()
let makeprg = g:syntastic_python_checker.' '.g:syntastic_python_checker_args.' '.shellescape(expand('%'))
let errorformat =
\ '%E%f:%l: could not compile,%-Z%p^,%W%f:%l:%c: %m,%W%f:%l: %m,%-G%.%#'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
call SyntasticHighlightErrors(errors, function('SyntaxCheckers_python_Term'))
return errors
endfunction
endif
let s:supported_checkers = ["flake8", "pyflakes", "pylint"]
call SyntasticLoadChecker(s:supported_checkers)

View File

@@ -0,0 +1,31 @@
"============================================================================
"File: flake8.vim
"Description: Syntax checking plugin for syntastic.vim
"Authors: Sylvain Soliman <Sylvain dot Soliman+git at gmail dot com>
" kstep <me@kstep.me>
"
"============================================================================
function! SyntaxCheckers_python_GetHighlightRegex(i)
if a:i['type'] ==# 'E'
let a:i['text'] = "Syntax error"
endif
if match(a:i['text'], 'is assigned to but never used') > -1
\ || match(a:i['text'], 'imported but unused') > -1
\ || match(a:i['text'], 'undefined name') > -1
\ || match(a:i['text'], 'redefinition of') > -1
\ || match(a:i['text'], 'referenced before assignment') > -1
\ || match(a:i['text'], 'duplicate argument') > -1
\ || match(a:i['text'], 'after other statements') > -1
\ || match(a:i['text'], 'shadowed by loop variable') > -1
let term = split(a:i['text'], "'", 1)[1]
return '\V\<'.term.'\>'
endif
return ''
endfunction
function! SyntaxCheckers_python_GetLocList()
let makeprg = 'flake8 '.g:syntastic_python_checker_args.' '.shellescape(expand('%'))
let errorformat = '%E%f:%l: could not compile,%-Z%p^,%W%f:%l:%c: %m,%W%f:%l: %m,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,34 @@
"============================================================================
"File: pyflakes.vim
"Description: Syntax checking plugin for syntastic.vim
"Authors: Martin Grenfell <martin.grenfell@gmail.com>
" kstep <me@kstep.me>
" Parantapa Bhattacharya <parantapa@gmail.com>
"
"============================================================================
function! SyntaxCheckers_python_GetHighlightRegex(i)
if match(a:i['text'], 'is assigned to but never used') > -1
\ || match(a:i['text'], 'imported but unused') > -1
\ || match(a:i['text'], 'undefined name') > -1
\ || match(a:i['text'], 'redefinition of') > -1
\ || match(a:i['text'], 'referenced before assignment') > -1
\ || match(a:i['text'], 'duplicate argument') > -1
\ || match(a:i['text'], 'after other statements') > -1
\ || match(a:i['text'], 'shadowed by loop variable') > -1
let term = split(a:i['text'], "'", 1)[1]
return '\V\<'.term.'\>'
endif
return ''
endfunction
function! SyntaxCheckers_python_GetLocList()
let makeprg = 'pyflakes '.g:syntastic_python_checker_args.' '.shellescape(expand('%'))
let errorformat = '%E%f:%l: could not compile,%-Z%p^,%E%f:%l:%c: %m,%E%f:%l: %m,%-G%.%#'
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'text': "Syntax error"} })
return errors
endfunction

View File

@@ -0,0 +1,14 @@
"============================================================================
"File: pylint.vim
"Description: Syntax checking plugin for syntastic.vim
"Author: Parantapa Bhattacharya <parantapa at gmail dot com>
"
"============================================================================
function! SyntaxCheckers_python_GetLocList()
let makeprg = 'pylint -f parseable -r n -i y ' .
\ shellescape(expand('%')) .
\ ' \| sed ''s_: \[[RC]_: \[W_''' .
\ ' \| sed ''s_: \[[F]_:\ \[E_'''
let errorformat = '%f:%l: [%t%n%.%#] %m,%-GNo config%m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -24,7 +24,7 @@ if !executable("rst2pseudoxml.py")
endif
function! SyntaxCheckers_rst_GetLocList()
let makeprg = 'rst2pseudoxml.py --report=1 --exit-status=1 ' .
let makeprg = 'rst2pseudoxml.py --report=2 --exit-status=1 ' .
\ shellescape(expand('%')) . ' /dev/null'
let errorformat = '%f:%l:\ (%tNFO/1)\ %m,

View File

@@ -8,6 +8,10 @@
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"Supports MRI and JRuby but loads the MRI syntax checker by default.
"
"Use the g:syntastic_ruby_checker option to specify which checker to load -
"set it to "jruby" to load the jruby checker.
"============================================================================
if exists("loaded_ruby_syntax_checker")
finish
@@ -19,14 +23,8 @@ if !executable("ruby")
finish
endif
function! SyntaxCheckers_ruby_GetLocList()
" we cannot set RUBYOPT on windows like that
if has('win32') || has('win64')
let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%'))
else
let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%'))
endif
let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
if !exists("g:syntastic_ruby_checker")
let g:syntastic_ruby_checker = "mri"
endif
exec "runtime! syntax_checkers/ruby/" . g:syntastic_ruby_checker . ".vim"
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,16 @@
"============================================================================
"File: jruby.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Leonid Shevtsov <leonid at shevtsov dot 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.
"
"============================================================================
function! SyntaxCheckers_ruby_GetLocList()
"let makeprg = ''
"let errorformat = ''
"return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,22 @@
"============================================================================
"File: mri.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell 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.
"
"============================================================================
function! SyntaxCheckers_ruby_GetLocList()
" we cannot set RUBYOPT on windows like that
if has('win32') || has('win64')
let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%'))
else
let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%'))
endif
let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,33 @@
"============================================================================
"File: scala.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Rickey Visinski <rickeyvisinski 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("loaded_scala_syntax_checker")
finish
endif
let loaded_scala_syntax_checker = 1
"bail if the user doesnt have the scala binary installed
if !executable("scala")
finish
endif
if !exists("g:syntastic_scala_options")
let g:syntastic_scala_options = " "
endif
function! SyntaxCheckers_scala_GetLocList()
let makeprg = 'scala '. g:syntastic_scala_options .' '. shellescape(expand('%')) . ' /dev/null'
let errorformat = '%f\:%l: %trror: %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -32,7 +32,7 @@ if exists('g:syntastic_vala_check_disabled') && g:syntastic_vala_check_disabled
finish
endif
function! SyntaxCheckers_vala_Term(pos)
function! SyntaxCheckers_vala_GetHighlightRegex(pos)
let strlength = strlen(matchstr(a:pos['text'], '\^\+$'))
return '\%>'.(a:pos.col-1).'c.*\%<'.(a:pos.col+strlength+1).'c'
endfunction
@@ -49,8 +49,8 @@ function! SyntaxCheckers_vala_GetLocList()
let makeprg = 'valac -C ' . vala_pkg_args . ' ' .shellescape(expand('%'))
let errorformat = '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,%C%m,%Z%m'
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
call SyntasticHighlightErrors(loclist, function("SyntaxCheckers_vala_Term"), 1)
return loclist
return SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'force_highlight_callback': 1} })
endfunction

View File

@@ -0,0 +1,31 @@
"============================================================================
"File: z80.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Romain Giot <giot.romain 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("loaded_z80_syntax_checker")
finish
endif
let loaded_z80_syntax_checker = 1
"bail if the user doesnt have z80_syntax_checker.py installed
"To obtain this application there are two solutions:
" - Install this python package: https://github.com/rgiot/pycpcdemotools
" - Copy/paste this script in your search path: https://raw.github.com/rgiot/pycpcdemotools/master/cpcdemotools/source_checker/z80_syntax_checker.py
if !executable("z80_syntax_checker.py")
finish
endif
function! SyntaxCheckers_z80_GetLocList()
let makeprg = 'z80_syntax_checker.py '.shellescape(expand('%'))
let errorformat = '%f:%l %m'
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
return loclist
endfunction