codekingpro/portable-devtools
114k
1" Vim compiler file2" Language: TOML3" Maintainer: Konfekt4" Last Change: 2025 Oct 295 6if exists("current_compiler") | finish | endif7let current_compiler = "tombi"8 9let s:cpo_save = &cpo10set cpo&vim11 12if !executable('tombi')13 echoerr "tombi compiler: 'tombi' executable not found in PATH"14 let &cpo = s:cpo_save15 unlet s:cpo_save16 finish17endif18 19" NO_COLOR support requires tombi 0.6.40 or later20if !exists('s:tombi_nocolor')21 " Expect output like: 'tombi 0.6.40' or '0.6.40'22 let s:out = trim(system('tombi --version'))23 let s:tombi_ver = matchstr(s:out, '\v\s\d+\.\d+\.\d+$')24 25 function s:VersionGE(ver, req) abort26 " Compare semantic versions a.b.c ≥ x.y.z27 let l:pa = map(split(a:ver, '\.'), 'str2nr(v:val)')28 let l:pb = map(split(a:req, '\.'), 'str2nr(v:val)')29 while len(l:pa) < 3 | call add(l:pa, 0) | endwhile30 while len(l:pb) < 3 | call add(l:pb, 0) | endwhile31 for i in range(0, 2)32 if l:pa[i] > l:pb[i] | return 133 elseif l:pa[i] < l:pb[i] | return 034 endif35 endfor36 return 137 endfunction38 let s:tombi_nocolor = s:VersionGE(s:tombi_ver, '0.6.40')39 delfunction s:VersionGE40endif41 42if s:tombi_nocolor43 if has('win32')44 if &shell =~# '\v<%(cmd|cmd)>'45 CompilerSet makeprg=set\ NO_COLOR=1\ &&\ tombi\ lint46 elseif &shell =~# '\v<%(powershell|pwsh)>'47 CompilerSet makeprg=$env:NO_COLOR=\"1\";\ tombi\ lint48 else49 echoerr "tombi compiler: Unsupported shell for Windows"50 endif51 else " if has('unix')52 CompilerSet makeprg=env\ NO_COLOR=1\ tombi\ lint53 endif54else55 " Older tombi: strip ANSI color codes with sed.56 if executable('sed')57 CompilerSet makeprg=tombi\ lint\ $*\ \|\ sed\ -E\ \"s/\\x1B(\\[[0-9;]*[JKmsu]\|\\(B)//g\"58 else59 echoerr "tombi compiler: tombi version < 0.6.40 requires 'sed' to strip ANSI color codes"60 endif61endif62 63CompilerSet errorformat=%E%*\\sError:\ %m,%Z%*\\sat\ %f:%l:%c64CompilerSet errorformat+=%W%*\\sWarning:\ %m,%Z%*\\sat\ %f:%l:%c65CompilerSet errorformat+=%-G1\ file\ failed\ to\ be\ linted66CompilerSet errorformat+=%-G1\ file\ linted\ successfully67 68let &cpo = s:cpo_save69unlet s:cpo_save70 