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