]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - vim/vim/syntax/msmtp.vim
vim: syntax/msmtp.vim: sync with msmtp.vim in Debian package
[config/dotfiles.git] / vim / vim / syntax / msmtp.vim
1 " Vim syntax file
2 " Language:     msmtp rc files
3 " Maintainer:   Simon Ruderich <simon@ruderich.com>
4 "               Eric Pruitt <eric.pruitt@gmail.com>
5 " Last Change:  2014-12-11
6 " Filenames:    msmtprc
7 " Version:      0.3
8
9
10 if version < 600
11   syntax clear
12 elseif exists("b:current_syntax")
13   finish
14 endif
15
16
17 " Comments.
18 syn match msmtpComment /#.*$/ contains=@Spell
19
20 " General commands.
21 syntax match msmtpOption /\<\(defaults\|account\|host\|port\|proxy_host\|proxy_port\|timeout\|protocol\|domain\)\>/
22 " Authentication commands.
23 syntax match msmtpOption /\<\(auth\|user\|password\|passwordeval\|ntlmdomain\)\>/
24 " TLS commands.
25 syntax match msmtpOption /\<\(tls\|tls_trust_file\|tls_crl_file\|tls_fingerprint\|tls_key_file\|tls_cert_file\|tls_certcheck\|tls_starttls\|tls_min_dh_prime_bits\|tls_priorities\)\>/
26 " Sendmail mode specific commands.
27 syntax match msmtpOption /\<\(auto_from\|from\|maildomain\|dsn_notify\|dsn_return\|add_missing_from_header\|add_missing_date_header\|remove_bcc_headers\|logfile\|syslog\)\>/
28
29 " Options which accept only an on/off value.
30 syn match msmtpWrongOption /\<\(tls\|tls_certcheck\|tls_starttls\|auto_from\|add_missing_from_header\|add_missing_date_header\|remove_bcc_headers\) \(on$\|off$\)\@!.*$/
31 " Option port accepts numeric values.
32 syn match msmtpWrongOption /\<\(port\|proxy_port\) \(\d\+$\)\@!.*$/
33 " Option timeout accepts off and numeric values.
34 syn match msmtpWrongOption /\<timeout \(off$\|\d\+$\)\@!.*$/
35 " Option protocol accepts smtp and lmtp.
36 syn match msmtpWrongOption /\<protocol \(smtp$\|lmtp$\)\@!.*$/
37 " Option auth accepts on, off and the method.
38 syn match msmtpWrongOption /\<auth \(on$\|off$\|plain$\|cram-md5$\|digest-md5$\|scram-sha-1$\|gssapi$\|external$\|login$\|ntlm$\)\@!.*$/
39 " Option auth accepts on, off and the facility.
40 syn match msmtpWrongOption /\<syslog \(on$\|off$\|LOG_USER$\|LOG_MAIL$\|LOG_LOCAL\d$\)\@!.*$/
41
42 " Marks all wrong option values as errors.
43 syn match msmtpWrongOptionValue /\S* \zs.*$/ contained containedin=msmtpWrongOption
44
45 " Mark the option part as a normal option.
46 highlight default link msmtpWrongOption msmtpOption
47
48 "Email addresses (yanked from esmptrc)
49 syntax match msmtpAddress /[a-z0-9_.-]*[a-z0-9]\+@[a-z0-9_.-]*[a-z0-9]\+\.[a-z]\+/
50 " Host names
51 syn match msmtpHost "\%(host\s*\)\@<=\h\%(\w\|\.\|-\)*"
52 " Numeric values
53 syn match msmtpNumber /\<\(\d\+$\)/
54 "Strings
55 syntax region msmtpString start=/"/ end=/"/
56 syntax region msmtpString start=/'/ end=/'/
57
58 highlight default link msmtpComment Comment
59 highlight default link msmtpOption Type
60 highlight default link msmtpWrongOptionValue Error
61 highlight default link msmtpString String
62 highlight default link msmtpAddress Constant
63 highlight default link msmtpNumber Number
64 highlight default link msmtpHost Identifier
65
66
67 let b:current_syntax = "msmtp"