3 " Maintainer: Felix von Leitner <leitner@math.fu-berlin.de>
4 " Last Change: 2001 May 09
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
14 " The mail header is recognized starting with a "keyword:" line and ending
15 " with an empty line or other line that can't be in the header.
16 " All lines of the header are highlighted
17 " For "From " matching case is required, not for the rest.
18 syn region mailHeader start="^From " skip="^[ \t]" end="^[-A-Za-z0-9/]*[^-A-Za-z0-9/:]"me=s-1 end="^[^:]*$"me=s-1 end="^---*" contains=mailHeaderKey,mailSubject
22 syn region mailHeader start="^\(Newsgroups:\|From:\|To:\|Cc:\|Bcc:\|Reply-To:\|Subject:\|Return-Path:\|Received:\|Date:\|Replied:\)" skip="^[ \t]" end="^[-a-z0-9/]*[^-a-z0-9/:]"me=s-1 end="^[^:]*$"me=s-1 end="^---*" contains=mailHeaderKey,mailSubject
24 syn region mailHeaderKey contained start="^\(From\|To\|Cc\|Bcc\|Reply-To\).*" skip=",$" end="$" contains=mailEmail
25 syn match mailHeaderKey contained "^Date"
27 syn match mailSubject contained "^Subject.*"
29 syn match mailEmail contained "[_=a-z\.+A-Z0-9-]\+@[a-zA-Z0-9\./\-]\+"
30 syn match mailEmail contained "<.\{-}>"
32 syn region mailSignature start="^-- *$" end="^$"
34 " even and odd quoted lines
35 " removed ':', it caused too many bogus highlighting
36 " order is imporant here!
37 syn match mailQuoted1 "^\([A-Za-z]\+>\|[]|}>]\).*$"
38 syn match mailQuoted2 "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{2}.*$"
39 syn match mailQuoted3 "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{3}.*$"
40 syn match mailQuoted4 "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{4}.*$"
41 syn match mailQuoted5 "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{5}.*$"
42 syn match mailQuoted6 "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{6}.*$"
44 " Need to sync on the header. Assume we can do that within a hundred lines
47 " Define the default highlighting.
48 " For version 5.7 and earlier: only when not done already
49 " For version 5.8 and later: only when an item doesn't have highlighting yet
50 if version >= 508 || !exists("did_ahdl_syn_inits")
52 let did_ahdl_syn_inits = 1
53 command -nargs=+ HiLink hi link <args>
55 command -nargs=+ HiLink hi def link <args>
58 HiLink mailHeaderKey Type
59 HiLink mailHeader Statement
60 HiLink mailQuoted1 Comment
61 HiLink mailQuoted3 Comment
62 HiLink mailQuoted5 Comment
63 HiLink mailQuoted2 Identifier
64 HiLink mailQuoted4 Identifier
65 HiLink mailQuoted6 Identifier
66 HiLink mailSignature PreProc
67 HiLink mailEmail Special
68 HiLink mailSubject String
73 let b:current_syntax = "mail"