Skip to content

Instantly share code, notes, and snippets.

@pholat
Created January 18, 2022 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pholat/8eaedcfa9c64096a0d5d40bbdda82ce5 to your computer and use it in GitHub Desktop.
Save pholat/8eaedcfa9c64096a0d5d40bbdda82ce5 to your computer and use it in GitHub Desktop.
# add to .vimrc: `au BufRead,BufNewFile *.log set filetype=log` and open `.log` files with colors
if exists("b:current_syntax")
finish
endif
let b:current_syntax = "log"
syntax match EVT "event:"
" [ServiceBluetooth_w1] GAP.cpp:addNewDevice:181:
syn match serviceDesc '\[[a-zA-Z0-9_]*\]' nextgroup=fileDesc "contains=syntaxElement1 skipwhite
syn match fileDesc / [a-zA-Z]*\.[a-z]\{3\}:/ nextgroup=fooDesc "contains=syntaxElement1 nextgroup=syntaxElement2 skipwhite
syn match fooDesc /[a-zA-Z]*:/ nextgroup=lineDesc "contains=syntaxElement1 nextgroup=syntaxElement2 skipwhite
syn match lineDesc /[0-9]*:/ "contains=syntaxElement1 nextgroup=syntaxElement2 skipwhite
syn keyword ERROR ERROR
highlight EVT ctermfg=red cterm=bold
highlight serviceDesc ctermfg=darkblue cterm=bold
highlight fileDesc ctermfg=6
highlight fooDesc ctermfg=28
highlight lineDesc ctermfg=89
highlight ERROR ctermfg=darkred cterm=bold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment