From dbaad0ecf9b13220896beeb1beb25591324fe190 Mon Sep 17 00:00:00 2001 From: Jason Graham Date: Thu, 9 Jun 2011 18:08:24 -0700 Subject: [PATCH 01/12] Add syntax checker for matlab/octave files Requires mlint, distributed with matlab --- syntax_checkers/matlab.vim | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 syntax_checkers/matlab.vim diff --git a/syntax_checkers/matlab.vim b/syntax_checkers/matlab.vim new file mode 100644 index 00000000..bbd39215 --- /dev/null +++ b/syntax_checkers/matlab.vim @@ -0,0 +1,34 @@ +"============================================================================ +"File: matlab.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Jason Graham +"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_matlab_syntax_checker") + finish +endif +let loaded_matlab_syntax_checker = 1 + +"bail if the user doesn't have mlint installed +if !executable("mlint") + finish +endif + +function! SyntaxCheckers_matlab_GetLocList() + let makeprg = 'mlint -id $* '.shellescape(expand('%')) + let errorformat = 'L %l (C %c): %*[a-zA-Z0-9]: %m,L %l (C %c-%*[0-9]): %*[a-zA-Z0-9]: %m' + let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + for i in loclist + let i['bufnr'] = bufnr("") + endfor + + return loclist +endfunction + From 8074c94ca440dcb1fdd3eb1d4d10c1bb695416a7 Mon Sep 17 00:00:00 2001 From: Hannes Schulz Date: Fri, 10 Jun 2011 11:16:42 +0200 Subject: [PATCH 02/12] added syntax-checker for NVIDIA CUDA .cu/.cuh files --- syntax_checkers/cuda.vim | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 syntax_checkers/cuda.vim diff --git a/syntax_checkers/cuda.vim b/syntax_checkers/cuda.vim new file mode 100644 index 00000000..953d979f --- /dev/null +++ b/syntax_checkers/cuda.vim @@ -0,0 +1,38 @@ +"============================================================================ +"File: cuda.vim +"Description: Syntax checking plugin for syntastic.vim +" +"============================================================================ + +" in order to also check header files add this to your .vimrc: +" (this creates an empty .syntastic_dummy.cu file in your source directory) +" +" let g:syntastic_cuda_check_header = 1 + +if exists('loaded_cuda_syntax_checker') + finish +endif +let loaded_cuda_syntax_checker = 1 + +if !exists('g:syntastic_nvcc_binary') + let g:syntastic_nvcc_binary = '/usr/local/cuda/bin/nvcc' +endif +if !executable('/usr/local/cuda/bin/nvcc') + finish +endif + +function! SyntaxCheckers_cuda_GetLocList() + let makeprg = g:syntastic_nvcc_binary.' --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null' + "let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m' + let errorformat = '%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f'',%X%*\a[%*\d]: Leaving directory `%f'',%D%*\a: Entering directory `%f'',%X%*\a: Leaving directory `%f'',%DMaking %*\a in %f,%f|%l| %m' + + if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$' + if exists('g:syntastic_cuda_check_header') + let makeprg = 'echo > .syntastic_dummy.cu ; '.g:syntastic_nvcc_binary.' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null' + else + return [] + endif + endif + + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction From b86026cdc078c2fd487f08cf1e74daac8f9c372f Mon Sep 17 00:00:00 2001 From: David Lee Date: Tue, 10 May 2011 23:34:17 -0700 Subject: [PATCH 03/12] Cache g:syntastic_sass_imports on first use --- syntax_checkers/sass.vim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/sass.vim b/syntax_checkers/sass.vim index 0e93c3eb..4eb128b3 100644 --- a/syntax_checkers/sass.vim +++ b/syntax_checkers/sass.vim @@ -19,13 +19,16 @@ if !executable("sass") finish endif -"use compass imports if available -let g:syntastic_sass_imports = "" -if executable("compass") - let g:syntastic_sass_imports = system("compass imports") -endif +let g:syntastic_sass_imports = 0 function! SyntaxCheckers_sass_GetLocList() + "use compass imports if available + if g:syntastic_sass_imports == 0 && executable("compass") + let g:syntastic_sass_imports = system("compass imports") + else + let g:syntastic_sass_imports = "" + endif + let makeprg='sass '.g:syntastic_sass_imports.' --check '.shellescape(expand('%')) let errorformat = '%ESyntax %trror:%m,%C on line %l of %f,%Z%m' let errorformat .= ',%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m' From d9ba6d79632a1614aef48dc40e251e58691b1eb5 Mon Sep 17 00:00:00 2001 From: Brandon Waskiewicz Date: Fri, 8 Apr 2011 20:57:37 +0200 Subject: [PATCH 04/12] [PATCH] Tweaked c syntax checker errorformat Added a more specific c syntax checker errorformat before the more general ones so the jumping is not broken by assuming the line number is a part of the file. Signed-off-by: kongo2002 --- syntax_checkers/c.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax_checkers/c.vim b/syntax_checkers/c.vim index 4223a322..f6e2e07a 100644 --- a/syntax_checkers/c.vim +++ b/syntax_checkers/c.vim @@ -84,9 +84,9 @@ endfunction function! SyntaxCheckers_c_GetLocList() let makeprg = 'gcc -fsyntax-only '.shellescape(expand('%')).' -I. -I..' 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: %trror: %m,%f:%l: %m' + \ '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' if expand('%') =~? '.h$' if exists('g:syntastic_c_check_header') From be71a0872b4832dd682031b8fdb4fd39abc585ae Mon Sep 17 00:00:00 2001 From: Hannes Schulz Date: Mon, 20 Jun 2011 08:04:04 +0200 Subject: [PATCH 05/12] cuda.vim: added author note --- syntax_checkers/cuda.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syntax_checkers/cuda.vim b/syntax_checkers/cuda.vim index 953d979f..02666543 100644 --- a/syntax_checkers/cuda.vim +++ b/syntax_checkers/cuda.vim @@ -2,6 +2,8 @@ "File: cuda.vim "Description: Syntax checking plugin for syntastic.vim " +"Author: Hannes Schulz +" "============================================================================ " in order to also check header files add this to your .vimrc: From df643397fc38ebede49ecc3b23a4e0538d7746b4 Mon Sep 17 00:00:00 2001 From: Ory Band Date: Thu, 23 Jun 2011 19:19:16 +0300 Subject: [PATCH 06/12] Add CSS syntax checking support using CSS Lint (http://csslint.net). --- syntax_checkers/css.vim | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 syntax_checkers/css.vim diff --git a/syntax_checkers/css.vim b/syntax_checkers/css.vim new file mode 100644 index 00000000..d315d86c --- /dev/null +++ b/syntax_checkers/css.vim @@ -0,0 +1,28 @@ +"============================================================================ +"File: css.vim +"Description: Syntax checking plugin for syntastic.vim using `csslint` CLI tool (http://csslint.net). +"Maintainer: Ory Band +"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_css_syntax_checker") + finish +endif +let loaded_css_syntax_checker = 1 + +" Bail if the user doesn't have `csslint` installed. +if !executable("csslint") + finish +endif + +function! SyntaxCheckers_css_GetLocList() + let makeprg = 'csslint '.shellescape(expand('%')) + + " Print CSS Lint's 'Welcome' and error messages. Ignores the code line. + let errorformat = '%+Gcsslint:\ There%.%#,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line %l\,\ col\ %c,%Z%m,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line %l\,\ col\ %c,%C%m,%-Z%.%#,%-G%.%#' + + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction From 4e142bbdff946a7d03421d7db04011e01297c897 Mon Sep 17 00:00:00 2001 From: Ory Band Date: Fri, 24 Jun 2011 15:33:02 +0300 Subject: [PATCH 07/12] Removed a duplicate errorformat line from css.vim syntax checker. --- syntax_checkers/css.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/css.vim b/syntax_checkers/css.vim index d315d86c..ac30302b 100644 --- a/syntax_checkers/css.vim +++ b/syntax_checkers/css.vim @@ -22,7 +22,7 @@ function! SyntaxCheckers_css_GetLocList() let makeprg = 'csslint '.shellescape(expand('%')) " Print CSS Lint's 'Welcome' and error messages. Ignores the code line. - let errorformat = '%+Gcsslint:\ There%.%#,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line %l\,\ col\ %c,%Z%m,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line %l\,\ col\ %c,%C%m,%-Z%.%#,%-G%.%#' + let errorformat = '%+Gcsslint:\ There%.%#,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line %l\,\ col\ %c,%Z%m,%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction From 32189bc06d09913646485219ad0a0349966956dd Mon Sep 17 00:00:00 2001 From: Ory Band Date: Fri, 24 Jun 2011 15:50:01 +0300 Subject: [PATCH 08/12] css.vim now ignores line/col strings in error description (inconsistency in CSS Lint) --- syntax_checkers/css.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/css.vim b/syntax_checkers/css.vim index ac30302b..717680ad 100644 --- a/syntax_checkers/css.vim +++ b/syntax_checkers/css.vim @@ -21,8 +21,8 @@ endif function! SyntaxCheckers_css_GetLocList() let makeprg = 'csslint '.shellescape(expand('%')) - " Print CSS Lint's 'Welcome' and error messages. Ignores the code line. - let errorformat = '%+Gcsslint:\ There%.%#,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line %l\,\ col\ %c,%Z%m,%-G%.%#' + " Print CSS Lint's 'Welcome' and error/warning messages. Ignores the code line. + let errorformat = '%+Gcsslint:\ There%.%#,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line %l\,\ col\ %c,%Z%m\ at\ line%.%#,%A%>%f:,%C%n:\ %t%\\w%\\+\ at\ line %l\,\ col\ %c,%Z%m,%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction From 5670bdd39f4b6a3b0da86d24e0fd6b3189ab9134 Mon Sep 17 00:00:00 2001 From: Ory Band Date: Fri, 24 Jun 2011 15:57:55 +0300 Subject: [PATCH 09/12] Added some spaces in pattern for css.vim. --- syntax_checkers/css.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/css.vim b/syntax_checkers/css.vim index 717680ad..46d3bfc8 100644 --- a/syntax_checkers/css.vim +++ b/syntax_checkers/css.vim @@ -22,7 +22,7 @@ function! SyntaxCheckers_css_GetLocList() let makeprg = 'csslint '.shellescape(expand('%')) " Print CSS Lint's 'Welcome' and error/warning messages. Ignores the code line. - let errorformat = '%+Gcsslint:\ There%.%#,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line %l\,\ col\ %c,%Z%m\ at\ line%.%#,%A%>%f:,%C%n:\ %t%\\w%\\+\ at\ line %l\,\ col\ %c,%Z%m,%-G%.%#' + let errorformat = '%+Gcsslint:\ There%.%#,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line\ %l\,\ col\ %c,%Z%m\ at\ line%.%#,%A%>%f:,%C%n:\ %t%\\w%\\+\ at\ line\ %l\,\ col\ %c,%Z%m,%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction From fd5765fcc9e1dcf1b32d43a1f6cd8475cfff98a4 Mon Sep 17 00:00:00 2001 From: Ory Band Date: Fri, 24 Jun 2011 16:13:48 +0300 Subject: [PATCH 10/12] Removed a single space char. Shouldn't be there. --- syntax_checkers/css.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/css.vim b/syntax_checkers/css.vim index 46d3bfc8..76067133 100644 --- a/syntax_checkers/css.vim +++ b/syntax_checkers/css.vim @@ -22,7 +22,7 @@ function! SyntaxCheckers_css_GetLocList() let makeprg = 'csslint '.shellescape(expand('%')) " Print CSS Lint's 'Welcome' and error/warning messages. Ignores the code line. - let errorformat = '%+Gcsslint:\ There%.%#,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line\ %l\,\ col\ %c,%Z%m\ at\ line%.%#,%A%>%f:,%C%n:\ %t%\\w%\\+\ at\ line\ %l\,\ col\ %c,%Z%m,%-G%.%#' + let errorformat = '%+Gcsslint:\ There%.%#,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line\ %l\,\ col\ %c,%Z%m\ at\ line%.%#,%A%>%f:,%C%n:\ %t%\\w%\\+\ at\ line\ %l\,\ col\ %c,%Z%m,%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction From e06feca206fbcde2699025e5e5ce319b3517b652 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Tue, 28 Jun 2011 17:24:48 +1200 Subject: [PATCH 11/12] css checker: fix the buf num in the returned location list csslint only outputs the tail of the filename of the css file you are editing so the errors weren't getting associated with the buffer. --- syntax_checkers/css.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/css.vim b/syntax_checkers/css.vim index 76067133..52f92b35 100644 --- a/syntax_checkers/css.vim +++ b/syntax_checkers/css.vim @@ -24,5 +24,11 @@ function! SyntaxCheckers_css_GetLocList() " Print CSS Lint's 'Welcome' and error/warning messages. Ignores the code line. let errorformat = '%+Gcsslint:\ There%.%#,%A%f:,%C%n:\ %t%\\w%\\+\ at\ line\ %l\,\ col\ %c,%Z%m\ at\ line%.%#,%A%>%f:,%C%n:\ %t%\\w%\\+\ at\ line\ %l\,\ col\ %c,%Z%m,%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + for i in loclist + let i['bufnr'] = bufnr("") + endfor + + return loclist endfunction From e4ec40479acd8f37814d7d13fe42c9f07a4ef164 Mon Sep 17 00:00:00 2001 From: Tom Wieland Date: Wed, 29 Jun 2011 16:30:58 -0700 Subject: [PATCH 12/12] coffee -o doesn't take /dev/null, only directories. --- syntax_checkers/coffee.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/coffee.vim b/syntax_checkers/coffee.vim index 71473d7d..05c8ff22 100644 --- a/syntax_checkers/coffee.vim +++ b/syntax_checkers/coffee.vim @@ -14,13 +14,13 @@ if exists("loaded_coffee_syntax_checker") endif let loaded_coffee_syntax_checker = 1 -"bail if the user doesnt have ruby installed +"bail if the user doesnt have coffee installed if !executable("coffee") finish endif function! SyntaxCheckers_coffee_GetLocList() - let makeprg = 'coffee -c -l -o /dev/null %' + let makeprg = 'coffee -c -l -o /tmp %' let errorformat = '%EError: In %f\, Parse error on line %l: %m,%EError: In %f\, %m on line %l,%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 })