From f36d6f402577c87a69a9d569cd2b9df663657825 Mon Sep 17 00:00:00 2001 From: mattn Date: Sat, 25 Jul 2015 10:49:40 +0900 Subject: [PATCH] exapnd $# of attribute in block element. close #282 --- autoload/emmet.vim | 2 +- autoload/emmet/lang/html.vim | 4 +++- unittest.vim | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index b22114c..4e70773 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -475,7 +475,7 @@ function! emmet#expandAbbr(mode, abbr) range abort endif if leader =~# '\*' let query = substitute(leader, '*', '*' . (a:lastline - a:firstline + 1), '') - if query !~# '}\s*$' + if query !~# '}\s*$' && query !~# '\$#' let query .= '>{$#}' endif if emmet#useFilter(filters, '/') diff --git a/autoload/emmet/lang/html.vim b/autoload/emmet/lang/html.vim index 9dc90e5..41558d2 100644 --- a/autoload/emmet/lang/html.vim +++ b/autoload/emmet/lang/html.vim @@ -487,7 +487,9 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite endif let text = substitute(text, '\${nr}', "\n", 'g') let text = substitute(text, '\\\$', '$', 'g') - let str = substitute(str, '\("\zs$#\ze"\|\s\zs\$#"\|"\$#\ze\s\)', text, 'g') + if text != '' + let str = substitute(str, '\("\zs$#\ze"\|\s\zs\$#"\|"\$#\ze\s\)', text, 'g') + endif endif let str .= text let nc = len(current.child) diff --git a/unittest.vim b/unittest.vim index 51baba2..08948c3 100644 --- a/unittest.vim +++ b/unittest.vim @@ -491,6 +491,10 @@ finish 'query': "test1\ntest2\ntest3$$$$\\ggVG\\,input[type=input value=$#]*\\$$$$", 'result': "\n\n", }, + { + 'query': "test1\ntest2\ntest3$$$$\\ggVG\\,div[id=$#]*\\$$$$", + 'result': "
\n
\n
", + }, { 'query': "div#id-$*5>div#id2-$", 'result': "
\n\t
\n
\n
\n\t
\n
\n
\n\t
\n
\n
\n\t
\n
\n
\n\t
\n
\n",