vim-polyglot/syntax/toml.vim

53 lines
1.5 KiB
VimL
Raw Normal View History

2014-04-14 19:16:56 -04:00
" Language: TOML
" Maintainer: Caleb Spare <cespare@gmail.com>
" URL: http://github.com/cespare/vim-toml
" LICENSE: MIT
if exists("b:current_syntax")
finish
endif
2014-11-10 20:37:21 -05:00
syn match tomlEscape /\\[btnfr"/\\]/ display contained
syn match tomlEscape /\\u\x\{4}/ contained
syn match tomlEscape /\\U\x\{8}/ contained
2014-04-14 19:16:56 -04:00
hi def link tomlEscape SpecialChar
2014-11-10 20:37:21 -05:00
syn match tomlLineEscape /\\$/ contained
hi def link tomlLineEscape SpecialChar
" Basic strings
syn region tomlString oneline start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=tomlEscape
" Multi-line basic strings
syn region tomlString start=/"""/ end=/"""/ contains=tomlEscape,tomlLineEscape
" Literal strings
syn region tomlString oneline start=/'/ end=/'/
" Multi-line literal strings
syn region tomlString start=/'''/ end=/'''/
2014-04-14 19:16:56 -04:00
hi def link tomlString String
syn match tomlInteger /\<-\?\d\+\>/ display
hi def link tomlInteger Number
syn match tomlFloat /\<-\?\d\+\.\d\+\>/ display
hi def link tomlFloat Float
syn match tomlBoolean /\<\%(true\|false\)\>/ display
hi def link tomlBoolean Boolean
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}T\d\{2\}:\d\{2\}:\d\{2\}Z/ display
hi def link tomlDate Constant
2014-11-10 20:37:21 -05:00
syn match tomlTable /^\s*\[[^#\[\]]\+\]\s*\(#.*\)\?$/ contains=tomlComment
hi def link tomlTable Identifier
syn match tomlTableArray /^\s*\[\[[^#\[\]]\+\]\]\s*\(#.*\)\?$/ contains=tomlComment
hi def link tomlTableArray Identifier
2014-04-14 19:16:56 -04:00
syn keyword tomlTodo TODO FIXME XXX BUG contained
hi def link tomlTodo Todo
syn match tomlComment /#.*/ contains=@Spell,tomlTodo
hi def link tomlComment Comment
let b:current_syntax = "toml"