Merge branch 'master' of github.com:mattn/zencoding-vim

This commit is contained in:
mattn
2011-10-25 13:50:57 +09:00
3 changed files with 22 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" zencoding.vim " zencoding.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com> " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 12-Oct-2011. " Last Change: 14-Oct-2011.
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
@@ -335,7 +335,7 @@ function! s:zen_toString_haml(settings, current, type, inline, filters, itemno,
for attr in keys(current.attr) for attr in keys(current.attr)
let val = current.attr[attr] let val = current.attr[attr]
if current.multiplier > 1 if current.multiplier > 1
while val =~ '\$\([^{]\|$\)' while val =~ '\$\([^#{]\|$\)'
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile endwhile
endif endif
@@ -404,7 +404,7 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno,
endif endif
let val = current.attr[attr] let val = current.attr[attr]
if current.multiplier > 1 if current.multiplier > 1
while val =~ '\$\([^{]\|$\)' while val =~ '\$\([^#{]\|$\)'
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile endwhile
endif endif
@@ -513,13 +513,18 @@ function! s:zen_toString(...)
let str = '' let str = ''
while itemno < current.multiplier while itemno < current.multiplier
if len(current.name) if len(current.name)
let inner = ''
if exists('*g:zen_toString_'.type) 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') 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 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 endif
if current.multiplier > 1
let inner = substitute(inner, '\$#', '$line'.(itemno+1).'$', 'g')
endif
let str .= inner
else else
let snippet = current.snippet let snippet = current.snippet
if len(current.snippet) == 0 if len(current.snippet) == 0
@@ -637,7 +642,10 @@ function! zencoding#expandAbbr(mode) range
let leader = substitute(leader, mx, '', '') let leader = substitute(leader, mx, '', '')
endif endif
if leader =~ '\*' 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 .= '>{$#}'
endif
let items = s:zen_parseIntoTree(query, type).child let items = s:zen_parseIntoTree(query, type).child
for item in items for item in items
let expand .= s:zen_toString(item, type, 0, filters) let expand .= s:zen_toString(item, type, 0, filters)
@@ -647,12 +655,9 @@ function! zencoding#expandAbbr(mode) range
for n in range(a:firstline, a:lastline) for n in range(a:firstline, a:lastline)
let lline = getline(n) let lline = getline(n)
let lpart = substitute(lline, '^\s*', '', '') let lpart = substitute(lline, '^\s*', '', '')
let pos = stridx(expand, "$line$") let expand = substitute(expand, '\$line'.(n-a:firstline+1).'\$', lpart, 'g')
if pos != -1
let expand = expand[:pos-1] . lpart . expand[pos+6:]
endif
endfor endfor
let expand = substitute(expand, '\$line\$', '', 'g') let expand = substitute(expand, '\$line\d*\$', '', 'g')
else else
let str = '' let str = ''
if a:firstline != a:lastline if a:firstline != a:lastline

View File

@@ -1,8 +1,8 @@
"============================================================================= "=============================================================================
" File: zencoding.vim " File: zencoding.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com> " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 26-Sep-2011. " Last Change: 22-Oct-2011.
" Version: 0.54 " Version: 0.55
" WebPage: http://github.com/mattn/zencoding-vim " WebPage: http://github.com/mattn/zencoding-vim
" Description: vim plugins for HTML and CSS hi-speed coding. " Description: vim plugins for HTML and CSS hi-speed coding.
" SeeAlso: http://code.google.com/p/zen-coding/ " SeeAlso: http://code.google.com/p/zen-coding/

View File

@@ -2,7 +2,7 @@ script_name: ZenCoding.vim
script_id: '2981' script_id: '2981'
script_type: utility script_type: utility
script_package: zencoding-vim.zip script_package: zencoding-vim.zip
script_version: '0.54' script_version: '0.55'
required_vim_version: '7.0' required_vim_version: '7.0'
summary: vim plugins for HTML and CSS hi-speed coding. 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 # git clone http://github.com/mattn/zencoding-vim.git
versions: versions:
- '0.55': |
uploaded again: sorry, files was old.
- '0.54': | - '0.54': |
[add] support sass, xsd. [add] support sass, xsd.
[fix] expanding with html tag. [fix] expanding with html tag.