Merge commit '62ef855ef42e7c0fc9c0' into mustache

This commit is contained in:
mattn
2010-08-25 15:53:54 +09:00
2 changed files with 37 additions and 17 deletions

View File

@@ -41,7 +41,7 @@ if exists('g:user_zen_settings')
let g:user_zen_settings = s:old_user_zen_settings
endif
let &more=oldmore
finish
[
{
@@ -400,5 +400,22 @@ finish
},
],
},
{
'category': 'mustache',
'tests': [
{
'name': "div#{{foo}}",
'query': "div#{{foo}}",
'type': "mustache",
'result': "<div id=\"{{foo}}\"></div>\n",
},
{
'name': "div.{{foo}}",
'query': "div.{{foo}}",
'type': "mustache",
'result': "<div class=\"{{foo}}\"></div>\n",
},
],
},
]
" vim:set et:

View File

@@ -10,7 +10,7 @@
"
" This is vim script support expanding abbreviation like zen-coding.
" ref: http://code.google.com/p/zen-coding/
"
"
" Type abbreviation
" +-------------------------------------
" | html:5_
@@ -42,12 +42,12 @@
" | <div class="bar"></div>
" |</div>
" +-------------------------------------
"
"
" Tips:
"
"
" You can customize behavior of expanding with overriding config.
" This configuration will be marged at loading plugin.
"
" This configuration will be marged at loading plugin.
"
" let g:user_zen_settings = {
" \ 'indentation' : ' ',
" \ 'perl' : {
@@ -109,7 +109,7 @@ for s:item in [
\ {'mode': 'i', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': '<esc>:call <sid>zen_anchorizeURL(1)<cr>a'},
\ {'mode': 'n', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': ':call <sid>zen_anchorizeURL(1)<cr>'},
\]
if !hasmapto('<plug>'.s:item.plug, s:item.mode)
exe s:item.mode . 'noremap <plug>' . s:item.plug . ' ' . s:item.func
endif
@@ -846,6 +846,9 @@ let s:zen_settings = {
\ },
\ 'xhtml': {
\ 'extends': 'html'
\ },
\ 'mustache': {
\ 'extends': 'html'
\ }
\}
@@ -905,7 +908,7 @@ function! s:zen_parseIntoTree(abbr, type)
endif
let abbr = substitute(abbr, '\([a-zA-Z][a-zA-Z0-9]*\)+\([()]\|$\)', '\="(".s:zen_expandos(type, submatch(1)).")".submatch(2)', 'i')
let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#]\{-}[a-zA-Z\!][a-zA-Z0-9:\!\-]*\|{[^}]\+}\)\(\%(\%(#[a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.[a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\s*\*\s*\([0-9]\+\)\s*\)\{0,1}\(\%(\s*)\%(\s*\*\s*[0-9]\+\s*\)\{0,1}\)*\)'
let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#]\{-}[a-zA-Z\!][a-zA-Z0-9:\!\-]*\|{[^}]\+}\)\(\%(\%(#[{}a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.[{}a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\s*\*\s*\([0-9]\+\)\s*\)\{0,1}\(\%(\s*)\%(\s*\*\s*[0-9]\+\s*\)\{0,1}\)*\)'
let root = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0 }
let parent = root
let last = root
@@ -980,7 +983,7 @@ function! s:zen_parseIntoTree(abbr, type)
if len(attributes)
let attr = attributes
while len(attr)
let item = matchstr(attr, '\(\%(\%(#[a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.[a-zA-Z0-9_\-\$]\+\)*\)\)')
let item = matchstr(attr, '\(\%(\%(#[{}a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.[{}a-zA-Z0-9_\-\$]\+\)*\)\)')
if len(item) == 0
break
endif
@@ -1370,16 +1373,16 @@ function! s:zen_getFileType()
let type = &ft
if type == 'xslt' | let type = 'xsl' | endif
if synIDattr(synID(line("."), col("."), 1), "name") =~ '^css'
let type = 'css'
let type = 'css'
endif
if synIDattr(synID(line("."), col("."), 1), "name") =~ '^html'
let type = 'html'
let type = 'html'
endif
if synIDattr(synID(line("."), col("."), 1), "name") =~ '^xml'
let type = 'xml'
let type = 'xml'
endif
if synIDattr(synID(line("."), col("."), 1), "name") =~ '^javaScript'
let type = 'javascript'
let type = 'javascript'
endif
if len(type) == 0 | let type = 'html' | endif
return type
@@ -1421,7 +1424,7 @@ function! s:zen_expandAbbr(mode) range
let expand = substitute(expand, '\$line\$', lpart, '')
endfor
else
let str = ''
let str = ''
if a:firstline != a:lastline
let line = getline(a:firstline)
let part = substitute(line, '^\s*', '', '')
@@ -1477,7 +1480,7 @@ function! s:zen_expandAbbr(mode) range
endif
if len(expand)
if expand !~ '\${cursor}'
if a:mode == 2 |
if a:mode == 2 |
let expand = '${cursor}' . expand
else
let expand .= '${cursor}'
@@ -1558,7 +1561,7 @@ function! s:zen_imageSize()
let fn = simplify(expand('%:h') . '/' . fn)
endif
let [type, width, height] = ['', -1, -1]
if filereadable(fn)
let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g')
else
@@ -2102,7 +2105,7 @@ function! s:region_is_valid(region)
return 1
endfunction
" search_region : make region from pattern which is composing start/end
" search_region : make region from pattern which is composing start/end
" this function return array of position
function! s:search_region(start, end)
return [searchpos(a:start, 'bcnW'), searchpos(a:end, 'cneW')]