Vim syntax: \s+ instead of space
Closed this issue · 1 comments
Deleted user commented
When I do alignment using spaces syntax shows errors. Tab alignment is fine. Not fair. :)
Not sure about current solution. But simplest one just replace spaces with \s+
.
diff --git a/mpop.vim b/mpop.vim
index 42658787..9ea86d45 100644
--- a/mpop.vim
+++ b/mpop.vim
@@ -27,15 +27,15 @@ syntax match mpopOption /\<\(tls\|tls_starttls\|tls_trust_file\|tls_crl_file\|tl
syntax match mpopOption /\<\(only_new\|keep\|killsize\|skipsize\|filter\|received_header\)\>/
" Options which accept only an on/off value.
-syn match mpopWrongOption /\<\(tls\|tls_starttls\|tls_certcheck\|only_new\|keep\|received_header\) \(on$\|off$\)\@!.*$/
+syn match mpopWrongOption /\<\(tls\|tls_starttls\|tls_certcheck\|only_new\|keep\|received_header\)\s+\(on$\|off$\)\@!.*$/
" Options which accept only an on/off/auto value.
-syn match mpopWrongOption /\<\(pipelining\) \(on$\|off$\|auto$\)\@!.*$/
+syn match mpopWrongOption /\<\(pipelining\)\s+\(on$\|off$\|auto$\)\@!.*$/
" Options which accept numeric values.
-syn match mpopWrongOption /\<\(port\|proxy_port\|killsize\|skipsize\) \(\d\+$\)\@!.*$/
+syn match mpopWrongOption /\<\(port\|proxy_port\|killsize\|skipsize\)\s+\(\d\+$\)\@!.*$/
" Option timeout accepts off and numeric values.
-syn match mpopWrongOption /\<timeout \(off$\|\d\+$\)\@!.*$/
+syn match mpopWrongOption /\<timeout\s+\(off$\|\d\+$\)\@!.*$/
" Option auth accepts on, off and the method.
-syn match mpopWrongOption /\<auth \(on$\|off$\|user$\|plain$\|cram-md5$\|digest-md5$\|scram-sha-1$\|scram-sha-256$\|gssapi$\|external$\|login$\|ntlm$\|oauthbearer\|xoauth2\)\@!.*$/
+syn match mpopWrongOption /\<auth\s+\(on$\|off$\|user$\|plain$\|cram-md5$\|digest-md5$\|scram-sha-1$\|scram-sha-256$\|gssapi$\|external$\|login$\|ntlm$\|oauthbearer\|xoauth2\)\@!.*$/
" Marks all wrong option values as errors.
syn match mpopWrongOptionValue /\S* \zs.*$/ contained containedin=mpopWrongOption
diff --git a/msmtp.vim b/msmtp.vim
index a1cd2fc6..110736c3 100644
--- a/msmtp.vim
+++ b/msmtp.vim
@@ -27,13 +27,13 @@ syntax match msmtpOption /\<\(tls\|tls_starttls\|tls_trust_file\|tls_crl_file\|t
syntax match msmtpOption /\<\(from\|from_full_name\|allow_from_override\|dsn_notify\|dsn_return\|set_from_header\|set_date_header\|set_msgid_header\|remove_bcc_headers\|undisclosed_recipients\|logfile\|logfile_time_format\|syslog\|aliases\|auto_from\|maildomain\)\>/
" Options which accept only an on/off value.
-syn match msmtpWrongOption /\<\(tls\|tls_starttls\|tls_certcheck\|allow_from_override\|remove_bcc_headers\|undisclosed_recipients\|auto_from\) \(on$\|off$\)\@!.*$/
+syn match msmtpWrongOption /\<\(tls\|tls_starttls\|tls_certcheck\|allow_from_override\|remove_bcc_headers\|undisclosed_recipients\|auto_from\)\s+\(on$\|off$\)\@!.*$/
" Options which accept only an on/off/auto value.
-syn match msmtpWrongOption /\<\(set_from_header\) \(on$\|off$\|auto$\)\@!.*$/
+syn match msmtpWrongOption /\<\(set_from_header\)\s+\(on$\|off$\|auto$\)\@!.*$/
" Options which accept only an off/auto value.
-syn match msmtpWrongOption /\<\(set_date_header\|set_msgid_header\) \(auto$\|off$\)\@!.*$/
+syn match msmtpWrongOption /\<\(set_date_header\|set_msgid_header\)\s+\(auto$\|off$\)\@!.*$/
" Option port accepts numeric values.
-syn match msmtpWrongOption /\<\(port\|proxy_port\) \(\d\+$\)\@!.*$/
+syn match msmtpWrongOption /\<\(port\|proxy_port\)\s+\(\d\+$\)\@!.*$/
" Option timeout accepts off and numeric values.
syn match msmtpWrongOption /\<timeout \(off$\|\d\+$\)\@!.*$/
" Option protocol accepts smtp and lmtp.
marlam commented
Thanks for spotting this! Fixed in both mpop and msmtp.