From 070800e31d6a044211b1c665f9e59aa8d63094cf Mon Sep 17 00:00:00 2001 From: mattn Date: Tue, 2 Sep 2014 18:33:26 +0900 Subject: [PATCH] Support 's' filter. Close #231 --- autoload/emmet.vim | 12 ++++++++++-- unittest.vim | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index 8a3c705..98e1ddf 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -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, '<', '\<', 'g') let expand = substitute(expand, '>', '\>', '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') diff --git a/unittest.vim b/unittest.vim index 2f45ffb..45e9eb8 100644 --- a/unittest.vim +++ b/unittest.vim @@ -419,6 +419,10 @@ finish 'query': "div>div#page>p.title+p|c", 'result': "
\n\t\n\t
\n\t\t\n\t\t

\n\t\t\n\t\t

\n\t
\n\t\n
\n", }, + { + 'query': "kbd*2|s", + 'result': "", + }, { 'query': "link:css", 'result': "\n",