30324
|
1 " Vim syntax file
|
|
2 " Language: SubRip
|
|
3 " Maintainer: ObserverOfTime <chronobserver@disroot.org>
|
|
4 " Filenames: *.srt
|
|
5 " Last Change: 2022 Sep 12
|
|
6
|
|
7 if exists('b:current_syntax')
|
|
8 finish
|
|
9 endif
|
|
10
|
|
11 syn spell toplevel
|
|
12
|
|
13 syn cluster srtSpecial contains=srtBold,srtItalics,srtStrikethrough,srtUnderline,srtFont,srtTag,srtEscape
|
|
14
|
|
15 " Number
|
|
16 syn match srtNumber /^\d\+$/ contains=@NoSpell
|
|
17
|
|
18 " Range
|
|
19 syn match srtRange /\d\d:\d\d:\d\d[,.]\d\d\d --> \d\d:\d\d:\d\d[,.]\d\d\d/ skipwhite contains=srtArrow,srtTime nextgroup=srtCoordinates
|
|
20 syn match srtArrow /-->/ contained contains=@NoSpell
|
|
21 syn match srtTime /\d\d:\d\d:\d\d[,.]\d\d\d/ contained contains=@NoSpell
|
|
22 syn match srtCoordinates /X1:\d\+ X2:\d\+ Y1:\d\+ Y2:\d\+/ contained contains=@NoSpell
|
|
23
|
|
24 " Bold
|
|
25 syn region srtBold matchgroup=srtFormat start=+<b>+ end=+</b>+ contains=@srtSpecial
|
|
26 syn region srtBold matchgroup=srtFormat start=+{b}+ end=+{/b}+ contains=@srtSpecial
|
|
27
|
|
28 " Italics
|
|
29 syn region srtItalics matchgroup=srtFormat start=+<i>+ end=+</i>+ contains=@srtSpecial
|
|
30 syn region srtItalics matchgroup=srtFormat start=+{i}+ end=+{/i}+ contains=@srtSpecial
|
|
31
|
|
32 " Strikethrough
|
|
33 syn region srtStrikethrough matchgroup=srtFormat start=+<s>+ end=+</s>+ contains=@srtSpecial
|
|
34 syn region srtStrikethrough matchgroup=srtFormat start=+{s}+ end=+{/s}+ contains=@srtSpecial
|
|
35
|
|
36 " Underline
|
|
37 syn region srtUnderline matchgroup=srtFormat start=+<u>+ end=+</u>+ contains=@srtSpecial
|
|
38 syn region srtUnderline matchgroup=srtFormat start=+{u}+ end=+{/u}+ contains=@srtSpecial
|
|
39
|
|
40 " Font
|
|
41 syn region srtFont matchgroup=srtFormat start=+<font[^>]\{-}>+ end=+</font>+ contains=@srtSpecial
|
|
42
|
|
43 " ASS tags
|
|
44 syn match srtTag /{\\[^}]\{1,}}/ contains=@NoSpell
|
|
45
|
|
46 " Special characters
|
|
47 syn match srtEscape /\\[nNh]/ contains=@NoSpell
|
|
48
|
|
49 hi def link srtArrow Delimiter
|
|
50 hi def link srtCoordinates Label
|
|
51 hi def link srtEscape SpecialChar
|
|
52 hi def link srtFormat Special
|
|
53 hi def link srtNumber Number
|
|
54 hi def link srtTag PreProc
|
|
55 hi def link srtTime String
|
|
56
|
|
57 hi srtBold cterm=bold gui=bold
|
|
58 hi srtItalics cterm=italic gui=italic
|
|
59 hi srtStrikethrough cterm=strikethrough gui=strikethrough
|
|
60 hi srtUnderline cterm=underline gui=underline
|
|
61
|
|
62 let b:current_syntax = 'srt'
|