mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-06 10:44:24 +08:00
Support 's' filter. Close #231
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user