1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
" Vim syntax file
" Language: Mail file
" Maintainer: Felix von Leitner <leitner@math.fu-berlin.de>
" Last change: 1998 February 3
" Remove any old syntax stuff hanging around
syn clear
" The mail header is recognized starting with a "keyword:" line and ending
" with an empty line or other line that can't be in the header.
" All lines of the header are highlighted
" For "From " matching case is required, not for the rest.
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
syn case ignore
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
syn region mailHeaderKey contained start="^\(From\|To\|Cc\|Bcc\|Reply-To\).*" skip=",$" end="$" contains=mailEmail
syn match mailHeaderKey contained "^Date"
syn match mailSubject contained "^Subject.*"
syn match mailEmail contained "[_a-z\.A-Z0-9-]\+@[a-zA-Z0-9\./\-]\+"
syn match mailEmail contained "<.\{-}>"
syn region mailSignature start="^-- *$" end="^$"
" even and odd quoted lines
" removed ':', it caused too many bogus highlighting
" order is imporant here!
syn match mailQuoted1 "^\([A-Za-z]\+>\|[]|}>]\).*$"
syn match mailQuoted2 "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{2}.*$"
syn match mailQuoted3 "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{3}.*$"
syn match mailQuoted4 "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{4}.*$"
syn match mailQuoted5 "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{5}.*$"
syn match mailQuoted6 "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{6}.*$"
" Need to sync on the header. Assume we can do that within a hundred lines
syn sync lines=100
if !exists("did_mail_syntax_inits")
let did_mail_syntax_inits = 1
" The default methods for highlighting. Can be overridden later
hi link mailHeaderKey Type
hi link mailHeader Statement
hi link mailQuoted1 Comment
hi link mailQuoted3 Comment
hi link mailQuoted5 Comment
hi link mailQuoted2 Identifier
hi link mailQuoted4 Identifier
hi link mailQuoted6 Identifier
hi link mailSignature PreProc
hi link mailEmail Special
hi link mailSubject String
endif
let b:current_syntax = "mail"
" vim: ts=8
|