1 "============================================================================
3 "Description: Syntax checking plugin for syntastic.vim
4 "Maintainer: Alexis Laferrière <alexis.laf@xymus.net>
5 "License: This program is free software. It comes without any warranty,
6 " to the extent permitted by applicable law. You can redistribute
7 " it and/or modify it under the terms of the Do What The Fuck You
8 " Want To Public License, Version 2, as published by Sam Hocevar.
9 " See http://sam.zoy.org/wtfpl/COPYING for more details.
11 " g:syntastic_nitpick specifies custom path to `nitpick` tool
12 " g:syntastic_nit_dir specifies the NIT_DIR env variable
13 " g:syntastic_nit_args specifies extra arguments to call `nitpick`
14 " g:syntastic_nit_include_dirs lists directories to include, must be a list
15 " g:nit_main sets the main module to compile instead of the opened file
16 "============================================================================
17 if exists("loaded_syntastic_nit_nitpick_checker")
20 let loaded_syntastic_nit_nitpick_checker = 1
22 " check if nitpick is accessible
23 if exists('g:syntastic_nitpick')
24 let s:nitpick = g:syntastic_nitpick
26 let s:nitpick = "nitpick"
29 if !executable(s:nitpick)
30 if exists('g:syntastic_nitpick')
31 echo "Syntastic for Nit error: Custom tool cannot be found at: " . g:syntastic_nitpick
36 function! SyntaxCheckers_nit_nitpick_IsAvailable()
37 return executable(expand(s:nitpick))
40 function! SyntaxCheckers_nit_nitpick_GetLocList()
41 let makeprg = s:nitpick . " --no-color -W --vim-autocomplete "
44 if exists('g:syntastic_nit_dir')
45 let makeprg = "NIT_DIR=" . g:syntastic_nit_dir . " " . makeprg
48 " custom options for nit compiler
49 if exists('g:syntastic_nit_options')
50 let makeprg .= " " . g:syntastic_nit_options
53 " custom dirs to include for compiler
54 if exists('g:syntastic_nit_include_dirs')
55 for d in g:syntastic_nit_include_dirs
56 let makeprg .= " -I " . d
60 " alternative main module
61 if exists('g:nit_main')
62 let makeprg .= " " . g:nit_main
64 let makeprg .= " " . shellescape(expand("%"))
68 let makeprg .= " 2>&1 "
70 " possible combinations of error messages
71 let ef_start = [ '%f:%l\,%c--%*[0-9]:',
72 \ '%f:%l\,%c--%*[0-9]\,%*[0-9]:',
74 let ef_type = [ ' %tarning: ',
75 \ ' %tocumentation warning: ',
78 " generate errorformat from combinations
82 let errorformat .= s . t . '%m,'
86 let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'postprocess': ['guards'] })
89 if e['type'] ==? 'd' " is a documentation warning
91 let e['subtype'] = 'Style'
98 call g:SyntasticRegistry.CreateAndRegisterChecker({
100 \ 'name': 'nitpick'})