Skip to content

Instantly share code, notes, and snippets.

@jainvishal
Last active June 28, 2017 16:13
Show Gist options
  • Select an option

  • Save jainvishal/b061a59d37c85f5e2b282db8fcdbd6fe to your computer and use it in GitHub Desktop.

Select an option

Save jainvishal/b061a59d37c85f5e2b282db8fcdbd6fe to your computer and use it in GitHub Desktop.
Vim File Detection configuration for Log file and coloring
" Vim syntax file
" Language: My Log Processor
" Maintainer: Vishal Jain
" Latest Revision: 24 September 2014
if exists("b:current_syntax")
finish
endif
syn match String /="[^"]*"&/hs=s+1,he=e-1
syn match IndicatorStatus /^S .*$/
syn match IndicatorError /^E .*$/
syn match IndicatorFatal /^F .*$/
syn match IndicatorDebug /^D .*$/
hi def link IndicatorDebug Comment
hi def link IndicatorStatus Type
hi def link IndicatorError Error
hi def link IndicatorFatal Error
hi def link logTime Comment
hi def link String Error
" Convert unixtime to human readable time
function ConvertLog()
silent! %!perl -pe 'use POSIX 'strftime'; s@(\d{10})@strftime("\%F \%T", localtime($1)) ."."@e;'
endfunction
call ConvertLog()
let b:current_sytax="mylog"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment