diff options
| author | Christopher Kenna <cjk@cs.unc.edu> | 2012-10-04 10:57:11 -0400 |
|---|---|---|
| committer | Christopher Kenna <cjk@cs.unc.edu> | 2012-10-04 10:57:11 -0400 |
| commit | 222f82fa0ce89acbe47cc5b0f57ec470dfc9faaf (patch) | |
| tree | 53230be8311987d447b0f4bf7742445f1414abe7 | |
| parent | db7cf81a503f637eb85e2dfe63e515252d22a2ba (diff) | |
Add VIM LITMUS^RT log syntax highlighting.
| -rw-r--r-- | slog.vim | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/slog.vim b/slog.vim new file mode 100644 index 0000000..557e115 --- /dev/null +++ b/slog.vim | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | " .vim/syntax/slog.vim | ||
| 2 | |||
| 3 | " Also add this line to your .vimrc | ||
| 4 | " autocmd BufRead,BufNewFile *.slog set filetype=slog | ||
| 5 | |||
| 6 | " Match on the sequence number at the start of the line. | ||
| 7 | " Sequence number is always in the log. | ||
| 8 | :syn match logSeqNo /^\d\+/ nextgroup=logProcessorNo skipwhite | ||
| 9 | |||
| 10 | " Match on the processor number. | ||
| 11 | " This is always in the log, but what comes next varies. | ||
| 12 | :syn match logProcessorNo /P\d\+/ nextgroup=logFunctInfo,logProcessInfo skipwhite | ||
| 13 | |||
| 14 | " Match on the function info, e.g. [reclaim_pages@litmus/color.c:203]: | ||
| 15 | " It contains function, file, and line. | ||
| 16 | :syn match logFunctInfo "\[[^\]]*\]" contains=logFunction,logFile,logLineNo nextgroup=logProcessInfo skipwhite | ||
| 17 | " Don't highlight the bracket or @ sign | ||
| 18 | :syn match logFunction "\[\w\+@"hs=s+1,he=e-1 contained nextgroup=logFile | ||
| 19 | :syn match logFile "[A-Za-z0-9_./]\+:"he=e-1 contained nextgroup=logLineNo | ||
| 20 | :syn match logLineNo "\d\+]"he=e-1 contained | ||
| 21 | |||
| 22 | :syn match logProcessInfo "([^)]*)" contains=logProcess,logPid,logJob skipwhite | ||
| 23 | :syn match logProcess "([^/]*/"hs=s+1,he=e-1 contained nextgroup=logPid | ||
| 24 | :syn match logPid "\d\+:"he=e-1 contained nextgroup=logJob | ||
| 25 | :syn match logJob "\d\+)"he=e-1 contained | ||
| 26 | |||
| 27 | " Now make them appear: | ||
| 28 | hi def link logSeqNo Constant | ||
| 29 | hi def link logProcessorNo Todo | ||
| 30 | hi def link logFunction String | ||
| 31 | hi def link logFile Comment | ||
| 32 | hi def link logLineNo Number | ||
| 33 | hi def link logProcess Comment | ||
| 34 | hi def link logPid Constant | ||
| 35 | hi def link logJob Number | ||
| 36 | |||
| 37 | let b:current_syntax = "slog" | ||
