diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2015-12-31 18:34:53 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2015-12-31 18:34:53 +0100 |
commit | f8a0fb37bf57fdf705747cc3aacbe50b6b2d6482 (patch) | |
tree | 186ac68e30d47f2acfab552620001f5d2887e5bf | |
parent | 13fe6ad75841ac9e4aeffb4d62fb6a491011cbce (diff) | |
download | vim-polyglot-f8a0fb37bf57fdf705747cc3aacbe50b6b2d6482.tar.gz vim-polyglot-f8a0fb37bf57fdf705747cc3aacbe50b6b2d6482.zip |
Add better yaml syntax, closes #99v2.6.0
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | after/ftplugin/yaml.vim | 11 | ||||
-rw-r--r-- | after/syntax/yaml.vim | 64 | ||||
-rwxr-xr-x | build | 1 |
4 files changed, 77 insertions, 0 deletions
@@ -102,6 +102,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo - [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax, ftdetect) - [vm](https://github.com/lepture/vim-velocity) (syntax, indent, ftdetect) - [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax) +- [yaml](https://github.com/stephpy/vim-yaml) (syntax, ftplugin) - [yard](https://github.com/sheerun/vim-yardoc) (syntax) ## Disabling a language pack diff --git a/after/ftplugin/yaml.vim b/after/ftplugin/yaml.vim new file mode 100644 index 00000000..047641dc --- /dev/null +++ b/after/ftplugin/yaml.vim @@ -0,0 +1,11 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yaml') == -1 + +" Vim indent file +" Language: Yaml +" Author: Henrique Barcelos +" Date: 2014-10-08 +" URL: https://github.com/hjpbarcelos +setlocal autoindent sw=2 ts=2 expandtab +" vim:set sw=2: + +endif diff --git a/after/syntax/yaml.vim b/after/syntax/yaml.vim new file mode 100644 index 00000000..57d9a234 --- /dev/null +++ b/after/syntax/yaml.vim @@ -0,0 +1,64 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yaml') == -1 + +" To make this file do stuff, add something like the following (without the +" leading ") to your ~/.vimrc: +" au BufNewFile,BufRead *.yaml,*.yml so ~/src/PyYaml/YAML.vim + +" Vim syntax/macro file +" Language: YAML +" Author: Igor Vergeichik <iverg@mail.ru> +" Sponsor: Tom Sawyer <transami@transami.net> +" Stayven: Ryan King <jking@panoptic.com> +" Copyright (c) 2002 Tom Saywer + +" Add an item to a gangly list: +"map , o<bs><bs><bs><bs>-<esc>o +" Convert to Canonical form: +"map \c :%!python -c 'from yaml.redump import redump; import sys; print redump(sys.stdin.read()).rstrip()' + +if version < 600 + syntax clear +endif +syntax clear + +syn match yamlDelimiter "[:,-]" +syn match yamlBlock "[\[\]\{\}\|\>]" +syn match yamlOperator "[?^+-]\|=>" + +syn region yamlComment start="\#" end="$" +syn match yamlIndicator "#YAML:\S\+" + +syn region yamlString start="'" end="'" skip="\\'" +syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape +syn match yamlEscape +\\[abfnrtv'"\\]+ contained +syn match yamlEscape "\\\o\o\=\o\=" contained +syn match yamlEscape "\\x\x\+" contained + +syn match yamlType "!\S\+" + +syn keyword yamlConstant NULL Null null NONE None none NIL Nil nil +syn keyword yamlConstant TRUE True true YES Yes yes ON On on +syn keyword yamlConstant FALSE False false NO No no OFF Off off + +syn match yamlKey "\w\+\ze\s*:" +syn match yamlAnchor "&\S\+" +syn match yamlAlias "*\S\+" + +" Setupt the hilighting links + +hi link yamlConstant Keyword +hi link yamlIndicator PreCondit +hi link yamlAnchor Function +hi link yamlAlias Function +hi link yamlKey Identifier +hi link yamlType Type + +hi link yamlComment Comment +hi link yamlBlock Operator +hi link yamlOperator Operator +hi link yamlDelimiter Delimiter +hi link yamlString String +hi link yamlEscape Special + + +endif @@ -173,6 +173,7 @@ PACKS=" vcl:smerrill/vcl-vim-plugin vm:lepture/vim-velocity xls:vim-scripts/XSLT-syntax + yaml:stephpy/vim-yaml yard:sheerun/vim-yardoc " |