kakoune

Fork of kakoune, an acceptable text editor
git clone git://git.laack.co/kakoune.git
Log | Files | Refs

mail.kak (998B)


      1 hook global BufCreate .+\.eml %{
      2     set-option buffer filetype mail
      3 }
      4 
      5 hook global WinSetOption filetype=mail %{
      6     require-module mail
      7     map buffer normal <ret> :diff-jump<ret>
      8     hook -once -always window WinSetOption filetype=.* %{
      9         unmap buffer normal <ret> :diff-jump<ret>
     10     }
     11 }
     12 
     13 hook -group mail-highlight global WinSetOption filetype=mail %{
     14     add-highlighter window/mail ref mail
     15     hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/mail }
     16 }
     17 
     18 
     19 provide-module mail %{
     20 
     21 require-module diff
     22 
     23 add-highlighter shared/mail group
     24 add-highlighter shared/mail/ ref diff
     25 add-highlighter shared/mail/ regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To|References|Date|Message-Id|User-Agent):(\N*(?:\n\h+\N+)*)$ 1:keyword 2:attribute
     26 add-highlighter shared/mail/ regex <[a-zA-Z0-9!#$%&'*+/=?^`{|}~.-]+@[a-zA-Z0-9!#$%&'*+/=?^`{|}~.-]+> 0:string
     27 add-highlighter shared/mail/ regex ^>.*?$ 0:comment
     28 add-highlighter shared/mail/ regex ^--\ \n.* 0:comment
     29 
     30 }