yaml.vim (1802B)
1 " To make this file do stuff, add something like the following (without the 2 " leading ") to your ~/.vimrc: 3 " au BufNewFile,BufRead *.yaml,*.yml so ~/src/PyYaml/YAML.vim 4 5 " Vim syntax/macro file 6 " Language: YAML 7 " Author: Igor Vergeichik <iverg@mail.ru> 8 " Sponsor: Tom Sawyer <transami@transami.net> 9 " Stayven: Ryan King <jking@panoptic.com> 10 " Copyright (c) 2002 Tom Saywer 11 12 " Add an item to a gangly list: 13 "map , o<bs><bs><bs><bs>-<esc>o 14 " Convert to Canonical form: 15 "map \c :%!python -c 'from yaml.redump import redump; import sys; print redump(sys.stdin.read()).rstrip()' 16 17 if version < 600 18 syntax clear 19 elseif exists("b:current_syntax") 20 finish 21 endif 22 syntax clear 23 24 syn match yamlDelimiter "[:,-]" 25 syn match yamlBlock "[\[\]\{\}\|\>]" 26 syn match yamlOperator "[?^+-]\|=>" 27 28 syn region yamlComment start="\#" end="$" 29 syn match yamlIndicator "#YAML:\S\+" 30 31 syn region yamlString start="'" end="'" skip="\\'" 32 syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape 33 syn match yamlEscape +\\[abfnrtv'"\\]+ contained 34 syn match yamlEscape "\\\o\o\=\o\=" contained 35 syn match yamlEscape "\\x\x\+" contained 36 37 syn match yamlType "!\S\+" 38 39 syn keyword yamlConstant NULL Null null NONE None none NIL Nil nil 40 syn keyword yamlConstant TRUE True true YES Yes yes ON On on 41 syn keyword yamlConstant FALSE False false NO No no OFF Off off 42 43 syn match yamlKey "\w\+\ze\s*:" 44 syn match yamlAnchor "&\S\+" 45 syn match yamlAlias "*\S\+" 46 47 " Setupt the hilighting links 48 49 hi link yamlConstant Keyword 50 hi link yamlIndicator PreCondit 51 hi link yamlAnchor Function 52 hi link yamlAlias Function 53 hi link yamlKey Identifier 54 hi link yamlType Type 55 56 hi link yamlComment Comment 57 hi link yamlBlock Operator 58 hi link yamlOperator Operator 59 hi link yamlDelimiter Delimiter 60 hi link yamlString String 61 hi link yamlEscape Special 62