[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [msmtp-users] Vim syntax highlighting



Hi Eric!

On 23/08/11 02:32, Eric Pruitt wrote:
>> While comparing my current msmtp configuration to an old esmtprc file, I 
>> noticed that the msmtp color scheme was a bit drab. Attached are my changes to 
>> spruce things up a bit.

Thanks! I made a tiny change to allow '-' in hostnames (revised patch
attached).

Simon, as maintainer of this file, do you agree with this update?

Martin
diff --git a/scripts/vim/msmtp.vim b/scripts/vim/msmtp.vim
index a25cf56..dce76de 100644
--- a/scripts/vim/msmtp.vim
+++ b/scripts/vim/msmtp.vim
@@ -1,9 +1,10 @@
 " Vim syntax file
 " Language:     msmtp rc files
 " Maintainer:   Simon Ruderich <simon@...266...>
-" Last Change:  2008-08-23
+"               Eric Pruitt <eric.pruitt &amp; gmail.com>
+" Last Change:  2011-08-21
 " Filenames:    msmtprc
-" Version:      0.1
+" Version:      0.2
 
 
 if version < 600
@@ -25,7 +26,6 @@ syntax match msmtpOption /\<\(tls\|tls_trust_file\|tls_crl_file\|tls_fingerprint
 " Sendmail mode specific commands.
 syntax match msmtpOption /\<\(auto_from\|from\|maildomain\|dsn_notify\|dsn_return\|keepbcc\|logfile\|syslog\)\>/
 
-
 " Options which accept only an on/off value.
 syn match msmtpWrongOption /\<\(tls\|tls_certcheck\|tls_starttls\|tls_force_sslv3\|auto_from\|keepbcc\) \(on$\|off$\)\@!.*$/
 " Option port accepts numeric values.
@@ -45,8 +45,23 @@ syn match msmtpWrongOptionValue /\S* \zs.*$/ contained containedin=msmtpWrongOpt
 " Mark the option part as a normal option.
 highlight default link msmtpWrongOption msmtpOption
 
+"Email addresses (yanked from esmptrc)
+syntax match msmtpAddress /[a-z0-9_.-]*[a-z0-9]\+@[a-z0-9_.-]*[a-z0-9]\+\.[a-z]\+/
+" Host names
+syn match msmtpHost "\%(host\s*\)\@<=\h\%(\w\|\.\|-\)*"
+" Numeric values
+syn match msmtpNumber /\<\(\d\+$\)/
+"Strings
+syntax region msmtpString start=/"/ end=/"/
+syntax region msmtpString start=/'/ end=/'/
+
 highlight default link msmtpComment Comment
 highlight default link msmtpOption Type
 highlight default link msmtpWrongOptionValue Error
+highlight default link msmtpString String
+highlight default link msmtpAddress Constant
+highlight default link msmtpNumber Number
+highlight default link msmtpHost Identifier
+
 
 let b:current_syntax = "msmtp"