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

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