diff options
Diffstat (limited to 'autoload')
| -rw-r--r-- | autoload/css_color.vim | 60 | ||||
| -rw-r--r-- | autoload/xml/html5.vim | 8 | 
2 files changed, 40 insertions, 28 deletions
| diff --git a/autoload/css_color.vim b/autoload/css_color.vim index 56a50157..4c02d720 100644 --- a/autoload/css_color.vim +++ b/autoload/css_color.vim @@ -1,8 +1,7 @@  " Language:     Colorful CSS Color Preview  " Author:       Aristotle Pagaltzis <pagaltzis@gmx.de> -" Last Change:  2014-01-14 -" Licence:      No Warranties. WTFPL. But please tell me! -" Version:      1.0 +" Commit:       $Format:%H$ +" Licence:      The MIT License (MIT)  if v:version < 700  	echoerr printf('Vim 7 is required for css-color (this is only %d.%d)',v:version/100,v:version%100) @@ -206,28 +205,34 @@ function! s:create_syn_match()  	return ''  endfunction -function! s:update_matches() -	call filter(b:color_match_id, 'matchdelete(v:val)') -	if &l:cursorline -		" adds matches based that duplicate the highlighted colors on the current line -		let lnr = line('.') -		let group = '' -		let groupstart = 0 -		let endcol = col('$') -		for col in range( 1, endcol ) -			let nextgroup = col < endcol ? synIDattr( synID( lnr, col, 1 ), 'name' ) : '' -			if group == nextgroup | continue | endif -			if group =~ '^BG\x\{6}$' -				let regex = '\%'.lnr.'l\%'.groupstart.'c'.repeat( '.', col - groupstart ) -				let match = matchadd( group, regex, -1 ) -				let b:color_match_id += [ match ] -			endif -			let group = nextgroup -			let groupstart = col -		endfor +function! s:clear_matches() +	if exists('w:color_match_id') +		call filter(w:color_match_id, 'matchdelete(v:val)') +		unlet w:color_match_id  	endif  endfunction +function! s:create_matches() +	if ! &l:cursorline | return | endif +	" adds matches based that duplicate the highlighted colors on the current line +	let lnr = line('.') +	let group = '' +	let groupstart = 0 +	let endcol = col('$') +	let w:color_match_id = [] +	for col in range( 1, endcol ) +		let nextgroup = col < endcol ? synIDattr( synID( lnr, col, 1 ), 'name' ) : '' +		if group == nextgroup | continue | endif +		if group =~ '^BG\x\{6}$' +			let regex = '\%'.lnr.'l\%'.groupstart.'c'.repeat( '.', col - groupstart ) +			let match = matchadd( group, regex, -1 ) +			let w:color_match_id += [ match ] +		endif +		let group = nextgroup +		let groupstart = col +	endfor +endfunction +  let s:_hexcolor   = '#\(\x\{3}\|\x\{6}\)\>' " submatch 1  let s:_funcname   = '\(rgb\|hsl\)a\?' " submatch 2  let s:_numval     = '\(\d\{1,3}%\?\)' " submatch 3,4,5 @@ -242,11 +247,13 @@ let s:_csscolor   = s:_hexcolor . '\|' . s:_funcexpr  "      scan without examining the start of the string over and over  function! s:parse_css_screen()  	call substitute( join( getline('w0','w$'), "\n" ), s:_csscolor, '\=s:create_syn_match()', 'g' ) -	call s:update_matches() +	call s:clear_matches() +	call s:create_matches()  endfunction  function! s:parse_any_screen()  	call substitute( join( getline('w0','w$'), "\n" ), s:_hexcolor, '\=s:create_syn_match()', 'g' ) -	call s:update_matches() +	call s:clear_matches() +	call s:create_matches()  endfunction  """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -256,14 +263,15 @@ function! css_color#init(type, groups)  	let b:has_color_hi    = {}  	let b:has_pattern_syn = {} -	let b:color_match_id  = []  	augroup CSSColor  		autocmd! * <buffer>  		exe 'autocmd CursorMoved,CursorMovedI <buffer> call s:parse_'.a:type.'_screen()' +		autocmd BufWinEnter <buffer> call s:create_matches() +		autocmd BufWinLeave <buffer> call s:clear_matches()  	augroup END -	do CSSColor CursorMoved <buffer> +	exe 'call s:parse_'.a:type.'_screen()'  	if a:type != 'css' | return | endif diff --git a/autoload/xml/html5.vim b/autoload/xml/html5.vim index 4c99901a..67926f59 100644 --- a/autoload/xml/html5.vim +++ b/autoload/xml/html5.vim @@ -324,7 +324,7 @@ endif  " Ref: http://dev.w3.org/html5/markup/  " Version: Draft 05 April 2011 -let phrasing_elements = ['a', 'em', 'strong', 'small', 'mark', 'abbr', 'dfn', 'i', 'b', 'u', 'code', 'var', 'samp', 'kbd', 'sup', 'sub', 'q', 'cite', 'span', 'bdo', 'bdi', 'br', 'wbr', 'ins', 'del', 'img', 'embed', 'object', 'iframe', 'map', 'area', 'script', 'noscript', 'ruby', 'video', 'audio', 'input', 'textarea', 'select', 'button', 'label', 'output', 'datalist', 'keygen', 'progress', 'command', 'canvas', 'time', 'meter', 'data', 'content', 'shadow'] +let phrasing_elements = ['a', 'em', 'strong', 'small', 'mark', 'abbr', 'dfn', 'i', 'b', 'u', 'code', 'var', 'samp', 'kbd', 'sup', 'sub', 'q', 'cite', 'span', 'bdo', 'bdi', 'br', 'wbr', 'ins', 'del', 'img', 'picture', 'embed', 'object', 'iframe', 'map', 'area', 'script', 'noscript', 'ruby', 'video', 'audio', 'input', 'textarea', 'select', 'button', 'label', 'output', 'datalist', 'keygen', 'progress', 'command', 'canvas', 'time', 'meter', 'data', 'content', 'shadow']  let metadata_elements = ['link', 'style', 'meta', 'script', 'noscript', 'command'] @@ -643,6 +643,10 @@ let g:xmldata_html5 = {      \ [],      \ extend(copy(global_attributes), {'name': [], 'value': []})  \ ], +\ 'picture': [ +    \ flow_elements + ['source'], +    \ global_attributes +\ ],  \ 'pre': [      \ phrasing_elements,      \ global_attributes @@ -693,7 +697,7 @@ let g:xmldata_html5 = {  \ ],  \ 'source': [      \ [], -    \ extend(copy(global_attributes), {'src': [], 'type': [], 'media': []}) +    \ extend(copy(global_attributes), {'src': [], 'type': [], 'media': [], 'srcset': [], 'sizes': []})  \ ],  \ 'span': [      \ phrasing_elements, | 
