From f8f9dcd72ef35980c2da070f99f14697a21439d7 Mon Sep 17 00:00:00 2001 From: mattn Date: Fri, 14 Oct 2011 18:58:12 +0900 Subject: [PATCH 1/3] replace $# as line for wrap abbreviation. --- autoload/zencoding.vim | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/autoload/zencoding.vim b/autoload/zencoding.vim index ca06d83..9c94e83 100644 --- a/autoload/zencoding.vim +++ b/autoload/zencoding.vim @@ -1,7 +1,7 @@ "============================================================================= " zencoding.vim " Author: Yasuhiro Matsumoto -" Last Change: 12-Oct-2011. +" Last Change: 14-Oct-2011. let s:save_cpo = &cpo set cpo&vim @@ -335,7 +335,7 @@ function! s:zen_toString_haml(settings, current, type, inline, filters, itemno, for attr in keys(current.attr) let val = current.attr[attr] if current.multiplier > 1 - while val =~ '\$\([^{]\|$\)' + while val =~ '\$\([^#{]\|$\)' let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') endwhile endif @@ -379,6 +379,9 @@ function! s:zen_toString_haml(settings, current, type, inline, filters, itemno, endif endif let str .= "\n" + if !empty(current.parent) && empty(current.parent.parent) + let str = substitute(str, '\$#', '$line'.(itemno+1).'$', 'g') + endif return str endfunction @@ -404,7 +407,7 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno, endif let val = current.attr[attr] if current.multiplier > 1 - while val =~ '\$\([^{]\|$\)' + while val =~ '\$\([^#{]\|$\)' let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') endwhile endif @@ -475,6 +478,9 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno, if len(comment) > 0 let str .= "" . (inline ? "" : "\n") . comment_indent endif + if !empty(current.parent) && empty(current.parent.parent) + let str = substitute(str, '\$#', '$line'.(itemno+1).'$', 'g') + endif return str endfunction @@ -637,7 +643,10 @@ function! zencoding#expandAbbr(mode) range let leader = substitute(leader, mx, '', '') endif if leader =~ '\*' - let query = substitute(leader, '*', '*' . (a:lastline - a:firstline + 1), '') . '>{$line$}' + let query = substitute(leader, '*', '*' . (a:lastline - a:firstline + 1), '') + if query !~ '}\s*$' + let query .= '>{$line$}' + endif let items = s:zen_parseIntoTree(query, type).child for item in items let expand .= s:zen_toString(item, type, 0, filters) @@ -647,12 +656,9 @@ function! zencoding#expandAbbr(mode) range for n in range(a:firstline, a:lastline) let lline = getline(n) let lpart = substitute(lline, '^\s*', '', '') - let pos = stridx(expand, "$line$") - if pos != -1 - let expand = expand[:pos-1] . lpart . expand[pos+6:] - endif + let expand = substitute(expand, '\$line'.(n-a:firstline+1).'\$', lpart, 'g') endfor - let expand = substitute(expand, '\$line\$', '', 'g') + let expand = substitute(expand, '\$line\d*\$', '', 'g') else let str = '' if a:firstline != a:lastline From eaa447fb40e608ebb1c4fd4187ad588b18a2255e Mon Sep 17 00:00:00 2001 From: mattn Date: Fri, 14 Oct 2011 21:35:38 +0900 Subject: [PATCH 2/3] support: Upgraded "Wrap With Abbreviation" action --- autoload/zencoding.vim | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/autoload/zencoding.vim b/autoload/zencoding.vim index 9c94e83..1fa59d9 100644 --- a/autoload/zencoding.vim +++ b/autoload/zencoding.vim @@ -379,9 +379,6 @@ function! s:zen_toString_haml(settings, current, type, inline, filters, itemno, endif endif let str .= "\n" - if !empty(current.parent) && empty(current.parent.parent) - let str = substitute(str, '\$#', '$line'.(itemno+1).'$', 'g') - endif return str endfunction @@ -478,9 +475,6 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno, if len(comment) > 0 let str .= "" . (inline ? "" : "\n") . comment_indent endif - if !empty(current.parent) && empty(current.parent.parent) - let str = substitute(str, '\$#', '$line'.(itemno+1).'$', 'g') - endif return str endfunction @@ -519,13 +513,18 @@ function! s:zen_toString(...) let str = '' while itemno < current.multiplier if len(current.name) + let inner = '' if exists('*g:zen_toString_'.type) - let str .= function('g:zen_toString_'.type)(s:zen_settings, current, type, inline, filters, itemno, indent) + let inner = function('g:zen_toString_'.type)(s:zen_settings, current, type, inline, filters, itemno, indent) elseif s:zen_useFilter(filters, 'haml') - let str .= s:zen_toString_haml(s:zen_settings, current, type, inline, filters, itemno, indent) + let inner = s:zen_toString_haml(s:zen_settings, current, type, inline, filters, itemno, indent) else - let str .= s:zen_toString_html(s:zen_settings, current, type, inline, filters, itemno, indent) + let inner = s:zen_toString_html(s:zen_settings, current, type, inline, filters, itemno, indent) endif + if current.multiplier > 1 + let inner = substitute(inner, '\$#', '$line'.(itemno+1).'$', 'g') + endif + let str .= inner else let snippet = current.snippet if len(current.snippet) == 0 @@ -645,7 +644,7 @@ function! zencoding#expandAbbr(mode) range if leader =~ '\*' let query = substitute(leader, '*', '*' . (a:lastline - a:firstline + 1), '') if query !~ '}\s*$' - let query .= '>{$line$}' + let query .= '>{$#}' endif let items = s:zen_parseIntoTree(query, type).child for item in items From 773f87b62b61690fbe379c882453d3fd71ccf516 Mon Sep 17 00:00:00 2001 From: mattn Date: Sat, 22 Oct 2011 23:54:41 +0900 Subject: [PATCH 3/3] version bump up. --- plugin/zencoding.vim | 4 ++-- zencoding.vim.vimup | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/zencoding.vim b/plugin/zencoding.vim index 99591f4..3757aa6 100644 --- a/plugin/zencoding.vim +++ b/plugin/zencoding.vim @@ -1,8 +1,8 @@ "============================================================================= " File: zencoding.vim " Author: Yasuhiro Matsumoto -" Last Change: 26-Sep-2011. -" Version: 0.54 +" Last Change: 22-Oct-2011. +" Version: 0.55 " WebPage: http://github.com/mattn/zencoding-vim " Description: vim plugins for HTML and CSS hi-speed coding. " SeeAlso: http://code.google.com/p/zen-coding/ diff --git a/zencoding.vim.vimup b/zencoding.vim.vimup index fe6434b..a5b133b 100644 --- a/zencoding.vim.vimup +++ b/zencoding.vim.vimup @@ -2,7 +2,7 @@ script_name: ZenCoding.vim script_id: '2981' script_type: utility script_package: zencoding-vim.zip -script_version: '0.54' +script_version: '0.55' required_vim_version: '7.0' summary: vim plugins for HTML and CSS hi-speed coding. @@ -98,6 +98,8 @@ install_details: | # git clone http://github.com/mattn/zencoding-vim.git versions: +- '0.55': | + uploaded again: sorry, files was old. - '0.54': | [add] support sass, xsd. [fix] expanding with html tag.