mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 11:14:26 +08:00
Support 's' filter. Close #231
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
let s:filtermx = '|\(\%(bem\|html\|haml\|slim\|e\|c\|fc\|xsl\|t\|\/[^ ]\+\)\s*,\{0,1}\s*\)*$'
|
let s:filtermx = '|\(\%(bem\|html\|haml\|slim\|e\|c\|s\|fc\|xsl\|t\|\/[^ ]\+\)\s*,\{0,1}\s*\)*$'
|
||||||
|
|
||||||
function! emmet#getExpandos(type, key)
|
function! emmet#getExpandos(type, key)
|
||||||
let expandos = emmet#getResource(a:type, 'expandos', {})
|
let expandos = emmet#getResource(a:type, 'expandos', {})
|
||||||
@@ -640,7 +640,12 @@ function! emmet#expandAbbr(mode, abbr) range
|
|||||||
let indent = ''
|
let indent = ''
|
||||||
endif
|
endif
|
||||||
let expand = substitute(expand, '\n\s*$', '', 'g')
|
let expand = substitute(expand, '\n\s*$', '', 'g')
|
||||||
let expand = line[:-len(part)-1] . substitute(expand, "\n", "\n" . indent, 'g') . rest
|
if emmet#useFilter(filters, 's')
|
||||||
|
let epart = substitute(expand, "\n\s\*", "", 'g')
|
||||||
|
else
|
||||||
|
let epart = substitute(expand, "\n", "\n" . indent, 'g')
|
||||||
|
endif
|
||||||
|
let expand = line[:-len(part)-1] . epart . rest
|
||||||
let lines = split(expand, "\n", 1)
|
let lines = split(expand, "\n", 1)
|
||||||
if a:mode == 2
|
if a:mode == 2
|
||||||
silent! exe "normal! gvc"
|
silent! exe "normal! gvc"
|
||||||
@@ -855,6 +860,9 @@ function! emmet#expandWord(abbr, type, orig)
|
|||||||
let expand = substitute(expand, '<', '\<', 'g')
|
let expand = substitute(expand, '<', '\<', 'g')
|
||||||
let expand = substitute(expand, '>', '\>', 'g')
|
let expand = substitute(expand, '>', '\>', 'g')
|
||||||
endif
|
endif
|
||||||
|
if emmet#useFilter(filters, 's')
|
||||||
|
let expand = substitute(expand, "\n\s\*", "", 'g')
|
||||||
|
endif
|
||||||
if a:orig == 0
|
if a:orig == 0
|
||||||
let expand = emmet#expandDollarExpr(expand)
|
let expand = emmet#expandDollarExpr(expand)
|
||||||
let expand = substitute(expand, '\${cursor}', '', 'g')
|
let expand = substitute(expand, '\${cursor}', '', 'g')
|
||||||
|
|||||||
@@ -419,6 +419,10 @@ finish
|
|||||||
'query': "div>div#page>p.title+p|c",
|
'query': "div>div#page>p.title+p|c",
|
||||||
'result': "<div>\n\t<!-- #page -->\n\t<div id=\"page\">\n\t\t<!-- .title -->\n\t\t<p class=\"title\"></p>\n\t\t<!-- /.title -->\n\t\t<p></p>\n\t</div>\n\t<!-- /#page -->\n</div>\n",
|
'result': "<div>\n\t<!-- #page -->\n\t<div id=\"page\">\n\t\t<!-- .title -->\n\t\t<p class=\"title\"></p>\n\t\t<!-- /.title -->\n\t\t<p></p>\n\t</div>\n\t<!-- /#page -->\n</div>\n",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'query': "kbd*2|s",
|
||||||
|
'result': "<kbd></kbd><kbd></kbd>",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'query': "link:css",
|
'query': "link:css",
|
||||||
'result': "<link rel=\"stylesheet\" href=\"style.css\" media=\"all\">\n",
|
'result': "<link rel=\"stylesheet\" href=\"style.css\" media=\"all\">\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user