Created
September 16, 2016 05:55
-
-
Save atsepkov/b84be11302fb3a8a04961d9ef953863a to your computer and use it in GitHub Desktop.
Allowa Syntastic to lint RapydScript files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ======================================================================= | |
" Version: 1.0.0 | |
" Description: Vim plugin that enables syntax checking in syntastic with the rapydscript linter | |
" Maintainer: Alexander Tsepkov <atsepkov at gmail dot com> | |
" ====================================================================== | |
" See | |
" https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide#external | |
if exists("g:loaded_syntastic_rapydscript_rapydscript_checker") | |
finish | |
endif | |
let g:loaded_syntastic_rapydscript_rapydscript_checker = 1 | |
let s:save_cpo = &cpo | |
set cpo&vim | |
function! SyntaxCheckers_rapydscript_rapydscript_IsAvailable() dict | |
if !executable(self.getExec()) | |
return 0 | |
endif | |
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 5, 7]) | |
endfunction | |
function! SyntaxCheckers_rapydscript_rapydscript_GetLocList() dict | |
let makeprg = self.makeprgBuild({ 'args': '--lint' }) | |
let errorformat = | |
\ '%f %l\,%c %tRR(%m,' . | |
\ '%f %l\,%c %tARN(%m,' . | |
\ '%f %l\,%c %tNFO(%m' | |
let loclist = SyntasticMake({ | |
\ 'makeprg': makeprg, | |
\ 'errorformat': errorformat }) | |
for e in loclist | |
let parts = matchlist(e['text'], '\v^([^)]*)\)(.*)') | |
if len(parts) > 2 | |
let e['hl'] = '\V' . (parts[1] ==# ';' ? ';' : '\<' . escape(parts[1], '\') . '\>') | |
let e['text'] = parts[2] | |
endif | |
endfor | |
return loclist | |
endfunction | |
call g:SyntasticRegistry.CreateAndRegisterChecker({ | |
\ 'filetype': 'rapydscript', | |
\ 'name': 'rapydscript'}) | |
let &cpo = s:save_cpo | |
unlet s:save_cpo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment