summaryrefslogtreecommitdiffstats
path: root/syntax/ecrystal.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-04-14 13:17:26 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-04-14 13:17:26 +0200
commit14dc82fc4e6c0c08078f97a24a6c1639c1cc5113 (patch)
treedea8d2398a9377a0eee7786776e3cd420ce1ee89 /syntax/ecrystal.vim
parente86e0ad36ef9501acbc3e8c63a1d4fab104e47cb (diff)
downloadvim-polyglot-14dc82fc4e6c0c08078f97a24a6c1639c1cc5113.tar.gz
vim-polyglot-14dc82fc4e6c0c08078f97a24a6c1639c1cc5113.zip
Update
Diffstat (limited to 'syntax/ecrystal.vim')
-rw-r--r--syntax/ecrystal.vim37
1 files changed, 37 insertions, 0 deletions
diff --git a/syntax/ecrystal.vim b/syntax/ecrystal.vim
new file mode 100644
index 00000000..096990ff
--- /dev/null
+++ b/syntax/ecrystal.vim
@@ -0,0 +1,37 @@
+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