1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-24 20:13:00 +03:00

Add mail.kak for mail file highlighting

This commit is contained in:
Maxime Coste 2013-02-21 13:36:25 +01:00
parent cf01f0ed7a
commit 901d5ea1be
2 changed files with 18 additions and 1 deletions

View File

@ -23,6 +23,6 @@ XDG_CONFIG_HOME ?= $(HOME)/.config
userconfig:
mkdir -p $(XDG_CONFIG_HOME)/kak/autoload
ln -s $(CURDIR)/rc/{asciidoc,client,cpp,diff,git,grep,kakrc,make,sh}.kak $(XDG_CONFIG_HOME)/kak/autoload/
ln -s $(CURDIR)/rc/{asciidoc,client,cpp,diff,git,grep,kakrc,make,sh,mail}.kak $(XDG_CONFIG_HOME)/kak/autoload/
.PHONY: tags userconfig

17
src/rc/mail.kak Normal file
View File

@ -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
}