From f0f49cf0fa8bbcb7f84e3ffe699a934142498b14 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Thu, 28 May 2020 11:12:25 +0200 Subject: Add support for ics, closes #492 --- syntax/haml.vim | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++ syntax/icalendar.vim | 59 +++++++++++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 syntax/haml.vim create mode 100644 syntax/icalendar.vim (limited to 'syntax') diff --git a/syntax/haml.vim b/syntax/haml.vim new file mode 100644 index 00000000..02f5cf83 --- /dev/null +++ b/syntax/haml.vim @@ -0,0 +1,113 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1 + +" Vim syntax file +" Language: Haml +" Maintainer: Tim Pope +" Filenames: *.haml +" Last Change: 2018 Aug 21 + +if exists("b:current_syntax") + finish +endif + +if !exists("main_syntax") + let main_syntax = 'haml' +endif +let b:ruby_no_expensive = 1 + +runtime! syntax/html.vim +unlet! b:current_syntax +silent! syn include @hamlSassTop syntax/sass.vim +unlet! b:current_syntax +syn include @hamlRubyTop syntax/ruby.vim + +syn case match + +syn region rubyCurlyBlock start="{" end="}" contains=@hamlRubyTop contained +syn cluster hamlRubyTop add=rubyCurlyBlock + +syn cluster hamlComponent contains=hamlAttributes,hamlAttributesHash,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable +syn cluster hamlEmbeddedRuby contains=hamlAttributesHash,hamlObject,hamlRuby,hamlRubyFilter +syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment + +syn match hamlBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=hamlTag,hamlClassChar,hamlIdChar,hamlRuby,hamlPlainChar,hamlInterpolatable + +syn match hamlTag "%\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent +syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="(" end=")" contained contains=htmlArg,hamlAttributeString,hamlAttributeVariable,htmlEvent,htmlCssDefinition nextgroup=@hamlComponent +syn region hamlAttributesHash matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent +syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent +syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable +syn match hamlSelfCloser "/" contained +syn match hamlClassChar "\." contained nextgroup=hamlClass +syn match hamlIdChar "#{\@!" contained nextgroup=hamlId +syn match hamlClass "\%(\w\|-\|\:\)\+" contained nextgroup=@hamlComponent +syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent +syn region hamlDocType start="^\s*!!!" end="$" + +syn region hamlRuby matchgroup=hamlRubyOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend +syn region hamlRuby matchgroup=hamlRubyChar start="-" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend +syn match hamlPlainChar "\\" contained +syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="!\===\|!=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape,@hamlHtmlTop +syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==\|&=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape +syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD +syn match hamlInterpolationEscape "\\\@" contained contains=@hamlRubyTop + +syn region hamlAttributeString start=+\%(=\s*\)\@<='+ skip=+\%(\\\\\)*\\'+ end=+'+ contains=hamlInterpolation,hamlInterpolationEscape +syn region hamlAttributeString start=+\%(=\s*\)\@<="+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=hamlInterpolation,hamlInterpolationEscape +syn match hamlAttributeVariable "\%(=\s*\)\@<=\%(@@\=\|\$\)\=\w\+" contained + +syn match hamlHelper "\[^]]*]" contained containedin=hamlHtmlComment + +hi def link hamlSelfCloser Special +hi def link hamlDespacer Special +hi def link hamlClassChar Special +hi def link hamlIdChar Special +hi def link hamlTag Special +hi def link hamlClass Type +hi def link hamlId Identifier +hi def link hamlPlainChar Special +hi def link hamlInterpolatableChar hamlRubyChar +hi def link hamlRubyOutputChar hamlRubyChar +hi def link hamlRubyChar Special +hi def link hamlInterpolationDelimiter Delimiter +hi def link hamlInterpolationEscape Special +hi def link hamlAttributeString String +hi def link hamlAttributeVariable Identifier +hi def link hamlDocType PreProc +hi def link hamlFilter PreProc +hi def link hamlAttributesDelimiter Delimiter +hi def link hamlObjectDelimiter Delimiter +hi def link hamlHelper Function +hi def link hamlHtmlComment hamlComment +hi def link hamlComment Comment +hi def link hamlIEConditional SpecialComment +hi def link hamlError Error + +let b:current_syntax = "haml" + +if main_syntax == "haml" + unlet main_syntax +endif + +" vim:set sw=2: + +endif diff --git a/syntax/icalendar.vim b/syntax/icalendar.vim new file mode 100644 index 00000000..ca8179fe --- /dev/null +++ b/syntax/icalendar.vim @@ -0,0 +1,59 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'icalenadr') == -1 + +" Vim syntax file +" Language: icalendar +" Maintainer: Steven N. Severinghaus +" Last Modified: 2006-04-17 +" Version: 0.3 + +" Quit if syntax file is already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +command! -nargs=+ IcalHiLink hi def link + +syntax case ignore +setlocal iskeyword+=- + +syn match icalObject "^\(BEGIN\|END\)" +syn match icalObjectType ":\(VCALENDAR\|VEVENT\|VTODO\|VJOURNAL\|VFREEBUSY\|VTIMEZONE\|VALARM\)$" +syn match icalObjectType ":\(DAYLIGHT\|STANDARD\)$" +syn match icalProperty "^\(DTSTART\|PRODID\|VERSION\|CALSCALE\|METHOD\)" +syn match icalProperty "^\(DTEND\|DTSTAMP\|ORGANIZER\|UID\|CLASS\|CREATED\)" +syn match icalProperty "^\(LOCATION\|SEQUENCE\|STATUS\|SUMMARY\|COMMENT\)" +syn match icalProperty "^\(TRANSP\|ATTENDEE\|ATTACH\|FREEBUSY\|METHOD\|CONTACT\)" +syn match icalProperty "^\(DURATION\|RRULE\|EXDATE\|EXRULE\|URL\|DESCRIPTION\|ACTION\)" +syn match icalProperty "^\(LAST-MODIFIED\|RECURRENCE-ID\|TRIGGER\|RELATED-TO\|RDATE\)" +syn match icalProperty "^\(TZID\|TZOFFSETFROM\|TZOFFSETTO\|TZNAME\|TZURL\)" +syn match icalProperty "^\(PRIORITY\|DUE\|COMPLETED\|PERCENT-COMPLETE\|CATEGORIES\)" +syn match icalProperty "^\(RESOURCES\|REPEAT\|REQUEST-STATUS\)" +syn match icalCustom /^X-[A-Z-]\+/ +syn match icalDate "\<\d\{8}\>" +syn match icalDate "[0-9]\{8}T[0-9]\{6}Z\=" +syn match icalParameter "[A-Z0-9-]\+=[^;:]\+" +syn keyword icalSetValue CONFIRMED TENTATIVE CANCELLED DELEGATED OPAQUE +syn keyword icalSetValue NEEDS-ACTION ACCEPTED DECLINED IN-PROGRESS +syn keyword icalSetValue PRIVATE PUBLIC PUBLISH GREGORIAN DISPLAY +syn match icalSetValue /:COMPLETED$/ + +" Types: PreProc Keyword Type String Comment Special +IcalHiLink icalProperty PreProc +IcalHiLink icalObject Label +IcalHiLink icalObjectType Type +IcalHiLink icalDate String +IcalHiLink icalParameter Comment +IcalHiLink icalSetValue Special +IcalHiLink icalCustom Error + +delcommand IcalHiLink + +let b:current_syntax = "icalendar" + +"EOF vim: tw=78:ft=vim:ts=8 + + + +endif -- cgit v1.2.3