summaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-02-21 13:36:25 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-02-21 13:36:25 +0100
commit901d5ea1be8c97cc461554253b63ea13a08fcdee (patch)
treee0fd7f77632f5e116c5cb40a21e1a5e02f4981e4 /src/rc
parentcf01f0ed7a5622d31ab030672313b7ad2ec32542 (diff)
Add mail.kak for mail file highlighting
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/mail.kak17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/rc/mail.kak b/src/rc/mail.kak
new file mode 100644
index 00000000..d0603fec
--- /dev/null
+++ b/src/rc/mail.kak
@@ -0,0 +1,17 @@
+hook global BufOpen .* %{ %sh{
+ mimetype="$(file -b --mime-type ${kak_bufname})"
+ if [[ "${mimetype}" == "message/rfc822" ]]; then
+ echo setb filetype mail;
+ fi
+} }
+
+hook global WinSetOption filetype=mail %~
+ addhl group mail-highlight
+ addhl -group mail-highlight regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
+ addhl -group mail-highlight regex <[^@>]+@.*?> 0:string
+ addhl -group mail-highlight regex ^>.*?$ 0:comment
+~
+
+hook global WinSetOption filetype=(?!mail).* %{
+ rmhl mail-highlight
+}