Bram Moolenaar | 4466ad6 | 2020-11-21 13:16:30 +0100 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Protobuf Text Format |
| 3 | " Maintainer: Lakshay Garg <lakshayg@outlook.in> |
| 4 | " Last Change: 2020 Nov 17 |
| 5 | " Homepage: https://github.com/lakshayg/vim-pbtxt |
| 6 | |
| 7 | if exists("b:current_syntax") |
| 8 | finish |
| 9 | endif |
| 10 | |
| 11 | let s:cpo_save = &cpo |
| 12 | set cpo&vim |
| 13 | |
| 14 | syn case ignore |
| 15 | |
| 16 | syn keyword pbtxtTodo TODO FIXME contained |
| 17 | syn keyword pbtxtBool true false contained |
| 18 | |
| 19 | syn match pbtxtInt display "\<\(0\|[1-9]\d*\)\>" |
| 20 | syn match pbtxtHex display "\<0[xX]\x\+\>" |
| 21 | syn match pbtxtFloat display "\(0\|[1-9]\d*\)\=\.\d*" |
| 22 | syn match pbtxtMessage display "^\s*\w\+\s*{"me=e-1 |
| 23 | syn match pbtxtField display "^\s*\w\+:"me=e-1 |
| 24 | syn match pbtxtEnum display ":\s*\a\w\+"ms=s+1 contains=pbtxtBool |
| 25 | syn region pbtxtString start=+"+ skip=+\\"+ end=+"+ contains=@Spell |
| 26 | syn region pbtxtComment start="#" end="$" keepend contains=pbtxtTodo,@Spell |
| 27 | |
| 28 | hi def link pbtxtTodo Todo |
| 29 | hi def link pbtxtBool Boolean |
| 30 | hi def link pbtxtInt Number |
| 31 | hi def link pbtxtHex Number |
| 32 | hi def link pbtxtFloat Float |
| 33 | hi def link pbtxtMessage Structure |
| 34 | hi def link pbtxtField Identifier |
| 35 | hi def link pbtxtEnum Define |
| 36 | hi def link pbtxtString String |
| 37 | hi def link pbtxtComment Comment |
| 38 | |
| 39 | let b:current_syntax = "pbtxt" |
| 40 | |
| 41 | let &cpo = s:cpo_save |
| 42 | unlet s:cpo_save |
| 43 | |
| 44 | " vim: nowrap sw=2 sts=2 ts=8 noet |