Merge commit '7155f902e2a447163af57e9f7584417da30aba5b' as 'vim/bundle/toml'
commit
e49f5eb233
@ -0,0 +1,22 @@
|
|||||||
|
Copyright (c) 2013 Caleb Spare
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -0,0 +1,17 @@
|
|||||||
|
# vim-toml
|
||||||
|
|
||||||
|
Vim syntax for [TOML](https://github.com/toml-lang/toml).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Pathogen
|
||||||
|
|
||||||
|
Set up [Pathogen](https://github.com/tpope/vim-pathogen) then clone/submodule this repo into `~/.vim/bundle/toml`, or wherever you've pointed your Pathogen.
|
||||||
|
|
||||||
|
### Vundle
|
||||||
|
|
||||||
|
Set up [Vundle](https://github.com/gmarik/Vundle.vim) then add `Bundle 'cespare/vim-toml'` to your vimrc and run `:BundleInstall` from a fresh vim.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions are very welcome! Just open a PR.
|
@ -0,0 +1,4 @@
|
|||||||
|
autocmd BufNewFile,BufRead *.toml set filetype=toml
|
||||||
|
|
||||||
|
" Rust uses Cargo.toml and Cargo.lock (both are toml files).
|
||||||
|
autocmd BufNewFile,BufRead Cargo.lock set filetype=toml
|
@ -0,0 +1,37 @@
|
|||||||
|
" File: ftplugin/toml.vim
|
||||||
|
" Author: Kevin Ballard <kevin@sb.org>
|
||||||
|
" Description: FileType Plugin for Toml
|
||||||
|
" Last Change: Dec 09, 2014
|
||||||
|
|
||||||
|
if exists('b:did_ftplugin')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
|
||||||
|
" Add NERDCommenter delimiters
|
||||||
|
|
||||||
|
let s:delims = { 'left': '#' }
|
||||||
|
if exists('g:NERDDelimiterMap')
|
||||||
|
if !has_key(g:NERDDelimiterMap, 'toml')
|
||||||
|
let g:NERDDelimiterMap.toml = s:delims
|
||||||
|
endif
|
||||||
|
elseif exists('g:NERDCustomDelimiters')
|
||||||
|
if !has_key(g:NERDCustomDelimiters, 'toml')
|
||||||
|
let g:NERDCustomDelimiters.toml = s:delims
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let g:NERDCustomDelimiters = { 'toml': s:delims }
|
||||||
|
endif
|
||||||
|
unlet s:delims
|
||||||
|
|
||||||
|
let b:undo_ftplugin = ""
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
" vim: set et sw=4 ts=4:
|
@ -0,0 +1,54 @@
|
|||||||
|
" Language: TOML
|
||||||
|
" Maintainer: Caleb Spare <cespare@gmail.com>
|
||||||
|
" URL: https://github.com/cespare/vim-toml
|
||||||
|
" LICENSE: MIT
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn match tomlEscape /\\[btnfr"/\\]/ display contained
|
||||||
|
syn match tomlEscape /\\u\x\{4}/ contained
|
||||||
|
syn match tomlEscape /\\U\x\{8}/ contained
|
||||||
|
hi def link tomlEscape SpecialChar
|
||||||
|
|
||||||
|
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=/'''/
|
||||||
|
hi def link tomlString String
|
||||||
|
|
||||||
|
syn match tomlInteger /\<[+-]\=[0-9]\(_\=\d\)*\>/ display
|
||||||
|
hi def link tomlInteger Number
|
||||||
|
|
||||||
|
syn match tomlFloat /\<[+-]\=[0-9]\(_\=\d\)*\.\d\+\>/ display
|
||||||
|
syn match tomlFloat /\<[+-]\=[0-9]\(_\=\d\)*\(\.[0-9]\(_\=\d\)*\)\=[eE][+-]\=[0-9]\(_\=\d\)*\>/ display
|
||||||
|
hi def link tomlFloat Float
|
||||||
|
|
||||||
|
syn match tomlBoolean /\<\%(true\|false\)\>/ display
|
||||||
|
hi def link tomlBoolean Boolean
|
||||||
|
|
||||||
|
" https://tools.ietf.org/html/rfc3339
|
||||||
|
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}T\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)/ display
|
||||||
|
hi def link tomlDate Constant
|
||||||
|
|
||||||
|
syn match tomlTable /^\s*\[[^#\[\]]\+\]\s*\(#.*\)\?$/ contains=tomlComment
|
||||||
|
hi def link tomlTable Identifier
|
||||||
|
|
||||||
|
syn match tomlTableArray /^\s*\[\[[^#\[\]]\+\]\]\s*\(#.*\)\?$/ contains=tomlComment
|
||||||
|
hi def link tomlTableArray 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"
|
Loading…
Reference in New Issue