robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
4fcdfa5ad0
master
1" Vim syntax file 2" Language: Debian changelog files 3" Maintainer: Debian Vim Maintainers 4" Former Maintainers: Gerfried Fuchs <alfie@ist.org> 5" Wichert Akkerman <wakkerma@debian.org> 6" Last Change: 2023 Oct 11 7" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/debchangelog.vim 8 9" Standard syntax initialization 10if exists ( 'b:current_syntax' ) 11finish 12endif 13 14" Case doesn't matter for us 15syn case ignore 16 17let s: urgency = 'urgency=\(low\|medium\|high\|emergency\|critical\)\( [^[:space:],][^,]*\)\=' 18let s: binNMU = 'binary-only=yes' 19 20" Include Debian versioning information 21runtime ! syntax/shared/debversions.vim 22 23exe 'syn match debchangelogTarget contained "\%( \%(' . join ( g: debSharedSupportedVersions , '\|' ) . '\)\>[-[:alnum:]]*\)\+"' 24exe 'syn match debchangelogUnsupportedTarget contained "\%( \%(' . join ( g: debSharedUnsupportedVersions , '\|' ) . '\)\>[-[:alnum:]]*\)\+"' 25 26unlet g: debSharedSupportedVersions 27unlet g: debSharedUnsupportedVersions 28 29" Define some common expressions we can use later on 30syn match debchangelogName contained "^ [ [:alnum: ] ] [ [:alnum: ] .+-]\+ " 31exe 'syn match debchangelogFirstKV contained "; \(' . s: urgency . '\|' . s: binNMU . '\)"' 32exe 'syn match debchangelogOtherKV contained ", \(' . s: urgency . '\|' . s: binNMU . '\)"' 33syn match debchangelogUnreleased contained /UNRELEASED / 34syn match debchangelogVersion contained "(.\{-}) " 35syn match debchangelogCloses contained "closes:\_s * \(bug\)\=#\=\_s\=\d\+\(,\_s * \(bug\)\=#\=\_s\=\d\+\) * " 36syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s * #\d\+\) * " 37syn match debchangelogEmail contained "[ _=[:alnum: ] .+-]\+@ [ [:alnum: ] ./\-]\+ " 38syn match debchangelogEmail contained "<.\{-}> " 39 40" Define the entries that make up the changelog 41syn region debchangelogHeader start = "^ [ ^ ] "end = "$ "contains = debchangelogName , debchangelogFirstKV , debchangelogOtherKV , debchangelogTarget , debchangelogUnsupportedTarget , debchangelogUnreleased , debchangelogVersion , debchangelogBinNMU oneline 42syn region debchangelogFooter start = "^ [ ^ ] "end = "$ "contains = debchangelogEmail oneline 43syn region debchangelogEntry start = "^ "end = "$ "contains = debchangelogCloses , debchangelogLP oneline 44 45" Associate our matches and regions with pretty colours 46hi def link debchangelogHeader Error 47hi def link debchangelogFooter Identifier 48hi def link debchangelogEntry Normal 49hi def link debchangelogCloses Statement 50hi def link debchangelogLP Statement 51hi def link debchangelogFirstKV Identifier 52hi def link debchangelogOtherKV Identifier 53hi def link debchangelogName Comment 54hi def link debchangelogVersion Identifier 55hi def link debchangelogUnreleased WarningMsg 56hi def link debchangelogEmail Special 57hi def link debchangelogTarget Identifier 58hi def link debchangelogUnsupportedTarget Identifier 59 60let b: current_syntax = 'debchangelog' 61 62" vim: ts=8 sw=2