[pacman-dev] [PATCH 1/2] Add 'pkgbase' highlighting to vim syntax file
Simple change and probably a bit too copy/paste, but works for now. Signed-off-by: Dan McGee <dan@archlinux.org> --- PKGBUILD-split.proto | 2 +- contrib/PKGBUILD.vim | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/PKGBUILD-split.proto b/PKGBUILD-split.proto index 0cbd563..484cb1a 100644 --- a/PKGBUILD-split.proto +++ b/PKGBUILD-split.proto @@ -5,7 +5,7 @@ # Maintainer: Your Name <youremail@domain.com> pkgname=('pkg1' 'pkg2') -pkgbase="" +pkgbase=BASE pkgver=VERSION pkgrel=1 pkgdesc="" diff --git a/contrib/PKGBUILD.vim b/contrib/PKGBUILD.vim index a1112e5..90b628e 100644 --- a/contrib/PKGBUILD.vim +++ b/contrib/PKGBUILD.vim @@ -25,6 +25,13 @@ syn match pbValidPkgname /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIl syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote +" pkgbase +" FIXME if '=' is in pkgbase/pkgname/pkgver, it highlights whole string, not just '=' +syn keyword pb_k_pkgbase pkgbase contained +syn match pbValidPkgbase /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgbase +syn match pbIllegalPkgbase /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained +syn match pbPkgbaseGroup /^pkgbase=.*/ contains=pbIllegalPkgbase,pb_k_pkgbase,shDoubleQuote,shSingleQuote + " pkgver syn keyword pb_k_pkgver pkgver contained syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver @@ -133,7 +140,6 @@ syn match pbDerefEmulation /\$[{]\?[[:alnum:]_]*[}]\?/ contained hi def link pbDerefEmulation PreProc " md5sums - syn keyword pb_k_md5sums md5sums contained syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums syn match pbValidMd5sums /[[:alnum:]]\{32\}/ contained @@ -187,6 +193,9 @@ hi def link pbTodo Todo hi def link pbIllegalPkgname Error hi def link pb_k_pkgname pbKeywords +hi def link pbIllegalPkgbase Error +hi def link pb_k_pkgbase pbKeywords + hi def link pbIllegalPkgver Error hi def link pb_k_pkgver pbKeywords -- 1.7.1
Of course, we still have only md5 and sha1 hardcoded here but I resisted the urge to copy paste for the rest of our supported checksums in hope that someone knows how to do it a better way. Signed-off-by: Dan McGee <dan@archlinux.org> --- contrib/PKGBUILD.vim | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/PKGBUILD.vim b/contrib/PKGBUILD.vim index 90b628e..8b40ed7 100644 --- a/contrib/PKGBUILD.vim +++ b/contrib/PKGBUILD.vim @@ -142,10 +142,10 @@ hi def link pbDerefEmulation PreProc " md5sums syn keyword pb_k_md5sums md5sums contained syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums -syn match pbValidMd5sums /[[:alnum:]]\{32\}/ contained +syn match pbValidMd5sums /\x\{32\}/ contained syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums keepend syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums -syn match pbMd5Hash /[[:alnum:]]\+/ contained contains=pbValidMd5sums +syn match pbMd5Hash /\x\+/ contained contains=pbValidMd5sums hi def link pbMd5Quotes Keyword hi def link pbMd5Hash Error hi def link pbValidMd5sums Number @@ -153,10 +153,10 @@ hi def link pbValidMd5sums Number " sha1sums syn keyword pb_k_sha1sums sha1sums contained syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums -syn match pbValidSha1sums /[[:alnum:]]\{40\}/ contained +syn match pbValidSha1sums /\x\{40\}/ contained syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums keepend syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums -syn match pbSha1Hash /[[:alnum:]]\+/ contained contains=pbValidSha1sums +syn match pbSha1Hash /\x\+/ contained contains=pbValidSha1sums hi def link pbSha1Quotes Keyword hi def link pbSha1Hash Error hi def link pbValidSha1sums Number -- 1.7.1
participants (1)
-
Dan McGee