add bundle for vim-toml for TOML type
In .vimrc, turn on rustfmt_autosave, add options for json, toml, yaml file types, and remove unnecessary bundles. Add a new bundle for the toml file type.
This commit is contained in:
parent
be7814ad16
commit
1f3ad4ba84
6 changed files with 137 additions and 22 deletions
22
.vim/bundle/vim-toml/LICENSE
Normal file
22
.vim/bundle/vim-toml/LICENSE
Normal file
|
@ -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.
|
17
.vim/bundle/vim-toml/README.md
Normal file
17
.vim/bundle/vim-toml/README.md
Normal file
|
@ -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/VundleVim/Vundle.vim) then add `Plugin 'cespare/vim-toml'` to your vimrc and run `:PluginInstall` from a fresh vim.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions are very welcome! Just open a PR.
|
2
.vim/bundle/vim-toml/ftdetect/toml.vim
Normal file
2
.vim/bundle/vim-toml/ftdetect/toml.vim
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
" Rust uses several TOML config files that are not named with .toml.
|
||||||
|
autocmd BufNewFile,BufRead *.toml,Cargo.lock,*/.cargo/config set filetype=toml
|
37
.vim/bundle/vim-toml/ftplugin/toml.vim
Normal file
37
.vim/bundle/vim-toml/ftplugin/toml.vim
Normal file
|
@ -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:
|
54
.vim/bundle/vim-toml/syntax/toml.vim
Normal file
54
.vim/bundle/vim-toml/syntax/toml.vim
Normal file
|
@ -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"
|
27
.vimrc
27
.vimrc
|
@ -84,17 +84,18 @@ augroup cfile
|
||||||
autocmd BufRead,BufNewFile */systemd*/*.{c,h,cpp,hx} set tabstop=8|set shiftwidth=8
|
autocmd BufRead,BufNewFile */systemd*/*.{c,h,cpp,hx} set tabstop=8|set shiftwidth=8
|
||||||
" qemu source files
|
" qemu source files
|
||||||
autocmd BufRead,BufNewFile */qemu*/*.{c,h,cpp,hx} set tabstop=4|set shiftwidth=4
|
autocmd BufRead,BufNewFile */qemu*/*.{c,h,cpp,hx} set tabstop=4|set shiftwidth=4
|
||||||
" dbndns source files
|
|
||||||
autocmd BufRead,BufNewFile */dbndns*/*.{c,h,cpp,hx} set tabstop=8|set shiftwidth=2
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
autocmd FileType diff set noexpandtab|set tabstop=8|set shiftwidth=8|set autoindent|set smartindent
|
||||||
autocmd FileType html set isk+=:,/,~
|
autocmd FileType html set isk+=:,/,~
|
||||||
autocmd FileType java set expandtab|set autoindent|set smartindent
|
autocmd FileType java set expandtab|set autoindent|set smartindent
|
||||||
|
autocmd FileType json set expandtab|set tabstop=2|set shiftwidth=2|set autoindent|set smartindent
|
||||||
autocmd FileType make set noexpandtab|set tabstop=8|set shiftwidth=8|set autoindent|set smartindent
|
autocmd FileType make set noexpandtab|set tabstop=8|set shiftwidth=8|set autoindent|set smartindent
|
||||||
autocmd FileType perl set expandtab|set autoindent|set nosmartindent
|
autocmd FileType perl set expandtab|set autoindent|set nosmartindent
|
||||||
autocmd FileType python set expandtab|set autoindent|set nosmartindent
|
autocmd FileType python set expandtab|set autoindent|set nosmartindent
|
||||||
autocmd FileType ruby set expandtab|set autoindent|set nosmartindent
|
autocmd FileType ruby set expandtab|set autoindent|set nosmartindent
|
||||||
autocmd FileType diff set noexpandtab|set tabstop=8|set shiftwidth=8|set autoindent|set smartindent
|
autocmd FileType toml set expandtab|set tabstop=2|set shiftwidth=2|set autoindent|set smartindent
|
||||||
|
autocmd FileType yaml set expandtab|set tabstop=2|set shiftwidth=2|set autoindent|set smartindent
|
||||||
|
|
||||||
" ==============
|
" ==============
|
||||||
" Autocommands Group
|
" Autocommands Group
|
||||||
|
@ -198,24 +199,6 @@ if filereadable(FTFILE)
|
||||||
source FTFILE
|
source FTFILE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" ======================
|
|
||||||
" Universal Text Linking
|
|
||||||
" ======================
|
|
||||||
|
|
||||||
let UTLFILE="~/.vim/plugin/utl.vim"
|
|
||||||
if filereadable(UTLFILE)
|
|
||||||
source UTLFILE
|
|
||||||
endif
|
|
||||||
|
|
||||||
" ======================
|
|
||||||
" VimIM
|
|
||||||
" ======================
|
|
||||||
|
|
||||||
let VIMIMFILE="~/.vim/plugin/vimim.vim"
|
|
||||||
if filereadable(VIMIMFILE)
|
|
||||||
source VIMIMFILE
|
|
||||||
endif
|
|
||||||
|
|
||||||
" ======================
|
" ======================
|
||||||
" Vim plug
|
" Vim plug
|
||||||
" ======================
|
" ======================
|
||||||
|
@ -270,7 +253,7 @@ let g:syntastic_go_checkers = 1
|
||||||
" ======================
|
" ======================
|
||||||
" rust
|
" rust
|
||||||
" ======================
|
" ======================
|
||||||
let g:rustfmt_autosave = 0
|
let g:rustfmt_autosave = 1
|
||||||
|
|
||||||
set hidden
|
set hidden
|
||||||
let g:racer_cmd = '~/.cargo/bin/racer'
|
let g:racer_cmd = '~/.cargo/bin/racer'
|
||||||
|
|
Loading…
Add table
Reference in a new issue