" Vim syntax file " Language: APT preferences " Maintainer: Yann Amar " Last Change: 2012 Sep 02 " For version 5.x: Clear all syntax items " For version 6.x and 7.x: Quit when a syntax file was already loaded if !exists("main_syntax") if version < 600 syntax clear elseif exists("b:current_syntax") finish endif let main_syntax = 'aptpref' endif " Errors: " Catch all that is not overridden by next rules/items. Error will be used for " errors, Special will be used for unknown strings. syn match aptprefError '[^[:blank:]]' syn match aptprefSpecial '[^[:blank:]]' syn match aptprefError '^.*$' syn cluster aptprefUnknown contains=aptprefError,aptprefSpecial " Should match case except for field names syn case match set iskeyword+=-,. " Define some common expressions we can use later on syn match aptprefComma contained display ',' syn match aptprefError contained display ',$' syn match aptprefPackageAll contained display '\s\*$'ms=s+1 syn match aptprefPackageName contained display '\s[-a-z0-9?*+.]\{2,\}\s'ms=s+1,me=e-1 syn match aptprefPackageName contained display '\s\([*?]\?[-a-z0-9+.]\+\)\+[*?]\?$'ms=s+1 syn region aptprefPackageName contained display matchgroup=aptprefKey start='/' end='/' oneline syn match aptprefPinType contained display '\<\(origin\|release\|version\)\>' syn match aptprefPriority contained display '\<-\?\d\{1,4\}$' syn match aptprefOriginDomain contained display '\<\([^[:blank:]/]\+\.\)\?debian\.\(net\|org\)\>' syn region aptprefOriginQuoted contained display oneline matchgroup=String start='"' end='"' contains=aptprefOriginDomain,aptprefSpecial syn region aptprefPinOrigin contained display oneline keepend matchgroup=aptprefPinType start='\' end='$' contains=aptprefOriginDomain,aptprefOriginQuoted,@aptprefUnknown syn match aptprefReleaseLetter contained display '[acolnv]=' syn keyword aptprefReleaseKeyword contained \ Debian lenny squeeze wheezy sid 5.0 6.0 7.0 \ oldstable stable testing unstable experimental \ lenny-updates squeeze-updates wheezy-updates syn region aptprefPinRelease contained display oneline keepend matchgroup=aptprefPinType start='\' end='$' contains=aptprefReleaseLetter,aptprefReleaseKeyword,aptprefComma,@aptprefUnknown syn match aptprefVersionNumber contained display '\<\d\+\(\.\(\d\+[0-9.]*\|[?*]\)\+\)\?\(-\(\d\+[-0-9a-z+.]*\|[?*]\)\+\)\?[?*]\?$' syn region aptprefPinVersion contained display oneline keepend matchgroup=aptprefPinType start='\' end='$' contains=aptprefVersionNumber,@aptprefUnknown syn case ignore syn region aptprefExplanationField oneline display start='^Explanation:' end='$' contains=@Spell syn region aptprefPackageField oneline display keepend matchgroup=aptprefKey start='^Package:' end='$' contains=aptprefPackageName,aptprefPackageAll,aptprefSpecial syn region aptprefPinField oneline display keepend matchgroup=aptprefKey start='^Pin:' end='$' contains=aptprefPinOrigin,aptprefPinRelease,aptprefPinVersion,aptprefError syn region aptprefPinPriorityField oneline display keepend matchgroup=aptprefKey start='^Pin-Priority:' end='$' contains=aptprefPriority,aptprefError hi def link aptprefError Error hi def link aptprefSpecial Special hi def link aptprefExplanationField Comment hi def link aptprefPackageField Keyword hi def link aptprefPinField Keyword hi def link aptprefPinPriorityField Keyword hi def link aptprefPackageName Normal hi def link aptprefPackageAll Type hi def link aptprefPinType Type hi def link aptprefOriginDomain String hi def link aptprefReleaseLetter Type hi def link aptprefReleaseKeyword String hi def link aptprefVersionNumber String hi def link aptprefPriority String hi def link aptprefKey Keyword hi def link aptprefComma Keyword let b:current_syntax = "aptpref"