diff --git a/zencoding.vim b/zencoding.vim index 8702983..1b6a1b2 100644 --- a/zencoding.vim +++ b/zencoding.vim @@ -801,7 +801,7 @@ function! s:zen_parseIntoTree(abbr, type) " TODO : expandos let abbr = substitute(abbr, '\([a-z][a-z0-9]*\)\+$', '\=s:zen_expandos(submatch(1), type)', 'i') - let mx = '\([\+>#]\|<\+\)\{-}\s*\(@\{-}[a-z][a-z0-9:\!\-]*\|{[^}]\+}\)\(\%(\%(#[0-9A-Za-z_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.[0-9A-Za-z_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\*\([0-9]\+\)\)\{0,1}' + let mx = '\([\+>#{]\|<\+\)\{-}\s*\(@\{-}[a-z][a-z0-9:\!\-]*\|{[^}]\+}\)\(\%(\%(#[0-9A-Za-z_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.[0-9A-Za-z_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\*\([0-9]\+\)\)\{0,1}' let last = {} let parent = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'brother': 0 } let granma = parent @@ -986,12 +986,18 @@ function! s:zen_toString(...) endfunction function! s:zen_expand(word) - let line = getline('.')[:col('.')-1] - let part = matchstr(line, a:word ? '\(\w\+\)$' : '\(\S.*\)$') - let rest = getline('.')[col('.'):] let type = &ft + let line = getline('.')[:col('.')-1] + if a:word || type != 'html' + let part = matchstr(line, '\([0-9A-Za-z_\@]\+\)$') + else + let part = matchstr(line, '\(\S.*\)$') + endif + let rest = getline('.')[col('.'):] let items = s:zen_parseIntoTree(part, type)['child'] let expand = '' + let g:hoge = line + let g:moge = part for item in items let expand .= s:zen_toString(item, type) endfor @@ -1097,5 +1103,6 @@ endif "echo ZenExpand('#header + div#footer', '') "echo ZenExpand('#header > ul > li < p{Footer}', '') "echo ZenExpand('a#foo$$$*3', '') +"echo ZenExpand('@i', 'css') " vim:set et: