changeset 1851:95b4373a57a4

Add Vim color syntax file
author Mikael Berthe <mikael@lilotux.net>
date Thu, 01 Apr 2010 21:08:07 +0200
parents 8d7810f529db
children 057b514b1f12
files mcabber/ChangeLog mcabber/contrib/mcabber_log.vim
diffstat 2 files changed, 78 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/ChangeLog	Thu Apr 01 19:33:23 2010 +0200
+++ b/mcabber/ChangeLog	Thu Apr 01 21:08:07 2010 +0200
@@ -27,6 +27,7 @@
  * Obsolete option 'hide_offline_buddies' has been removed
  * Obsolete XEP-0022 (Message Events) is now disabled by default
  * No suffix is displayed in the status bar after the 'info' value
+ * Add Vim syntax file for mcabber history log files to contrib
 
  -- Mikael, ?
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mcabber/contrib/mcabber_log.vim	Thu Apr 01 21:08:07 2010 +0200
@@ -0,0 +1,77 @@
+" Vim syntax file
+" Language:	MCabber log file
+" Maintainer:	Mikael BERTHE <mikael.berthe@lilotux.net>
+" URL:		Included in mcabber source package <http://mcabber.com>
+" Last Change:	2010-04-01
+
+" Place this file as ~/.vim/syntax/mcabber_log.vim
+" and add the following line to ~/.vimrc
+"
+" au BufRead  */.mcabber/histo/* setfiletype mcabber_log
+"
+" Logfile format:
+" TT YYYYmmddTHH:MM:SSZ nnn Text (this line and the nnn following lines)
+" TT is the data type
+" 'YYYYmmddTHH:MM:SSZ' is a timestamp
+"
+" XXX Please help me to improve this syntax script!
+
+if exists("b:current_syntax")
+    finish
+endif
+
+syn cluster mcabberlogStatEntry contains=mcabberlogStatus,mcabberlogDate
+syn cluster mcabberlogMsgEntry contains=mcabberlogMsgIn,mcabberlogMsgOut,mcabberlogDate
+
+syn region mcabberlogStatusLine
+    \ start="^S[OFDNAI_] \d\{8\}T\d\d:\d\d:\d\dZ \(\d\{3\}\) "
+    \ end="\(\_^[MS][RSIOFDNAI_] \d\{8}T.\{8}Z \d\{3} \|\%$\)\@="
+    \ contains=mcabberlogStatus,mcabberlogDate,mcabberlognlines
+syn region mcabberlogMessageLineInfo
+    \ start="^MI \d\{8\}T\d\d:\d\d:\d\dZ \(\d\{3\}\) "
+    \ end="\(\_^[MS][RSIOFDNAI_] \d\{8}T.\{8}Z \d\{3} \|\%$\)\@="
+    \ contains=mcabberlogMsgInfo,mcabberlogDate,mcabberlognlines
+syn region mcabberlogMessageLineIn
+    \ start="^MR \d\{8\}T\d\d:\d\d:\d\dZ \(\d\{3\}\) "
+    \ end="\(\_^[MS][RSIOFDNAI_] \d\{8}T.\{8}Z \d\{3} \|\%$\)\@="
+    \ contains=mcabberlogMsgIn,mcabberlogDate,mcabberlognlines
+
+syn region mcabberlogMessageLineOut
+    \ start="^MS \d\{8\}T\d\d:\d\d:\d\dZ \(\d\{3\}\) "
+    \ end="\(\_^[MS][RSIOFDNAI_] \d\{8}T.\{8}Z \d\{3} \|\%$\)\@="
+    \ contains=mcabberlogMsgOut,mcabberlogDate,mcabberlognlines
+
+syn match mcabberlogDate /\d\{8\}T\d\d:\d\d:\d\dZ/ contained contains=mcabberlogDateChar nextgroup=mcabberlognlines
+syn match mcabberlogDateChar /[TZ]/ contained
+
+syn match mcabberlogStatus /^S[OFDNAI_]/ contained skipwhite nextgroup=@mcabberlogStatusLine
+syn match mcabberlogMsgIn /^MR/ contained skipwhite nextgroup=@mcabberlogMessageLine
+syn match mcabberlogMsgOut /^MS/ contained skipwhite nextgroup=@mcabberlogMessageLine
+syn match mcabberlogMsgInfo /^MI/ contained skipwhite nextgroup=@mcabberlogMessageLine
+
+syn match mcabberlognlines /\<\d\{3\}\>/ contained
+
+
+command -nargs=+ HiLink hi def link <args>
+
+HiLink mcabberlogStatus     PreProc
+
+HiLink mcabberlogMessageLineIn      Keyword
+HiLink mcabberlogMsgIn              Keyword
+
+HiLink mcabberlogMessageLineOut     Function
+HiLink mcabberlogMsgOut             Function
+
+HiLink mcabberlogMsgInfo            String
+HiLink mcabberlogMessageLineInfo    String
+
+HiLink mcabberlogDate       SpecialChar
+HiLink mcabberlogDateChar   Normal
+
+HiLink mcabberlognlines     Normal
+
+HiLink mcabberlogStatusLine Comment
+
+delcommand HiLink
+
+let b:current_syntax = "mcabber_log"