~ubuntu-branches/ubuntu/maverick/vim/maverick

« back to all changes in this revision

Viewing changes to runtime/syntax/mail.vim

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-05-04 11:13:42 UTC
  • mfrom: (1.1.8 upstream) (0.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090504111342-60miqybsixdpc345
Tags: 2:7.2.148-2ubuntu1
* Merge from Debian unstable, remaining changes:
  - debian/runtime/vimrc: "syntax on" is a sane default for non-tiny vim.
  - runtime/syntax/debcontrol.vim:
    + Add "metapackages" to the list of valid sections.
  - runtime/syntax/grub.vim:
    + Add Ubuntu-specific 'quiet' keyword.
  - Drop vim-lesstif package and lesstif2-dev build-dependency.
  - Enable Python interpreter on basic builds.
  - Disable autoindent, line-wrapping, and backup files by default.
* Dropped changes, merged in Debian:
  - Add jaunty, karmic to the list of valid suites.
  - runtime/syntax/debsources.vim:
    + Add "jaunty" to debsourcesDistrKeyword
  - Create a .pot file for translations.
* Drop gutsy from the list of valid distro series, it's been EOLed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
" Language:             Mail file
3
3
" Previous Maintainer:  Felix von Leitner <leitner@math.fu-berlin.de>
4
4
" Maintainer:           Gautam Iyer <gi1242@users.sourceforge.net>
5
 
" Last Change:          Thu 17 Jan 2008 11:25:44 AM PST
 
5
" Last Change:          Thu 06 Nov 2008 10:10:55 PM PST
6
6
 
7
7
" Quit when a syntax file was already loaded
8
8
if exists("b:current_syntax")
24
24
" emails
25
25
" According to RFC 2822 any printable ASCII character can appear in a field
26
26
" name, except ':'.
27
 
syn region      mailHeader      contains=@mailHeaderFields,@NoSpell start="^From .*\d\d\d\d$" skip="^\s" end="\v^[!-9;-~]*([^!-~]|$)"me=s-1
 
27
syn region      mailHeader      contains=@mailHeaderFields,@NoSpell start="^From .*\d\d\d\d$" skip="^\s" end="\v^[!-9;-~]*([^!-~]|$)"me=s-1 fold
28
28
syn match       mailHeaderKey   contained contains=mailEmail,@NoSpell "^From\s.*\d\d\d\d$"
 
29
 
 
30
" Nothing else depends on case. 
 
31
syn case ignore
 
32
 
 
33
" Headers in properly quoted (with "> " or ">") emails are matched
 
34
syn region      mailHeader      keepend contains=@mailHeaderFields,@mailQuoteExps,@NoSpell start="^\z(\(> \?\)*\)\v(newsgroups|x-([a-z\-])*|path|xref|message-id|from|((in-)?reply-)?to|b?cc|subject|return-path|received|date|replied):" skip="^\z1\s" end="\v^\z1[!-9;-~]*([^!-~]|$)"me=s-1 end="\v^\z1@!"me=s-1 end="\v^\z1(\> ?)+"me=s-1 fold
 
35
 
29
36
" Usenet headers
30
37
syn match       mailHeaderKey   contained contains=mailHeaderEmail,mailEmail,@NoSpell "\v(^(\> ?)*)@<=(Newsgroups|Followup-To|Message-ID|Supersedes|Control):.*$"
31
38
 
32
 
syn case ignore
33
 
" Nothing else depends on case. Headers in properly quoted (with "> " or ">")
34
 
" emails are matched
35
 
syn region      mailHeader      keepend contains=@mailHeaderFields,@mailQuoteExps,@NoSpell start="^\z(\(> \?\)*\)\v(newsgroups|x-([a-z\-])*|path|xref|message-id|from|((in-)?reply-)?to|b?cc|subject|return-path|received|date|replied):" skip="^\z1\s" end="\v^\z1[!-9;-~]*([^!-~]|$)"me=s-1 end="\v^\z1@!"me=s-1 end="\v^\z1(\> ?)+"me=s-1
36
39
 
37
40
syn region      mailHeaderKey   contained contains=mailHeaderEmail,mailEmail,@mailQuoteExps,@NoSpell start="\v(^(\> ?)*)@<=(to|b?cc):" skip=",$" end="$"
38
 
syn match       mailHeaderKey   contained contains=mailHeaderEmail,mailEmail,@NoSpell "\v(^(\> ?)*)@<=(from|reply-to):.*$"
 
41
syn match       mailHeaderKey   contained contains=mailHeaderEmail,mailEmail,@NoSpell "\v(^(\> ?)*)@<=(from|reply-to):.*$" fold
39
42
syn match       mailHeaderKey   contained contains=@NoSpell "\v(^(\> ?)*)@<=date:"
40
 
syn match       mailSubject     contained "\v^subject:.*$"
 
43
syn match       mailSubject     contained "\v^subject:.*$" fold
41
44
syn match       mailSubject     contained contains=@NoSpell "\v(^(\> ?)+)@<=subject:.*$"
42
45
 
43
46
" Anything in the header between < and > is an email address
44
47
syn match       mailHeaderEmail contained contains=@NoSpell "<.\{-}>"
45
48
 
46
49
" Mail Signatures. (Begin with "-- ", end with change in quote level)
47
 
syn region      mailSignature   keepend contains=@mailLinks,@mailQuoteExps start="^--\s$" end="^$" end="^\(> \?\)\+"me=s-1
48
 
syn region      mailSignature   keepend contains=@mailLinks,@mailQuoteExps,@NoSpell start="^\z(\(> \?\)\+\)--\s$" end="^\z1$" end="^\z1\@!"me=s-1 end="^\z1\(> \?\)\+"me=s-1
 
50
syn region      mailSignature   keepend contains=@mailLinks,@mailQuoteExps start="^--\s$" end="^$" end="^\(> \?\)\+"me=s-1 fold
 
51
syn region      mailSignature   keepend contains=@mailLinks,@mailQuoteExps,@NoSpell start="^\z(\(> \?\)\+\)--\s$" end="^\z1$" end="^\z1\@!"me=s-1 end="^\z1\(> \?\)\+"me=s-1 fold
 
52
 
 
53
" Treat verbatim Text special.
 
54
syn region      mailVerbatim    contains=@NoSpell keepend start="^#v+$" end="^#v-$" fold 
 
55
syn region      mailVerbatim    contains=@mailQuoteExps,@NoSpell start="^\z(\(> \?\)\+\)#v+$" end="\z1#v-$" fold 
49
56
 
50
57
" URLs start with a known protocol or www,web,w3.
51
58
syn match mailURL contains=@NoSpell `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^'        <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^'        <>"]+)[a-z0-9/]`
59
66
syn match mailQuoteExp5 contained "\v^(\> ?){5}"
60
67
syn match mailQuoteExp6 contained "\v^(\> ?){6}"
61
68
 
62
 
" Even and odd quoted lines. order is imporant here!
63
 
syn match mailQuoted1   contains=mailHeader,@mailLinks,mailSignature,@NoSpell "^\([a-z]\+>\|[]|}>]\).*$"
64
 
syn match mailQuoted2   contains=mailHeader,@mailLinks,mailSignature,@NoSpell "^\(\([a-z]\+>\|[]|}>]\)[ \t]*\)\{2}.*$"
65
 
syn match mailQuoted3   contains=mailHeader,@mailLinks,mailSignature,@NoSpell "^\(\([a-z]\+>\|[]|}>]\)[ \t]*\)\{3}.*$"
66
 
syn match mailQuoted4   contains=mailHeader,@mailLinks,mailSignature,@NoSpell "^\(\([a-z]\+>\|[]|}>]\)[ \t]*\)\{4}.*$"
67
 
syn match mailQuoted5   contains=mailHeader,@mailLinks,mailSignature,@NoSpell "^\(\([a-z]\+>\|[]|}>]\)[ \t]*\)\{5}.*$"
68
 
syn match mailQuoted6   contains=mailHeader,@mailLinks,mailSignature,@NoSpell "^\(\([a-z]\+>\|[]|}>]\)[ \t]*\)\{6}.*$"
 
69
" Even and odd quoted lines. Order is important here!
 
70
syn region      mailQuoted6     keepend contains=mailVerbatim,mailHeader,@mailLinks,mailSignature,@NoSpell start="^\z(\(\([a-z]\+>\|[]|}>]\)[ \t]*\)\{5}\([a-z]\+>\|[]|}>]\)\)" end="^\z1\@!" fold
 
71
syn region      mailQuoted5     keepend contains=mailQuoted6,mailVerbatim,mailHeader,@mailLinks,mailSignature,@NoSpell start="^\z(\(\([a-z]\+>\|[]|}>]\)[ \t]*\)\{4}\([a-z]\+>\|[]|}>]\)\)" end="^\z1\@!" fold
 
72
syn region      mailQuoted4     keepend contains=mailQuoted5,mailQuoted6,mailVerbatim,mailHeader,@mailLinks,mailSignature,@NoSpell start="^\z(\(\([a-z]\+>\|[]|}>]\)[ \t]*\)\{3}\([a-z]\+>\|[]|}>]\)\)" end="^\z1\@!" fold
 
73
syn region      mailQuoted3     keepend contains=mailQuoted4,mailQuoted5,mailQuoted6,mailVerbatim,mailHeader,@mailLinks,mailSignature,@NoSpell start="^\z(\(\([a-z]\+>\|[]|}>]\)[ \t]*\)\{2}\([a-z]\+>\|[]|}>]\)\)" end="^\z1\@!" fold
 
74
syn region      mailQuoted2     keepend contains=mailQuoted3,mailQuoted4,mailQuoted5,mailQuoted6,mailVerbatim,mailHeader,@mailLinks,mailSignature,@NoSpell start="^\z(\(\([a-z]\+>\|[]|}>]\)[ \t]*\)\{1}\([a-z]\+>\|[]|}>]\)\)" end="^\z1\@!" fold
 
75
syn region      mailQuoted1     keepend contains=mailQuoted2,mailQuoted3,mailQuoted4,mailQuoted5,mailQuoted6,mailVerbatim,mailHeader,@mailLinks,mailSignature,@NoSpell start="^\z([a-z]\+>\|[]|}>]\)" end="^\z1\@!" fold
69
76
 
70
77
" Need to sync on the header. Assume we can do that within 100 lines
71
78
if exists("mail_minlines")
75
82
endif
76
83
 
77
84
" Define the default highlighting.
 
85
hi def link mailVerbatim        Special
78
86
hi def link mailHeader          Statement
79
87
hi def link mailHeaderKey       Type
80
88
hi def link mailSignature       PreProc