From d2d8bb926dbb6ddad174f82b63051c0e347e59c7 Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Sat, 22 Sep 2012 20:00:12 +0100 Subject: [PATCH] slim: errorformat includes column if slimrb --version > 1.3.0 --- syntax_checkers/slim.vim | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/slim.vim b/syntax_checkers/slim.vim index ba1d547a..531a2273 100644 --- a/syntax_checkers/slim.vim +++ b/syntax_checkers/slim.vim @@ -19,8 +19,23 @@ if !executable("slimrb") finish endif +function! s:SlimrbVersion() + if !exists('s:slimrb_version') + let output = system("slimrb --version 2>/dev/null") + let output = substitute(output, '\n$', '', '') + let output = substitute(output, '^slim ', '', 'i') + let s:slimrb_version = split(output, '\.') + end + return s:slimrb_version +endfunction + function! SyntaxCheckers_slim_GetLocList() let makeprg = "slimrb -c " . shellescape(expand("%")) - let errorformat = '%C\ %#%f\, Line %l,%-G\ %.%#,%ESlim::Parser::SyntaxError: %m,%+C%.%#' + if SyntasticIsVersionAtLeast(s:SlimrbVersion(), [1,3,1]) + let errorformat = '%C\ %#%f\, Line %l\, Column %c,%-G\ %.%#,%ESlim::Parser::SyntaxError: %m,%+C%.%#' + else + let errorformat = '%C\ %#%f\, Line %l,%-G\ %.%#,%ESlim::Parser::SyntaxError: %m,%+C%.%#' + endif + echo errorformat return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction