-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslog.vim
37 lines (30 loc) · 1.42 KB
/
slog.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
" .vim/syntax/slog.vim
" Also add this line to your .vimrc
" autocmd BufRead,BufNewFile *.slog set filetype=slog
" Match on the sequence number at the start of the line.
" Sequence number is always in the log.
:syn match logSeqNo /^\d\+/ nextgroup=logProcessorNo skipwhite
" Match on the processor number.
" This is always in the log, but what comes next varies.
:syn match logProcessorNo /P\d\+/ nextgroup=logFunctInfo,logProcessInfo skipwhite
" Match on the function info, e.g. [reclaim_pages@litmus/color.c:203]:
" It contains function, file, and line.
:syn match logFunctInfo "\[[^\]]*\]" contains=logFunction,logFile,logLineNo nextgroup=logProcessInfo skipwhite
" Don't highlight the bracket or @ sign
:syn match logFunction "\[\w\+@"hs=s+1,he=e-1 contained nextgroup=logFile
:syn match logFile "[A-Za-z0-9_./]\+:"he=e-1 contained nextgroup=logLineNo
:syn match logLineNo "\d\+]"he=e-1 contained
:syn match logProcessInfo "([^)]*)" contains=logProcess,logPid,logJob skipwhite
:syn match logProcess "([^/]*/"hs=s+1,he=e-1 contained nextgroup=logPid
:syn match logPid "\d\+:"he=e-1 contained nextgroup=logJob
:syn match logJob "\d\+)"he=e-1 contained
" Now make them appear:
hi def link logSeqNo Constant
hi def link logProcessorNo Todo
hi def link logFunction String
hi def link logFile Comment
hi def link logLineNo Number
hi def link logProcess Comment
hi def link logPid Constant
hi def link logJob Number
let b:current_syntax = "slog"