home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / mail.vim < prev    next >
Encoding:
Text File  |  1999-08-10  |  2.3 KB  |  61 lines

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