mirror of
https://github.com/gko/vim-coloresque.git
synced 2025-12-06 12:54:27 +08:00
Merge pull request #41 from iKarith/master
Make color matches not happen in the middle of \w
This commit is contained in:
@@ -54,7 +54,7 @@ function! s:MatchColorValue(color, part)
|
|||||||
if !exists('b:matchescache')
|
if !exists('b:matchescache')
|
||||||
let b:matchescache = {}
|
let b:matchescache = {}
|
||||||
elseif !exists('b:matchescache[a:part]')
|
elseif !exists('b:matchescache[a:part]')
|
||||||
let b:matchescache[a:part] = matchadd(group, a:part, -1)
|
let b:matchescache[a:part] = matchadd(group, '\w\@<!'.a:part, -1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
@@ -285,12 +285,18 @@ function! s:ProcessByLine(w)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:PreviewCSSColor(str)
|
function! s:PreviewCSSColor(str)
|
||||||
|
"if !exists('&w:colorDictRegExp')
|
||||||
|
"endif
|
||||||
|
|
||||||
let line=a:str "getline(a:w)
|
let line=a:str "getline(a:w)
|
||||||
let colorexps = {
|
let colorexps = {
|
||||||
\ 'hex' : '#[0-9A-Fa-f]\{3\}\>\|#[0-9A-Fa-f]\{6\}\>',
|
\ 'hex' : '\w\@<!#[0-9A-Fa-f]\{3\}\>\|#[0-9A-Fa-f]\{6\}\>',
|
||||||
\ 'rgba' : 'rgba\?(\s*\(\d\{1,3}%\?\)\s*,\s*\(\d\{1,3}%\?\)\s*,\s*\(\d\{1,3}%\?\)\s*\%(,[^)]*\)\?)',
|
\ 'rgba' : '\w\@<!rgba\?(\s*\(\d\{1,3}%\?\)\s*,\s*\(\d\{1,3}%\?\)\s*,\s*\(\d\{1,3}%\?\)\s*\%(,[^)]*\)\?)',
|
||||||
\ 'hsla' : 'hsla\?(\s*\(\d\{1,3}%\?\)\s*,\s*\(\d\{1,3}%\?\)\s*,\s*\(\d\{1,3}%\?\)\s*\%(,[^)]*\)\?)'
|
\ 'hsla' : '\w\@<!hsla\?(\s*\(\d\{1,3}%\?\)\s*,\s*\(\d\{1,3}%\?\)\s*,\s*\(\d\{1,3}%\?\)\s*\%(,[^)]*\)\?)'
|
||||||
\ }
|
\ }
|
||||||
|
"\ 'color': w:colorDictRegExp
|
||||||
|
|
||||||
|
"let foundcolor=''
|
||||||
|
|
||||||
for exp in keys(colorexps)
|
for exp in keys(colorexps)
|
||||||
let place=0
|
let place=0
|
||||||
|
|||||||
Reference in New Issue
Block a user