From 4afe702a80968d09f4a5b21a62baab40e8e0d0bf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Tue, 29 May 2012 14:07:09 -0400 Subject: [PATCH] misc: adds customizable options to syntastic Nit syntax checker MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit g:syntastic_nitc specifies custom path to compiler g:syntastic_nit_dir specifies the NIT_DIR env variable g:syntastic_nit_args specifies extra arguments to call nitc g:syntastic_nit_include_dirs lists directories to include, must be a list Signed-off-by: Alexis Laferrière --- misc/syntastic/nit.vim | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/misc/syntastic/nit.vim b/misc/syntastic/nit.vim index b213b1a..7da1985 100644 --- a/misc/syntastic/nit.vim +++ b/misc/syntastic/nit.vim @@ -7,6 +7,11 @@ " 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. +" +" g:syntastic_nitc specifies custom path to compiler +" g:syntastic_nit_dir specifies the NIT_DIR env variable +" g:syntastic_nit_args specifies extra arguments to call nitc +" g:syntastic_nit_include_dirs lists directories to include, must be a list "============================================================================ if exists("loaded_nit_syntax_checker") finish @@ -14,12 +19,40 @@ endif let loaded_nit_syntax_checker = 1 " check if nitc is accessible -if !executable("nitc") +if exists('g:syntastic_nitc') + let s:nitc = g:syntastic_nitc +else + let s:nitc = "nitc" +endif + +if !executable(s:nitc) + if exists('g:syntastic_nitc') + echo "Syntastic for Nit error: Custom nitc cannot be found at: " . g:syntastic_nitc + endif finish endif function! SyntaxCheckers_nit_GetLocList() - let makeprg = "nitc --no-color --only-metamodel 2>&1 " . shellescape(expand("%")) + let makeprg = s:nitc . " --no-color --only-metamodel 2>&1 " . shellescape(expand("%")) + + " custom NIT_DIR + if exists('g:syntastic_nit_dir') + let makeprg = "NIT_DIR=" . g:syntastic_nit_dir . " " . makeprg + echo makeprg + endif + + " custom options for nit compiler + if exists('g:syntastic_nit_options') + let makeprg .= " " . g:syntastic_nit_options + endif + + " custom dirs to include for compiler + if exists('g:syntastic_nit_include_dirs') + for d in g:syntastic_nit_include_dirs + let makeprg .= " -I " . d + endfor + end + " possible combinations of error messages let ef_start = [ '%f:%l\,%c--%*[0-9]:', '%f:%l\,%c--%*[0-9]\,%*[0-9]:', '%f:%l\,%c:' ] let ef_type = [ ' %tarning: ', ' %trror: ', ' Syntax %trror: ' ] -- 1.7.9.5