From 97d6937dd46a2ce3d4acff2f443117dd20b030c8 Mon Sep 17 00:00:00 2001 From: marty Date: Fri, 10 Sep 2010 21:20:04 +1200 Subject: [PATCH 1/8] only sign errors for the current buffer --- plugin/syntastic.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index c280c484..92d0c47d 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -111,6 +111,10 @@ let s:next_sign_id = s:first_sign_id function s:SignErrors() if s:BufHasErrorsOrWarningsToDisplay() for i in b:syntastic_loclist + if i['bufnr'] != bufnr("") + continue + endif + let sign_type = 'SyntasticError' if i['type'] == 'W' let sign_type = 'SyntasticWarning' From 2679a8ce6a7ded8d658a07e6149ed68a8ce4ef5e Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Thu, 23 Sep 2010 21:48:31 +0200 Subject: [PATCH 2/8] fix php errorformat --- syntax_checkers/php.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/php.vim b/syntax_checkers/php.vim index 81e060b4..7dd0cd7e 100644 --- a/syntax_checkers/php.vim +++ b/syntax_checkers/php.vim @@ -21,6 +21,6 @@ endif function! SyntaxCheckers_php_GetLocList() let makeprg = "php -l %" - 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%#' + 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' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction From c61890f1b767fae5b43d32bfee7b9ba01cbe2493 Mon Sep 17 00:00:00 2001 From: Jeremy Cantrell Date: Fri, 24 Sep 2010 10:36:53 +0800 Subject: [PATCH 3/8] Properly escape % for makeprg --- syntax_checkers/c.vim | 4 ++-- syntax_checkers/cpp.vim | 4 ++-- syntax_checkers/cucumber.vim | 2 +- syntax_checkers/eruby.vim | 2 +- syntax_checkers/haskell.vim | 2 +- syntax_checkers/html.vim | 2 +- syntax_checkers/javascript.vim | 2 +- syntax_checkers/perl.vim | 2 +- syntax_checkers/php.vim | 2 +- syntax_checkers/python.vim | 2 +- syntax_checkers/ruby.vim | 2 +- syntax_checkers/sass.vim | 2 +- syntax_checkers/tex.vim | 2 +- syntax_checkers/xhtml.vim | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/syntax_checkers/c.vim b/syntax_checkers/c.vim index 85388fbe..4a7ef873 100644 --- a/syntax_checkers/c.vim +++ b/syntax_checkers/c.vim @@ -80,12 +80,12 @@ function! s:Init() endfunction function! SyntaxCheckers_c_GetLocList() - let makeprg = 'gcc -fsyntax-only %' + let makeprg = 'gcc -fsyntax-only '.shellescape(expand('%')) let errorformat = '%-G%f:%s:,%f:%l: %m' if expand('%') =~? '.h$' if exists('g:syntastic_c_check_header') - let makeprg = 'gcc -c %' + let makeprg = 'gcc -c '.shellescape(expand('%')) else return [] endif diff --git a/syntax_checkers/cpp.vim b/syntax_checkers/cpp.vim index 04c39071..aa7f8587 100644 --- a/syntax_checkers/cpp.vim +++ b/syntax_checkers/cpp.vim @@ -25,12 +25,12 @@ if !executable('g++') endif function! SyntaxCheckers_cpp_GetLocList() - let makeprg = 'g++ -fsyntax-only %' + let makeprg = 'g++ -fsyntax-only '.shellescape(expand('%')) let errorformat = '%-G%f:%s:,%f:%l: %m' if expand('%') =~? '\%(.h\|.hpp\|.hh\)$' if exists('g:syntastic_cpp_check_header') - let makeprg = 'g++ -c %' + let makeprg = 'g++ -c '.shellescape(expand('%')) else return [] endif diff --git a/syntax_checkers/cucumber.vim b/syntax_checkers/cucumber.vim index 813858e7..c9a87e15 100644 --- a/syntax_checkers/cucumber.vim +++ b/syntax_checkers/cucumber.vim @@ -20,7 +20,7 @@ if !executable("cucumber") endif function! SyntaxCheckers_cucumber_GetLocList() - let makeprg = 'cucumber --dry-run --quiet --strict --format pretty %' + let makeprg = 'cucumber --dry-run --quiet --strict --format pretty '.shellescape(expand('%')) let errorformat = '%f:%l:%c:%m,%W %.%# (%m),%-Z%f:%l:%.%#,%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) diff --git a/syntax_checkers/eruby.vim b/syntax_checkers/eruby.vim index 7145d9ff..af07270b 100644 --- a/syntax_checkers/eruby.vim +++ b/syntax_checkers/eruby.vim @@ -20,7 +20,7 @@ if !executable("ruby") || !executable("cat") endif function! SyntaxCheckers_eruby_GetLocList() - let makeprg='cat '. expand("%") . ' \| RUBYOPT= ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| RUBYOPT= ruby -c' + let makeprg='cat '. shellescape(expand("%")) . ' \| RUBYOPT= ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| RUBYOPT= ruby -c' let errorformat='%-GSyntax OK,%E-:%l: syntax error\, %m,%Z%p^,%W-:%l: warning: %m,%Z%p^,%-C%.%#' let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) diff --git a/syntax_checkers/haskell.vim b/syntax_checkers/haskell.vim index 339be871..c5bc397a 100644 --- a/syntax_checkers/haskell.vim +++ b/syntax_checkers/haskell.vim @@ -22,7 +22,7 @@ endif " As this calls ghc, it can take a few seconds... maybe hlint or something " could do a good enough job? function! SyntaxCheckers_haskell_GetLocList() - let makeprg = 'ghc % -e :q' + let makeprg = 'ghc '.shellescape(expand('%')).' -e :q' let errorformat = '%-G\\s%#,%f:%l:%c:%m,%E%f:%l:%c:,%Z%m,' diff --git a/syntax_checkers/html.vim b/syntax_checkers/html.vim index 8f98da6d..e9d66742 100644 --- a/syntax_checkers/html.vim +++ b/syntax_checkers/html.vim @@ -23,7 +23,7 @@ function! SyntaxCheckers_html_GetLocList() "grep out the ' lacks "summary" attribute' since it is almost "always present and almost always useless - let makeprg="tidy -e % 2>&1 \\| grep -v '\ lacks \"summary\" attribute'" + let makeprg="tidy -e "..shellescape(expand('%'))." 2>&1 \\| grep -v '\ lacks \"summary\" attribute'" let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#' let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) diff --git a/syntax_checkers/javascript.vim b/syntax_checkers/javascript.vim index 0f3cc3b8..e3477585 100644 --- a/syntax_checkers/javascript.vim +++ b/syntax_checkers/javascript.vim @@ -20,7 +20,7 @@ if !executable("jsl") endif function! SyntaxCheckers_javascript_GetLocList() - let makeprg = "jsl -nologo -nofilelisting -nosummary -nocontext -process %" + let makeprg = "jsl -nologo -nofilelisting -nosummary -nocontext -process ".shellescape(expand('%')) let errorformat='%W%f(%l): lint warning: %m,%-Z%p^,%W%f(%l): warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction diff --git a/syntax_checkers/perl.vim b/syntax_checkers/perl.vim index fb70b078..d79c6061 100644 --- a/syntax_checkers/perl.vim +++ b/syntax_checkers/perl.vim @@ -24,7 +24,7 @@ if !executable("perl") endif function! SyntaxCheckers_perl_GetLocList() - let makeprg = $VIMRUNTIME.'/tools/efm_perl.pl -c %' + let makeprg = $VIMRUNTIME.'/tools/efm_perl.pl -c '.shellescape(expand('%')) let errorformat = '%f:%l:%m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) diff --git a/syntax_checkers/php.vim b/syntax_checkers/php.vim index 7dd0cd7e..33a339cd 100644 --- a/syntax_checkers/php.vim +++ b/syntax_checkers/php.vim @@ -20,7 +20,7 @@ if !executable("php") endif function! SyntaxCheckers_php_GetLocList() - let makeprg = "php -l %" + let makeprg = "php -l ".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' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction diff --git a/syntax_checkers/python.vim b/syntax_checkers/python.vim index e95c5321..10abe7f1 100644 --- a/syntax_checkers/python.vim +++ b/syntax_checkers/python.vim @@ -9,7 +9,7 @@ if !executable("pyflakes") endif function! SyntaxCheckers_python_GetLocList() - let makeprg = 'pyflakes %' + let makeprg = 'pyflakes '.shellescape(expand('%')) let errorformat = '%E%f:%l: could not compile,%-Z%p^,%W%f:%l: %m,%-G%.%#' let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) diff --git a/syntax_checkers/ruby.vim b/syntax_checkers/ruby.vim index a4dfce88..b15decab 100644 --- a/syntax_checkers/ruby.vim +++ b/syntax_checkers/ruby.vim @@ -20,7 +20,7 @@ if !executable("ruby") endif function! SyntaxCheckers_ruby_GetLocList() - let makeprg = 'RUBYOPT= ruby -W1 -c %' + let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%')) let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%-C%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) diff --git a/syntax_checkers/sass.vim b/syntax_checkers/sass.vim index 235f18f6..2bfa1ab4 100644 --- a/syntax_checkers/sass.vim +++ b/syntax_checkers/sass.vim @@ -20,7 +20,7 @@ if !executable("sass") endif function! SyntaxCheckers_sass_GetLocList() - let makeprg='sass --check %' + let makeprg='sass --check '.shellescape(expand('%')) let errorformat = '%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m' let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) diff --git a/syntax_checkers/tex.vim b/syntax_checkers/tex.vim index cd264713..7d7f019c 100644 --- a/syntax_checkers/tex.vim +++ b/syntax_checkers/tex.vim @@ -20,7 +20,7 @@ if !executable("lacheck") endif function! SyntaxCheckers_tex_GetLocList() - let makeprg = 'lacheck %' + let makeprg = 'lacheck '.shellescape(expand('%')) let errorformat = '%E"%f"\, line %l: %m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction diff --git a/syntax_checkers/xhtml.vim b/syntax_checkers/xhtml.vim index f1c7bb11..399e035c 100644 --- a/syntax_checkers/xhtml.vim +++ b/syntax_checkers/xhtml.vim @@ -21,7 +21,7 @@ endif function! SyntaxCheckers_xhtml_GetLocList() - let makeprg="tidy -xml -e %" + let makeprg="tidy -xml -e ".shellescape(expand('%')) let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#' let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) From 53195a4ab454c0070fa769bdc5fda08c92d82462 Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Fri, 24 Sep 2010 22:06:22 +0800 Subject: [PATCH 4/8] add lua syntax checker --- syntax_checkers/lua.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 syntax_checkers/lua.vim diff --git a/syntax_checkers/lua.vim b/syntax_checkers/lua.vim new file mode 100644 index 00000000..357ac5a5 --- /dev/null +++ b/syntax_checkers/lua.vim @@ -0,0 +1,29 @@ +"============================================================================ +"File: lua.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Gregor Uhlenheuer +"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_lua_syntax_checker') + finish +endif +let loaded_lua_syntax_checker = 1 + +" check if the lua compiler is installed +if !executable('luac') + finish +endif + +function! SyntaxCheckers_lua_GetLocList() + let makeprg = 'luac -p ' . shellescape(expand('%')) + let errorformat = 'luac: %#%f:%l: %m' + + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction + From 2e028581f0a11a2087988c065636332c8407c2a1 Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Fri, 24 Sep 2010 22:19:24 +0800 Subject: [PATCH 5/8] add bufnr and error type to lua syntax checker --- syntax_checkers/lua.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/lua.vim b/syntax_checkers/lua.vim index 357ac5a5..63c724ac 100644 --- a/syntax_checkers/lua.vim +++ b/syntax_checkers/lua.vim @@ -24,6 +24,14 @@ function! SyntaxCheckers_lua_GetLocList() let makeprg = 'luac -p ' . shellescape(expand('%')) let errorformat = 'luac: %#%f:%l: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + let bn = bufnr('') + for loc in loclist + let loc['bufnr'] = bn + let loc['type'] = 'E' + endfor + + return loclist endfunction From f822e3a9ca8a1fc207b1314f070603934fe6db54 Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Fri, 24 Sep 2010 22:51:58 +0800 Subject: [PATCH 6/8] fine-tune c errorformat --- syntax_checkers/c.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/c.vim b/syntax_checkers/c.vim index 4a7ef873..c7ffae14 100644 --- a/syntax_checkers/c.vim +++ b/syntax_checkers/c.vim @@ -81,7 +81,9 @@ endfunction function! SyntaxCheckers_c_GetLocList() let makeprg = 'gcc -fsyntax-only '.shellescape(expand('%')) - let errorformat = '%-G%f:%s:,%f:%l: %m' + let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared ' + \ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for ' + \ 'each function it appears%.%#,%f:%l: %trror: %m,%f:%l: %m' if expand('%') =~? '.h$' if exists('g:syntastic_c_check_header') From c94e60fa5f53da20a18f8c9bfc5b55fcc216e5da Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Sat, 25 Sep 2010 00:48:17 +0800 Subject: [PATCH 7/8] fix multi-line expression --- syntax_checkers/c.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/c.vim b/syntax_checkers/c.vim index c7ffae14..1fc2fb28 100644 --- a/syntax_checkers/c.vim +++ b/syntax_checkers/c.vim @@ -81,8 +81,8 @@ endfunction function! SyntaxCheckers_c_GetLocList() let makeprg = 'gcc -fsyntax-only '.shellescape(expand('%')) - let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared ' - \ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for ' + let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '. + \ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '. \ 'each function it appears%.%#,%f:%l: %trror: %m,%f:%l: %m' if expand('%') =~? '.h$' From 4cedcf3ee7b198217958cafd9e44ee1278e49a17 Mon Sep 17 00:00:00 2001 From: Jeremy Cantrell Date: Sun, 26 Sep 2010 02:48:43 +0800 Subject: [PATCH 8/8] Too many '.' --- syntax_checkers/html.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/html.vim b/syntax_checkers/html.vim index e9d66742..f0bd43c9 100644 --- a/syntax_checkers/html.vim +++ b/syntax_checkers/html.vim @@ -23,7 +23,7 @@ function! SyntaxCheckers_html_GetLocList() "grep out the '
lacks "summary" attribute' since it is almost "always present and almost always useless - let makeprg="tidy -e "..shellescape(expand('%'))." 2>&1 \\| grep -v '\ lacks \"summary\" attribute'" + let makeprg="tidy -e ".shellescape(expand('%'))." 2>&1 \\| grep -v '\ lacks \"summary\" attribute'" let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#' let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })