forked from VimPlug/emmet-vim
Add fuzzy search for css. Fixes #142
This commit is contained in:
@@ -68,8 +68,17 @@ function! emmet#lang#css#parseIntoTree(abbr, type)
|
||||
endif
|
||||
|
||||
" snippets
|
||||
if !empty(snippets) && has_key(snippets, tag_name)
|
||||
let snippet = snippets[tag_name]
|
||||
if !empty(snippets)
|
||||
let snippet_name = tag_name
|
||||
if !has_key(snippets, snippet_name)
|
||||
let pat = '^' . join(split(tag_name, '\zs'), '\(\|[^-]\+-\)')
|
||||
let vv = filter(sort(keys(snippets)), 'snippets[v:val] =~ pat')
|
||||
if len(vv) > 0
|
||||
let snippet_name = vv[0]
|
||||
endif
|
||||
endif
|
||||
if has_key(snippets, snippet_name)
|
||||
let snippet = snippets[snippet_name]
|
||||
if use_pipe_for_cursor
|
||||
let snippet = substitute(snippet, '|', '${cursor}', 'g')
|
||||
endif
|
||||
@@ -85,6 +94,7 @@ function! emmet#lang#css#parseIntoTree(abbr, type)
|
||||
let current.snippet .= "\n"
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
let current.pos = 0
|
||||
let lg = matchlist(token, '^\%(linear-gradient\|lg\)(\s*\(\w\+\)\s*,\s*\([^,]\+\)\s*,\s*\([^)]\+\)\s*)$')
|
||||
|
||||
@@ -107,8 +107,10 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
|
||||
" snippets
|
||||
let snippets = emmet#getResource(type, 'snippets', {})
|
||||
if !empty(snippets) && has_key(snippets, tag_name)
|
||||
let snippet = snippets[tag_name]
|
||||
if !empty(snippets)
|
||||
let snippet_name = tag_name
|
||||
if has_key(snippets, snippet_name)
|
||||
let snippet = snippets[snippet_name]
|
||||
if use_pipe_for_cursor
|
||||
let snippet = substitute(snippet, '|', '${cursor}', 'g')
|
||||
endif
|
||||
@@ -117,6 +119,7 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
let current.snippet = join(lines, "\n")
|
||||
let current.name = ''
|
||||
endif
|
||||
endif
|
||||
|
||||
let custom_expands = emmet#getResource(type, 'custom_expands', {})
|
||||
if empty(custom_expands) && has_key(settings, 'custom_expands')
|
||||
|
||||
@@ -660,6 +660,10 @@ finish
|
||||
'query': "m0+bgi+bg++p0$$$$",
|
||||
'result': "margin: 0;\nbackground-image: url($$$$);\nbackground: #FFF url() 0 0 no-repeat;\npadding: 0;",
|
||||
},
|
||||
{
|
||||
'query': "borle$$$$",
|
||||
'result': "border-left: $$$$;",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user