robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
144279ef30
master
1" Vim syntax file 2" Language: Debian DEP3 Patch headers 3" Maintainer: Gabriel Filion <gabster@lelutin.ca> 4" Last Change: 2023 Jan 16 5" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/dep3patch.vim 6" 7" Specification of the DEP3 patch header format is available at: 8" https://dep-team.pages.debian.net/deps/dep3/ 9 10" Standard syntax initialization 11if exists ( 'b:current_syntax' ) 12finish 13endif 14 15runtime ! syntax/diff.vim 16unlet ! b: current_syntax 17 18let s: cpo_save = & cpo 19set cpo & vim 20 21syn region dep3patchHeaders start = "\%^ "end = "^\%(---\)\@= "contains = dep3patchKey , dep3patchMultiField 22 23syn case ignore 24 25syn region dep3patchMultiField matchgroup = dep3patchKey start = "^\%(Description\|Subject\)\ze: * "skip = "^ [ \t ] "end = "^$ "me= s-1end = "^ [ ^ \t# ] "me= s-1contained contains = @Spell 26syn region dep3patchMultiField matchgroup = dep3patchKey start = "^Origin\ze: * "end = "$ "contained contains = dep3patchHTTPUrl , dep3patchCommitID , dep3patchOriginCategory oneline keepend 27syn region dep3patchMultiField matchgroup = dep3patchKey start = "^Bug\%(- [ [:graph: ] ]\+\)\?\ze: * "end = "$ "contained contains = dep3patchHTTPUrl oneline keepend 28syn region dep3patchMultiField matchgroup = dep3patchKey start = "^Forwarded\ze: * "end = "$ "contained contains = dep3patchHTTPUrl , dep3patchForwardedShort oneline keepend 29syn region dep3patchMultiField matchgroup = dep3patchKey start = "^\%(Author\|From\)\ze: * "end = "$ "contained contains = dep3patchEmail oneline keepend 30syn region dep3patchMultiField matchgroup = dep3patchKey start = "^\%(Reviewed-by\|Acked-by\)\ze: * "end = "$ "contained contains = dep3patchEmail oneline keepend 31syn region dep3patchMultiField matchgroup = dep3patchKey start = "^Last-Update\ze: * "end = "$ "contained contains = dep3patchISODate oneline keepend 32syn region dep3patchMultiField matchgroup = dep3patchKey start = "^Applied-Upstream\ze: * "end = "$ "contained contains = dep3patchHTTPUrl , dep3patchCommitID oneline keepend 33 34syn match dep3patchHTTPUrl contained "\vhttps?:// [ [:alnum: ] ] [ -[:alnum: ] ] * [ [:alnum: ] ]?(\. [ [:alnum: ] ] [ -[:alnum: ] ] * [ [:alnum: ] ]?) * \. [ [:alpha: ] ] [ -[:alnum: ] ] * [ [:alpha: ] ]?(:\d+)?(/ [ ^[:space: ] ] * )?$ " 35syn match dep3patchCommitID contained "commit: [ [:alnum: ] ]\+ " 36syn match dep3patchOriginCategory contained "\%(upstream\|backport\|vendor\|other\), " 37syn match dep3patchForwardedShort contained "\%(yes\|no\|not-needed\), " 38syn match dep3patchEmail "[ _=[:alnum: ] \.+-]\+@ [ [:alnum: ] \./\-]\+ " 39syn match dep3patchEmail "<.\{-}> " 40syn match dep3patchISODate "[ [:digit: ] ]\{4}- [ [:digit: ] ]\{2}- [ [:digit: ] ]\{2} " 41 42" Associate our matches and regions with pretty colours 43hi def link dep3patchKey Keyword 44hi def link dep3patchOriginCategory Keyword 45hi def link dep3patchForwardedShort Keyword 46hi def link dep3patchMultiField Normal 47hi def link dep3patchHTTPUrl Identifier 48hi def link dep3patchCommitID Identifier 49hi def link dep3patchEmail Identifier 50hi def link dep3patchISODate Identifier 51 52let b: current_syntax = 'dep3patch' 53 54let & cpo = s: cpo_save 55unlet s: cpo_save 56 57" vim: ts=8 sw=2