30875
|
1 " Vim syntax file
|
|
2 " Language: SubStation Alpha
|
|
3 " Maintainer: ObserverOfTime <chronobserver@disroot.org>
|
|
4 " Filenames: *.ass,*.ssa
|
|
5 " Last Change: 2022 Oct 10
|
|
6
|
|
7 if exists('b:current_syntax')
|
|
8 finish
|
|
9 endif
|
|
10
|
|
11 " Comments
|
|
12 syn keyword ssaTodo TODO FIXME NOTE XXX contained
|
|
13 syn match ssaComment /^\(;\|!:\).*$/ contains=ssaTodo,@Spell
|
|
14 syn match ssaTextComment /{[^}]*}/ contained contains=@Spell
|
|
15
|
|
16 " Sections
|
|
17 syn match ssaSection /^\[[a-zA-Z0-9+ ]\+\]$/
|
|
18
|
|
19 " Headers
|
|
20 syn match ssaHeader /^[^;!:]\+:/ skipwhite nextgroup=ssaField
|
|
21
|
|
22 " Fields
|
|
23 syn match ssaField /[^,]*/ contained skipwhite nextgroup=ssaDelimiter
|
|
24
|
|
25 " Time
|
|
26 syn match ssaTime /\d:\d\d:\d\d\.\d\d/ contained skipwhite nextgroup=ssaDelimiter
|
|
27
|
|
28 " Delimiter
|
|
29 syn match ssaDelimiter /,/ contained skipwhite nextgroup=ssaField,ssaTime,ssaText
|
|
30
|
|
31 " Text
|
|
32 syn match ssaText /\(^Dialogue:\(.*,\)\{9}\)\@<=.*$/ contained contains=@ssaTags,@Spell
|
|
33 syn cluster ssaTags contains=ssaOverrideTag,ssaEscapeChar,ssaTextComment,ssaItalics,ssaBold,ssaUnderline,ssaStrikeout
|
|
34
|
|
35 " Override tags
|
|
36 syn match ssaOverrideTag /{\\[^}]\+}/ contained contains=@NoSpell
|
|
37
|
|
38 " Special characters
|
|
39 syn match ssaEscapeChar /\\[nNh{}]/ contained contains=@NoSpell
|
|
40
|
|
41 " Markup
|
|
42 syn region ssaItalics start=/{\\i1}/ end=/{\\i0}/ matchgroup=ssaOverrideTag keepend oneline contained contains=@ssaTags,@Spell
|
|
43 syn region ssaBold start=/{\\b1}/ end=/{\\b0}/ matchgroup=ssaOverrideTag keepend oneline contained contains=@ssaTags,@Spell
|
|
44 syn region ssaUnderline start=/{\\u1}/ end=/{\\u0}/ matchgroup=ssaOverrideTag keepend oneline contained contains=@ssaTags,@Spell
|
|
45 syn region ssaStrikeout start=/{\\s1}/ end=/{\\s0}/ matchgroup=ssaOverrideTag keepend oneline contained contains=@ssaTags,@Spell
|
|
46
|
|
47 hi def link ssaDelimiter Delimiter
|
|
48 hi def link ssaComment Comment
|
|
49 hi def link ssaEscapeChar SpecialChar
|
|
50 hi def link ssaField String
|
|
51 hi def link ssaHeader Label
|
|
52 hi def link ssaSection StorageClass
|
|
53 hi def link ssaOverrideTag Special
|
|
54 hi def link ssaTextComment Comment
|
|
55 hi def link ssaTime Number
|
|
56 hi def link ssaTodo Todo
|
|
57
|
|
58 hi ssaBold cterm=bold gui=bold
|
|
59 hi ssaItalics cterm=italic gui=italic
|
|
60 hi ssaStrikeout cterm=strikethrough gui=strikethrough
|
|
61 hi ssaUnderline cterm=underline gui=underline
|
|
62
|
|
63 let b:current_syntax = 'srt'
|