Bram Moolenaar | 9712ff1 | 2022-09-18 13:04:22 +0100 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: LyRiCs |
| 3 | " Maintainer: ObserverOfTime <chronobserver@disroot.org> |
| 4 | " Filenames: *.lrc |
Denilson Sá Maia | 30377e0 | 2025-01-13 08:23:24 +0100 | [diff] [blame] | 5 | " Last Change: 2025 Jan 13 |
Bram Moolenaar | 9712ff1 | 2022-09-18 13:04:22 +0100 | [diff] [blame] | 6 | |
| 7 | if exists('b:current_syntax') |
| 8 | finish |
| 9 | endif |
| 10 | |
| 11 | let s:cpo_save = &cpoptions |
| 12 | set cpoptions&vim |
| 13 | |
| 14 | syn case ignore |
| 15 | |
| 16 | " Errors |
| 17 | syn match lrcError /^.\+$/ |
| 18 | |
| 19 | " ID tags |
| 20 | syn match lrcTag /^\s*\[\a\+:.\+\]\s*$/ contains=lrcTagName,lrcTagValue |
| 21 | syn match lrcTagName contained nextgroup=lrcTagValue |
| 22 | \ /\[\zs\(al\|ar\|au\|by\|encoding\|la\|id\|length\|offset\|re\|ti\|ve\)\ze:/ |
| 23 | syn match lrcTagValue /:\zs.\+\ze\]/ contained |
| 24 | |
| 25 | " Lyrics |
Denilson Sá Maia | 30377e0 | 2025-01-13 08:23:24 +0100 | [diff] [blame] | 26 | syn match lrcLyricTime /^\s*\(\[\d\d:\d\d\.\d\d\d\?\]\)\+/ |
Bram Moolenaar | 9712ff1 | 2022-09-18 13:04:22 +0100 | [diff] [blame] | 27 | \ contains=lrcNumber nextgroup=lrcLyricLine |
| 28 | syn match lrcLyricLine /.*$/ contained contains=lrcWordTime,@Spell |
| 29 | syn match lrcWordTime /<\d\d:\d\d\.\d\d>/ contained contains=lrcNumber,@NoSpell |
| 30 | syn match lrcNumber /[+-]\=\d\+/ contained |
| 31 | |
| 32 | hi def link lrcLyricTime Label |
| 33 | hi def link lrcNumber Number |
| 34 | hi def link lrcTag PreProc |
| 35 | hi def link lrcTagName Identifier |
| 36 | hi def link lrcTagValue String |
| 37 | hi def link lrcWordTime Special |
| 38 | hi def link lrcError Error |
| 39 | |
| 40 | let b:current_syntax = 'lyrics' |
| 41 | |
| 42 | let &cpoptions = s:cpo_save |
| 43 | unlet s:cpo_save |