neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

dep3patch.vim (3003B)


      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
     11 if exists('b:current_syntax')
     12  finish
     13 endif
     14 
     15 runtime! syntax/diff.vim
     16 unlet! b:current_syntax
     17 
     18 let s:cpo_save = &cpo
     19 set cpo&vim
     20 
     21 syn region dep3patchHeaders start="\%^" end="^\%(---\)\@=" contains=dep3patchKey,dep3patchMultiField
     22 
     23 syn case ignore
     24 
     25 syn region dep3patchMultiField matchgroup=dep3patchKey start="^\%(Description\|Subject\)\ze: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contained contains=@Spell
     26 syn region dep3patchMultiField matchgroup=dep3patchKey start="^Origin\ze: *" end="$" contained contains=dep3patchHTTPUrl,dep3patchCommitID,dep3patchOriginCategory oneline keepend
     27 syn region dep3patchMultiField matchgroup=dep3patchKey start="^Bug\%(-[[:graph:]]\+\)\?\ze: *" end="$" contained contains=dep3patchHTTPUrl oneline keepend
     28 syn region dep3patchMultiField matchgroup=dep3patchKey start="^Forwarded\ze: *" end="$" contained contains=dep3patchHTTPUrl,dep3patchForwardedShort oneline keepend
     29 syn region dep3patchMultiField matchgroup=dep3patchKey start="^\%(Author\|From\)\ze: *" end="$" contained contains=dep3patchEmail oneline keepend
     30 syn region dep3patchMultiField matchgroup=dep3patchKey start="^\%(Reviewed-by\|Acked-by\)\ze: *" end="$" contained contains=dep3patchEmail oneline keepend
     31 syn region dep3patchMultiField matchgroup=dep3patchKey start="^Last-Update\ze: *" end="$" contained contains=dep3patchISODate oneline keepend
     32 syn region dep3patchMultiField matchgroup=dep3patchKey start="^Applied-Upstream\ze: *" end="$" contained contains=dep3patchHTTPUrl,dep3patchCommitID oneline keepend
     33 
     34 syn match dep3patchHTTPUrl contained "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
     35 syn match dep3patchCommitID contained "commit:[[:alnum:]]\+"
     36 syn match dep3patchOriginCategory contained "\%(upstream\|backport\|vendor\|other\), "
     37 syn match dep3patchForwardedShort contained "\%(yes\|no\|not-needed\), "
     38 syn match dep3patchEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+"
     39 syn match dep3patchEmail "<.\{-}>"
     40 syn match dep3patchISODate "[[:digit:]]\{4}-[[:digit:]]\{2}-[[:digit:]]\{2}"
     41 
     42 " Associate our matches and regions with pretty colours
     43 hi def link dep3patchKey            Keyword
     44 hi def link dep3patchOriginCategory Keyword
     45 hi def link dep3patchForwardedShort Keyword
     46 hi def link dep3patchMultiField     Normal
     47 hi def link dep3patchHTTPUrl        Identifier
     48 hi def link dep3patchCommitID       Identifier
     49 hi def link dep3patchEmail          Identifier
     50 hi def link dep3patchISODate        Identifier
     51 
     52 let b:current_syntax = 'dep3patch'
     53 
     54 let &cpo = s:cpo_save
     55 unlet s:cpo_save
     56 
     57 " vim: ts=8 sw=2