From 7645ea8230639e0bd2169c510d7111173c89a993 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Sat, 22 Nov 2014 17:21:02 -0800 Subject: [PATCH] Remove yaml plugin and enable syntax for yam files --- vim/bundle/yaml/README | 41 ----------- vim/bundle/yaml/syntax/yaml.vim | 126 -------------------------------- vim/bundle/yaml/yamlsort.rb | 112 ---------------------------- vim/bundle/yaml/yamlsort.vim | 19 ----- vim/ftplugin/yaml.vim | 2 - 5 files changed, 300 deletions(-) delete mode 100644 vim/bundle/yaml/README delete mode 100644 vim/bundle/yaml/syntax/yaml.vim delete mode 100644 vim/bundle/yaml/yamlsort.rb delete mode 100644 vim/bundle/yaml/yamlsort.vim delete mode 100644 vim/ftplugin/yaml.vim diff --git a/vim/bundle/yaml/README b/vim/bundle/yaml/README deleted file mode 100644 index 1495ce3..0000000 --- a/vim/bundle/yaml/README +++ /dev/null @@ -1,41 +0,0 @@ -# Vim syntax files -# Language: YAML -# Author: Igor Vergeichik -# Author: Nikolai Weibull -# Sponsor: Tom Sawyer -# Sponsor: Ingy döt Net - -YAML.VIM and YAML collection sorting scripts: - -INSTALLATION: -- Put syntax/yaml.vim in vim's syntax folder (/usr/share/vim/syntax on my system) -- Add the .yaml/.yml extensions to the filetype.vim file: | - " Yaml - au BufNewFile,BufRead *.yaml,*.yml setf yaml -- If you want add a new enty to the syntax menu: - an 50.110.370 &Syntax.WXYZ.Yaml :cal SetSyn("yaml") -- Put yamlsort.rb and yamlsort.vim into ~/.vim/scripts directory. - -SORT USE: -- Type vim command: | - :source ~/.vim/scripts/yamlsort.vim -- Then: > - is mapped to sort YAML collections in direct order, - and in reversed order. - -NOTES: -- If you want change key mapping of sorting rules edit yamlsort.vim - -TODO: -- Work with short notation of collections and mappings ({}, []) -- Support sorting of multiline values - -Changelog: - 2010-02-19: - - Merge Nikolai Weibull's rendition of yaml.vim (thanks to Phill Baker). - 2002-06-09: - - Key field can contain any number of spaces before column. - - > - If any record of collection does not key field (i.e field which - value is used in sorting), it is placed to the end of collection. - diff --git a/vim/bundle/yaml/syntax/yaml.vim b/vim/bundle/yaml/syntax/yaml.vim deleted file mode 100644 index b7ae2a8..0000000 --- a/vim/bundle/yaml/syntax/yaml.vim +++ /dev/null @@ -1,126 +0,0 @@ -" Vim syntax file -" Language: YAML (YAML Ain't Markup Language) -" Author: Igor Vergeichik -" Author: Nikolai Weibull -" Sponsor: Tom Sawyer -" Version: 2.0 -" - -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish -endif -syntax clear - -if exists("b:current_syntax") - finish -endif - -let s:cpo_save = &cpo -set cpo&vim - -syn keyword yamlTodo contained TODO FIXME XXX NOTE - -syn region yamlDocumentHeader start='---' end='$' contains=yamlDirective -syn match yamlDocumentEnd '\.\.\.' -syn match yamlDirective contained '%[^:]\+:.\+' - -syn region yamlComment display oneline start='\%(^\|\s\)#' end='$' - \ contains=yamlTodo,@Spell -"syn region yamlMapping start="\w+:\s*\w+" end="$" - \ contains=yamlKey,yamlValue -syn match yamlNodeProperty "!\%(![^\\^% ]\+\|[^!][^:/ ]*\)" -syn match yamlAnchor "&.\+" -syn match yamlAlias "\*.\+" -syn match yamlDelimiter "[-,:]\(\s\|\n\)" -syn match yamlBlock "[\[\]\{\}>|]" -syn match yamlOperator '[?+-]' -syn match yamlKey '\(\.\|\w\)\+\(\s\+\(\.\|\w\)\+\)*\ze\s*:\(\s\|\n\)' -syn match yamlScalar '\(\(|\|>\)\s*\n*\r*\)\@<=\(\s\+\).*\n*\r*\(\(\3\).*\n\)*' - -" Predefined data types - -" Yaml Integer type -syn match yamlInteger display "[-+]\?\(0\|[1-9][0-9,]*\)" -syn match yamlInteger display "[-+]\?0[xX][0-9a-fA-F,]\+" - -" floating point number -syn match yamlFloating display "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>" -syn match yamlFloating display "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" -syn match yamlFloating display "\<\d\+e[-+]\=\d\+[fl]\=\>" -syn match yamlFloating display "\(([+-]\?inf)\)\|\((NaN)\)" -" TODO: sexagecimal and fixed (20:30.15 and 1,230.15) -syn match yamlNumber display - \ '\<[+-]\=\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' -syn match yamlNumber display '0\o\+' -syn match yamlNumber display '0x\x\+' -syn match yamlNumber display '([+-]\=[iI]nf)' - -" Boolean -syn keyword yamlBoolean true True TRUE false False FALSE yes Yes YES no No NO on On ON off Off OFF -syn match yamlBoolean ":.*\zs\W[+-]\(\W\|$\)" - -syn match yamlConstant '\<[~yn]\>' - -" Null -syn keyword yamlNull null Null NULL nil Nil NIL -syn match yamlNull "\W[~]\(\W\|$\)" - -syn match yamlTime "\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\?Z" -syn match yamlTime "\d\d\d\d-\d\d-\d\dt\d\d:\d\d:\d\d.\d\d-\d\d:\d\d" -syn match yamlTime "\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d.\d\d\s-\d\d:\d\d" -syn match yamlTimestamp '\d\d\d\d-\%(1[0-2]\|\d\)-\%(3[0-2]\|2\d\|1\d\|\d\)\%( \%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d [+-]\%([01]\d\|2[0-3]\):[0-5]\d\|t\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d[+-]\%([01]\d\|2[0-3]\):[0-5]\d\|T\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\dZ\)\=' - -" Single and double quoted scalars -syn region yamlString start="'" end="'" skip="\\'" - \ contains=yamlSingleEscape -syn region yamlString start='"' end='"' skip='\\"' - \ contains=yamlEscape - -" Escaped symbols -" every charater preceeded with slash is escaped one -syn match yamlEscape "\\." -" 2,4 and 8-digit escapes -syn match yamlEscape "\\\(x\x\{2\}\|u\x\{4\}\|U\x\{8\}\)" -syn match yamlEscape contained display +\\[\\"abefnrtv^0_ NLP]+ -syn match yamlEscape contained display '\\x\x\{2}' -syn match yamlEscape contained display '\\u\x\{4}' -syn match yamlEscape contained display '\\U\x\{8}' -" TODO: how do we get 0x85, 0x2028, and 0x2029 into this? -syn match yamlEscape display '\\\%(\r\n\|[\r\n]\)' -syn match yamlSingleEscape contained display +''+ - -syn match yamlKey "\w\+\ze\s*:\(\s\|\n\)" -syn match yamlType "![^\s]\+\s\@=" - -hi link yamlKey Identifier -hi link yamlType Type -hi link yamlInteger Number -hi link yamlFloating Float -hi link yamlNumber Number -hi link yamlEscape Special -hi link yamlSingleEscape SpecialChar -hi link yamlComment Comment -hi link yamlBlock Operator -hi link yamlDelimiter Delimiter -hi link yamlString String -hi link yamlBoolean Boolean -hi link yamlNull Boolean -hi link yamlTime String -hi link yamlTodo Todo -hi link yamlDocumentHeader PreProc -hi link yamlDocumentEnd PreProc -hi link yamlDirective Keyword -hi link yamlNodeProperty Type -hi link yamlAnchor Type -hi link yamlAlias Type -hi link yamlOperator Operator -hi link yamlScalar String -hi link yamlConstant Constant -hi link yamlTimestamp Number - -let b:current_syntax = "yaml" - -let &cpo = s:cpo_save -unlet s:cpo_save diff --git a/vim/bundle/yaml/yamlsort.rb b/vim/bundle/yaml/yamlsort.rb deleted file mode 100644 index e989887..0000000 --- a/vim/bundle/yaml/yamlsort.rb +++ /dev/null @@ -1,112 +0,0 @@ -# This is a script for vim-ruby for sorting collections -# -# Author: Igor Vergeichik -# Sponsor: Tom Sawyer -# Copyright (c) 2002 Tom Saywer - -class YCollection - def initialize(rule) - @buffer=VIM::Buffer.current - @window=VIM::Window.current - @lnum = @window.cursor[0] - @key=@buffer[@lnum].scan(/^([^:]+[^\s])\s*:/) - # Find collection bounds - r = bounds - # If collection found - resort it - replace(r, resort((parse r), rule)) if r[1]>0 - end - - # Detect bounds of YAML collection - # Input: no - # Output: Array - range of detected collection - def bounds - lnum = @lnum - # If line begins with a dash - this is one of collection items - if @buffer[lnum]=~/\s*-/ - coll_bounds(lnum) - else - # otherwise we need to find parent item - ind = VIM::evaluate("indent(#{lnum})").to_i - while lnum>0 - if VIM::evaluate("indent(#{lnum})").to_i0 - curr_ind = VIM::evaluate("indent(#{ln})").to_i - break if curr_inda} - diff --git a/vim/bundle/yaml/yamlsort.vim b/vim/bundle/yaml/yamlsort.vim deleted file mode 100644 index d19817f..0000000 --- a/vim/bundle/yaml/yamlsort.vim +++ /dev/null @@ -1,19 +0,0 @@ -" Vim script for vim-ruby for sorting yaml collections -" Requires: yamlsort.rb -" Author: Igor Vergeichik -" Sponsor: Tom Sawyer -" Copyright (c) 2002 Tom Saywer - -ruby load '~/.vim/scripts/yamlsort.rb' - -" Direct sort -function! YamlSort() - ruby YCollection.new lambda{|a,b| a<=>b} -endfunction -" Reverse sort -function! YamlRSort() - ruby YCollection.new lambda{|a,b| b<=>a} -endfunction - -map :call YamlSort() -map :call YamlRSort() diff --git a/vim/ftplugin/yaml.vim b/vim/ftplugin/yaml.vim deleted file mode 100644 index e29aba1..0000000 --- a/vim/ftplugin/yaml.vim +++ /dev/null @@ -1,2 +0,0 @@ -set syntax=off -