Support 's' filter. Close #231

This commit is contained in:
mattn
2014-09-02 18:33:26 +09:00
parent 55c704bc3a
commit 070800e31d
2 changed files with 14 additions and 2 deletions

View File

@@ -6,7 +6,7 @@
let s:save_cpo = &cpo
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)
let expandos = emmet#getResource(a:type, 'expandos', {})
@@ -640,7 +640,12 @@ function! emmet#expandAbbr(mode, abbr) range
let indent = ''
endif
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)
if a:mode == 2
silent! exe "normal! gvc"
@@ -855,6 +860,9 @@ function! emmet#expandWord(abbr, type, orig)
let expand = substitute(expand, '<', '\&lt;', 'g')
let expand = substitute(expand, '>', '\&gt;', 'g')
endif
if emmet#useFilter(filters, 's')
let expand = substitute(expand, "\n\s\*", "", 'g')
endif
if a:orig == 0
let expand = emmet#expandDollarExpr(expand)
let expand = substitute(expand, '\${cursor}', '', 'g')

View File

@@ -419,6 +419,10 @@ finish
'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",
},
{
'query': "kbd*2|s",
'result': "<kbd></kbd><kbd></kbd>",
},
{
'query': "link:css",
'result': "<link rel=\"stylesheet\" href=\"style.css\" media=\"all\">\n",