From d681cb59d301334232851d7c1568554e33416404 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 15 Apr 2014 01:16:56 +0200 Subject: [PATCH] Add toml script, closes #20 --- build | 1 + ftdetect/polyglot.vim | 1 + syntax/toml.vim | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 syntax/toml.vim diff --git a/build b/build index 03d2a84..20fea26 100755 --- a/build +++ b/build @@ -113,6 +113,7 @@ PACKS=" tomdoc:duwanis/tomdoc.vim typescript:leafgarland/typescript-vim vbnet:vim-scripts/vbnet.vim + toml:cespare/vim-toml twig:beyondwords/vim-twig xls:vim-scripts/XSLT-syntax yard:sheerun/vim-yardoc diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 34e77b4..6be7b79 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -129,6 +129,7 @@ autocmd BufNewFile,BufReadPost *.styl set filetype=stylus autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus au BufRead,BufNewFile *.textile set filetype=textile autocmd BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux +autocmd BufNewFile,BufRead *.toml set filetype=toml autocmd BufNewFile,BufRead *.twig set filetype=twig autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript diff --git a/syntax/toml.vim b/syntax/toml.vim new file mode 100644 index 0000000..8be0b3f --- /dev/null +++ b/syntax/toml.vim @@ -0,0 +1,37 @@ +" Language: TOML +" Maintainer: Caleb Spare +" URL: http://github.com/cespare/vim-toml +" LICENSE: MIT + +if exists("b:current_syntax") + finish +endif + +syn match tomlEscape /\\[0tnr"\\]/ display +hi def link tomlEscape SpecialChar + +syn region tomlString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=tomlEscape +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 + +syn match tomlKeyGroup /^\s*\[.\+\]\s*\(#.*\)\?$/ contains=tomlComment +hi def link tomlKeyGroup Identifier + +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"