mcabber/contrib/vim/mcabber_log-syntax.vim
changeset 1853 32bceb73895c
parent 1851 95b4373a57a4
child 2364 ca442ece1f70
equal deleted inserted replaced
1852:057b514b1f12 1853:32bceb73895c
       
     1 " Vim syntax file
       
     2 " Language:	MCabber log file
       
     3 " Maintainer:	Mikael BERTHE <mikael.berthe@lilotux.net>
       
     4 " URL:		Included in mcabber source package <http://mcabber.com>
       
     5 " Last Change:	2010-04-02
       
     6 
       
     7 " Save this file as ~/.vim/syntax/mcabber_log.vim
       
     8 " (and copy the ftdetect file as well)
       
     9 "
       
    10 " Logfile format:
       
    11 " TT YYYYmmddTHH:MM:SSZ nnn Text (this line and the nnn following lines)
       
    12 " TT is the data type
       
    13 " 'YYYYmmddTHH:MM:SSZ' is a timestamp
       
    14 "
       
    15 " XXX Please help me to improve this syntax script!
       
    16 
       
    17 if exists("b:current_syntax")
       
    18     finish
       
    19 endif
       
    20 
       
    21 " All lines (except text continuation lines) contain the date and nnn
       
    22 syn cluster mcabberlogEntry contains=mcabberlogDate,mcabberlognlines
       
    23 
       
    24 syn region mcabberlogStatusLine
       
    25     \ start="^S[OFDNAI_] \d\{8\}T\d\d:\d\d:\d\dZ \d\d\d "
       
    26     \ end="\(\_^[MS][RSIOFDNAI_] \d\{8}T.\{8}Z \d\d\d \|\%$\)\@="
       
    27     \ contains=mcabberlogStatus,@mcabberlogEntry
       
    28 
       
    29 syn region mcabberlogMessageLineInfo
       
    30     \ start="^MI \d\{8\}T\d\d:\d\d:\d\dZ \d\d\d "
       
    31     \ end="\(\_^[MS][RSIOFDNAI_] \d\{8}T.\{8}Z \d\d\d \|\%$\)\@="
       
    32     \ contains=mcabberlogMsgInfo,@mcabberlogEntry
       
    33 syn region mcabberlogMessageLineIn
       
    34     \ start="^MR \d\{8\}T\d\d:\d\d:\d\dZ \d\d\d "
       
    35     \ end="\(\_^[MS][RSIOFDNAI_] \d\{8}T.\{8}Z \d\d\d \|\%$\)\@="
       
    36     \ contains=mcabberlogMsgIn,@mcabberlogEntry
       
    37 syn region mcabberlogMessageLineOut
       
    38     \ start="^MS \d\{8\}T\d\d:\d\d:\d\dZ \d\d\d "
       
    39     \ end="\(\_^[MS][RSIOFDNAI_] \d\{8}T.\{8}Z \d\d\d \|\%$\)\@="
       
    40     \ contains=mcabberlogMsgOut,@mcabberlogEntry
       
    41 
       
    42 syn match mcabberlogDate "\d\{8\}T\d\d:\d\d:\d\dZ" contained
       
    43     \ contains=mcabberlogDateChar nextgroup=mcabberlognlines
       
    44 syn match mcabberlogDateChar /[TZ]/ contained
       
    45 
       
    46 syn match mcabberlogStatus "^S[OFDNAI_]"
       
    47     \ contained skipwhite nextgroup=@mcabberlogStatusLine
       
    48 syn match mcabberlogMsgIn "^MR" contained skipwhite
       
    49     \ nextgroup=@mcabberlogMessageLine
       
    50 syn match mcabberlogMsgOut "^MS" contained skipwhite
       
    51     \ nextgroup=@mcabberlogMessageLine
       
    52 syn match mcabberlogMsgInfo "^MI" contained skipwhite
       
    53     \ nextgroup=@mcabberlogMessageLine
       
    54 
       
    55 syn match mcabberlognlines "\<\d\{3\}\>" contained
       
    56 
       
    57 
       
    58 command -nargs=+ HiLink hi def link <args>
       
    59 
       
    60 HiLink mcabberlogStatus     PreProc
       
    61 
       
    62 HiLink mcabberlogMessageLineIn      Keyword
       
    63 HiLink mcabberlogMsgIn              Keyword
       
    64 
       
    65 HiLink mcabberlogMessageLineOut     Function
       
    66 HiLink mcabberlogMsgOut             Function
       
    67 
       
    68 HiLink mcabberlogMsgInfo            String
       
    69 HiLink mcabberlogMessageLineInfo    String
       
    70 
       
    71 HiLink mcabberlogDate       SpecialChar
       
    72 HiLink mcabberlogDateChar   Normal
       
    73 
       
    74 HiLink mcabberlognlines     Normal
       
    75 
       
    76 HiLink mcabberlogStatusLine Comment
       
    77 
       
    78 delcommand HiLink
       
    79 
       
    80 let b:current_syntax = "mcabber_log"