forked from VimPlug/emmet-vim
Add fuzzy search for css. Fixes #142
This commit is contained in:
@@ -68,21 +68,31 @@ function! emmet#lang#css#parseIntoTree(abbr, type)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" snippets
|
" snippets
|
||||||
if !empty(snippets) && has_key(snippets, tag_name)
|
if !empty(snippets)
|
||||||
let snippet = snippets[tag_name]
|
let snippet_name = tag_name
|
||||||
if use_pipe_for_cursor
|
if !has_key(snippets, snippet_name)
|
||||||
let snippet = substitute(snippet, '|', '${cursor}', 'g')
|
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
|
endif
|
||||||
let lines = split(snippet, "\n")
|
if has_key(snippets, snippet_name)
|
||||||
call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")')
|
let snippet = snippets[snippet_name]
|
||||||
let current.snippet = join(lines, "\n")
|
if use_pipe_for_cursor
|
||||||
let current.name = ''
|
let snippet = substitute(snippet, '|', '${cursor}', 'g')
|
||||||
let current.snippet = substitute(current.snippet, ';', value . ';', '')
|
endif
|
||||||
if use_pipe_for_cursor && len(value) > 0
|
let lines = split(snippet, "\n")
|
||||||
let current.snippet = substitute(current.snippet, '\${cursor}', '', 'g')
|
call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")')
|
||||||
endif
|
let current.snippet = join(lines, "\n")
|
||||||
if n < len(tokens) - 1
|
let current.name = ''
|
||||||
let current.snippet .= "\n"
|
let current.snippet = substitute(current.snippet, ';', value . ';', '')
|
||||||
|
if use_pipe_for_cursor && len(value) > 0
|
||||||
|
let current.snippet = substitute(current.snippet, '\${cursor}', '', 'g')
|
||||||
|
endif
|
||||||
|
if n < len(tokens) - 1
|
||||||
|
let current.snippet .= "\n"
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -107,15 +107,18 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
|||||||
|
|
||||||
" snippets
|
" snippets
|
||||||
let snippets = emmet#getResource(type, 'snippets', {})
|
let snippets = emmet#getResource(type, 'snippets', {})
|
||||||
if !empty(snippets) && has_key(snippets, tag_name)
|
if !empty(snippets)
|
||||||
let snippet = snippets[tag_name]
|
let snippet_name = tag_name
|
||||||
if use_pipe_for_cursor
|
if has_key(snippets, snippet_name)
|
||||||
let snippet = substitute(snippet, '|', '${cursor}', 'g')
|
let snippet = snippets[snippet_name]
|
||||||
|
if use_pipe_for_cursor
|
||||||
|
let snippet = substitute(snippet, '|', '${cursor}', 'g')
|
||||||
|
endif
|
||||||
|
let lines = split(snippet, "\n")
|
||||||
|
call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")')
|
||||||
|
let current.snippet = join(lines, "\n")
|
||||||
|
let current.name = ''
|
||||||
endif
|
endif
|
||||||
let lines = split(snippet, "\n")
|
|
||||||
call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")')
|
|
||||||
let current.snippet = join(lines, "\n")
|
|
||||||
let current.name = ''
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let custom_expands = emmet#getResource(type, 'custom_expands', {})
|
let custom_expands = emmet#getResource(type, 'custom_expands', {})
|
||||||
|
|||||||
@@ -660,6 +660,10 @@ finish
|
|||||||
'query': "m0+bgi+bg++p0$$$$",
|
'query': "m0+bgi+bg++p0$$$$",
|
||||||
'result': "margin: 0;\nbackground-image: url($$$$);\nbackground: #FFF url() 0 0 no-repeat;\npadding: 0;",
|
'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