Skip to content

Instantly share code, notes, and snippets.

@atsepkov
Created September 16, 2016 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atsepkov/b84be11302fb3a8a04961d9ef953863a to your computer and use it in GitHub Desktop.
Save atsepkov/b84be11302fb3a8a04961d9ef953863a to your computer and use it in GitHub Desktop.
Allowa Syntastic to lint RapydScript files
" =======================================================================
" 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