summaryrefslogtreecommitdiffstats
path: root/syntax/ecrystal.vim
blob: 7742ba1540d4885f64772a3f5c2947ba725a55da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
let files = filter(globpath(&rtp, 'syntax/ecrystal.vim', 1, 1), { _, v -> v !~ "vim-polyglot" && v !~ $VIMRUNTIME && v !~ "after" })
if len(files) > 0
  exec 'source ' . files[0]
  finish
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1

if &syntax !~# '\<ecrystal\>' || get(b:, 'current_syntax') =~# '\<ecrystal\>'
  finish
endif

if !exists('main_syntax')
  let main_syntax = 'ecrystal'
endif

call ecrystal#SetSubtype()

if b:ecrystal_subtype !=# ''
  exec 'runtime! syntax/'.b:ecrystal_subtype.'.vim'
  unlet! b:current_syntax
endif

syn include @crystalTop syntax/crystal.vim

syn cluster ecrystalRegions contains=ecrystalControl,ecrystalRender,ecrystalComment

syn region ecrystalControl matchgroup=ecrystalDelimiter start="<%%\@!-\="  end="-\=%>" display contains=@crystalTop        containedin=ALLBUT,@ecrystalRegions
syn region ecrystalRender  matchgroup=ecrystalDelimiter start="<%%\@!-\==" end="-\=%>" display contains=@crystalTop        containedin=ALLBUT,@ecrystalRegions
syn region ecrystalComment matchgroup=ecrystalDelimiter start="<%%\@!-\=#" end="-\=%>" display contains=crystalTodo,@Spell containedin=ALLBUT,@ecrystalRegions

" Define the default highlighting.

hi def link ecrystalDelimiter PreProc
hi def link ecrystalComment   crystalComment

let b:current_syntax = 'ecrystal'

if exists('main_syntax') && main_syntax ==# 'ecrystal'
  unlet main_syntax
endif

endif