vue class directive objects

This commit is contained in:
ManjaroOne666 2018-03-28 00:12:03 +01:00
parent 8eee223ad5
commit e52c922315
1 changed files with 13 additions and 5 deletions

View File

@ -2,17 +2,22 @@ runtime! after/syntax/html.vim
syn keyword vueComponentTag contained template containedin=htmlSpecialTagName syn keyword vueComponentTag contained template containedin=htmlSpecialTagName
syn match vueDirective "\(^\|\s\)\zs[v:][-:.0-9_a-z]*" containedin=htmlTag,htmlTagN contains=vueDirectiveClassValue nextgroup=vueDirectiveValue syn match vueDirective "\(^\|\s\)\zs[v:][-:.0-9_a-z]*" containedin=htmlTag,htmlTagN contains=vueDirectiveClass nextgroup=vueDirectiveValue
syn match vueEvent "\(^\|\s\)\zs[@][-:.0-9_a-z]*" containedin=htmlTag,htmlTagN nextgroup=vueEventValue syn match vueEvent "\(^\|\s\)\zs[@][-:.0-9_a-z]*" containedin=htmlTag,htmlTagN nextgroup=vueEventValue
syn match vueConditional "\<v-else" containedin=htmlTag,htmlTagN syn match vueConditional "\<v-else" containedin=htmlTag,htmlTagN
syn match vueConditional "\<v-if\|\<v-show" containedin=htmlTag,htmlTagN nextgroup=vueConditionalValue syn match vueConditional "\<v-if\|\<v-show" containedin=htmlTag,htmlTagN nextgroup=vueConditionalValue
syn match vueFor "\<v-for" containedin=htmlTag,htmlTagN nextgroup=vueForValue syn match vueFor "\<v-for" containedin=htmlTag,htmlTagN nextgroup=vueForValue
syn match vueRef "\(^\|\s\)\zs:\?ref" containedin=htmlTag,htmlTagN nextgroup=vueRefValue syn match vueRef "\(^\|\s\)\zs:\?ref" containedin=htmlTag,htmlTagN nextgroup=vueRefValue
syn region vueDirectiveClassValue contained start=+class="+hs=s+7 end=+"+he=e-1 syn region vueDirectiveClass contained start=+class="+hs=s+7 end=+"+he=e-1 contains=vueObjectKey
syn region vueDirectiveClassValue contained start=+class='+hs=s+7 end=+'+he=e-1 " syn region vueDirectiveValue contained start=+="+hs=s+2 end=+"+he=e-1
syn region vueDirectiveValue contained start=+="+hs=s+2 end=+"+he=e-1 " syn region vueDirectiveValue contained start=+='+hs=s+2 end=+'+he=e-1
syn region vueDirectiveValue contained start=+='+hs=s+2 end=+'+he=e-1
syntax match vueObjectKey contained /\<\k*\ze\s*:/ contains=jsFunctionKey skipwhite skipempty nextgroup=vueObjectValue
syntax region vueObjectKey contained start=+\z([']\)+hs=s+1 skip=+\\\%(\z1\|$\)+ end=+\z1\|$+he=e-1 contains=jsSpecial,@Spell skipwhite skipempty nextgroup=vueObjectValue
syntax region vueObjectValue contained matchgroup=jsNoise start=/:/ end=/[,}]\@=/ contains=@jsExpression extend
" TODO match vueObjectValue with a javascript expression
syn region vueEventValue contained start=+="+hs=s+2 end=+"+he=e-1 syn region vueEventValue contained start=+="+hs=s+2 end=+"+he=e-1
syn region vueEventValue contained start=+='+hs=s+2 end=+'+he=e-1 syn region vueEventValue contained start=+='+hs=s+2 end=+'+he=e-1
syn region vueConditionalValue contained start=+="+hs=s+2 end=+"+he=e-1 syn region vueConditionalValue contained start=+="+hs=s+2 end=+"+he=e-1
@ -41,3 +46,6 @@ syn region vueClassesName contained start=+"+hs=s+1 end=+"+he=e-1
hi def link cssClassesAttr cssClassAttr hi def link cssClassesAttr cssClassAttr
hi def link vueClassesname cssClassName hi def link vueClassesname cssClassName
hi def link vueObjectKey cssClassName
hi def link vueDirectiveClass Noise
hi def link vueDirectiveClassName vueClassesName