Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ZenCoding 0.59

  • Loading branch information...
commit 65a79f1d631e5e67bcbfd1aef170de7c63d07b6a 1 parent 949df63
Christiaan Kras authored March 17, 2012
470  autoload/zencoding.vim
... ...
@@ -1,7 +1,7 @@
1 1
 "=============================================================================
2 2
 " zencoding.vim
3 3
 " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
4  
-" Last Change: 25-Jan-2011.
  4
+" Last Change: 31-Jan-2012.
5 5
 
6 6
 let s:save_cpo = &cpo
7 7
 set cpo&vim
@@ -62,12 +62,18 @@ function! s:zen_parseIntoTree(abbr, type)
62 62
   endif
63 63
 
64 64
   if s:zen_isExtends(type, "html")
65  
-    let abbr = substitute(abbr, '\([a-zA-Z][a-zA-Z0-9]*\)+\([()]\|$\)', '\="(".s:zen_getExpandos(type, submatch(1)).")".submatch(2)', 'i')
66  
-    let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:\!\-]*\|{[^}]\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[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}\)*\)'
  65
+    " try 'foo' to (foo-x)
  66
+    let rabbr = s:zen_getExpandos(type, abbr)
  67
+    if rabbr == abbr
  68
+      " try 'foo+(' to (foo-x)
  69
+      let rabbr = substitute(abbr, '\([a-zA-Z][a-zA-Z0-9+]*\)+\([()]\|$\)', '\="(".s:zen_getExpandos(type, submatch(1)).")".submatch(2)', 'i')
  70
+    endif
  71
+    let abbr = rabbr
  72
+    let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:_\!\-$]*\|{[^}]\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[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}\)*\)'
67 73
   else
68  
-    let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:\!\+\-]*\|{[^}]\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[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}\)*\)'
  74
+    let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:_\!\+\-]*\|{[^}]\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[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}\)*\)'
69 75
   endif
70  
-  let root = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0 }
  76
+  let root = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0 }
71 77
   let parent = root
72 78
   let last = root
73 79
   let pos = []
@@ -82,6 +88,7 @@ function! s:zen_parseIntoTree(abbr, type)
82 88
     let value = substitute(match, mx, '\5', 'ig')
83 89
     let multiplier = 0 + substitute(match, mx, '\6', 'ig')
84 90
     let block_end = substitute(match, mx, '\7', 'ig')
  91
+    let important = 0
85 92
     if len(str) == 0
86 93
       break
87 94
     endif
@@ -89,6 +96,10 @@ function! s:zen_parseIntoTree(abbr, type)
89 96
       let attributes = tag_name . attributes
90 97
       let tag_name = 'div'
91 98
     endif
  99
+    if tag_name =~ '.!$'
  100
+      let tag_name = tag_name[:-2]
  101
+      let important = 1
  102
+    endif
92 103
     if tag_name =~ '^\.'
93 104
       let attributes = tag_name . attributes
94 105
       let tag_name = 'div'
@@ -99,17 +110,23 @@ function! s:zen_parseIntoTree(abbr, type)
99 110
     let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0 }
100 111
     let current.name = tag_name
101 112
 
  113
+    let current.important = important
  114
+
102 115
     " aliases
103 116
     let aliases = s:zen_getResource(type, 'aliases', {})
104 117
     if has_key(aliases, tag_name)
105 118
       let current.name = aliases[tag_name]
106 119
     endif
107 120
 
  121
+    let use_pipe_for_cursor = s:zen_getResource(type, 'use_pipe_for_cursor', 1)
  122
+
108 123
     " snippets
109 124
     let snippets = s:zen_getResource(type, 'snippets', {})
110 125
     if !empty(snippets) && has_key(snippets, tag_name)
111 126
       let snippet = snippets[tag_name]
112  
-      let snippet = substitute(snippet, '|', '${cursor}', 'g')
  127
+      if use_pipe_for_cursor
  128
+        let snippet = substitute(snippet, '|', '${cursor}', 'g')
  129
+      endif
113 130
       let lines = split(snippet, "\n")
114 131
       call map(lines, 'substitute(v:val, "\\(    \\|\\t\\)", indent, "g")')
115 132
       let current.snippet = join(lines, "\n")
@@ -123,14 +140,26 @@ function! s:zen_parseIntoTree(abbr, type)
123 140
         if has_key(default_attributes, pat)
124 141
           if type(default_attributes[pat]) == 4
125 142
             let a = default_attributes[pat]
126  
-            for k in keys(a)
127  
-              let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}'
128  
-            endfor
129  
-          else
130  
-            for a in default_attributes[pat]
  143
+            if use_pipe_for_cursor
131 144
               for k in keys(a)
132 145
                 let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}'
133 146
               endfor
  147
+            else
  148
+              for k in keys(a)
  149
+                let current.attr[k] = a[k]
  150
+              endfor
  151
+            endif
  152
+          else
  153
+            for a in default_attributes[pat]
  154
+              if use_pipe_for_cursor
  155
+                for k in keys(a)
  156
+                  let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}'
  157
+                endfor
  158
+              else
  159
+                for k in keys(a)
  160
+                  let current.attr[k] = a[k]
  161
+                endfor
  162
+              endif
134 163
             endfor
135 164
           endif
136 165
           if has_key(s:zen_settings.html.default_attributes, current.name)
@@ -251,17 +280,17 @@ function! s:zen_parseIntoTree(abbr, type)
251 280
     let abbr = abbr[stridx(abbr, match) + len(match):]
252 281
 
253 282
     if g:zencoding_debug > 1
254  
-      echo "str=".str
255  
-      echo "block_start=".block_start
256  
-      echo "tag_name=".tag_name
257  
-      echo "operator=".operator
258  
-      echo "attributes=".attributes
259  
-      echo "value=".value
260  
-      echo "multiplier=".multiplier
261  
-      echo "block_end=".block_end
262  
-      echo "abbr=".abbr
263  
-      echo "pos=".string(pos)
264  
-      echo "\n"
  283
+      echomsg "str=".str
  284
+      echomsg "block_start=".block_start
  285
+      echomsg "tag_name=".tag_name
  286
+      echomsg "operator=".operator
  287
+      echomsg "attributes=".attributes
  288
+      echomsg "value=".value
  289
+      echomsg "multiplier=".multiplier
  290
+      echomsg "block_end=".block_end
  291
+      echomsg "abbr=".abbr
  292
+      echomsg "pos=".string(pos)
  293
+      echomsg "---"
265 294
     endif
266 295
   endwhile
267 296
   return root
@@ -269,18 +298,19 @@ endfunction
269 298
 
270 299
 function! s:zen_parseTag(tag)
271 300
   let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0 }
272  
-  let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|["''][^"'']*["'']\)\s*\)*\)\(/\{0,1}\)>'
  301
+  let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|"[^"]\{-}"\|''[^'']\{-}''\)\s*\)*\)\(/\{0,1}\)>'
273 302
   let match = matchstr(a:tag, mx)
274 303
   let current.name = substitute(match, mx, '\1', 'i')
275 304
   let attrs = substitute(match, mx, '\2', 'i')
276  
-  let mx = '\([a-zA-Z0-9]\+\)=["'']\{0,1}\([^"'' \t]*\|[^"'']\+\)["'']\{0,1}'
  305
+  let mx = '\([a-zA-Z0-9]\+\)=\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
277 306
   while len(attrs) > 0
278 307
     let match = matchstr(attrs, mx)
279 308
     if len(match) == 0
280 309
       break
281 310
     endif
282  
-    let name = substitute(match, mx, '\1', 'i')
283  
-    let value = substitute(match, mx, '\2', 'i')
  311
+    let attr_match = matchlist(match, mx)
  312
+    let name = attr_match[1]
  313
+    let value = len(attr_match[2]) ? attr_match[2] : attr_match[3]
284 314
     let current.attr[name] = value
285 315
     let attrs = attrs[stridx(attrs, match) + len(match):]
286 316
   endwhile
@@ -316,7 +346,6 @@ function! s:zen_mergeConfig(lhs, rhs)
316 346
   endif
317 347
 endfunction
318 348
 
319  
-
320 349
 function! s:zen_toString_haml(settings, current, type, inline, filters, itemno, indent)
321 350
   let settings = a:settings
322 351
   let current = a:current
@@ -329,16 +358,17 @@ function! s:zen_toString_haml(settings, current, type, inline, filters, itemno,
329 358
 
330 359
   let comment_indent = ''
331 360
   let comment = ''
  361
+  let current_name = current.name
  362
+  let current_name = substitute(current.name, '\$$', itemno+1, '')
332 363
   if len(current.name) > 0
333  
-    let str .= '%' . current.name
  364
+    let str .= '%' . current_name
334 365
     let tmp = ''
335 366
     for attr in keys(current.attr)
336 367
       let val = current.attr[attr]
337  
-      if current.multiplier > 1
338  
-        while val =~ '\$\([^{]\|$\)'
339  
-          let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
340  
-        endwhile
341  
-      endif
  368
+      while val =~ '\$\([^#{]\|$\)'
  369
+        let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
  370
+      endwhile
  371
+      let attr = substitute(attr, '\$$', itemno+1, '')
342 372
       if attr == 'id'
343 373
         let str .= '#' . val
344 374
       elseif attr == 'class'
@@ -351,7 +381,7 @@ function! s:zen_toString_haml(settings, current, type, inline, filters, itemno,
351 381
     if len(tmp)
352 382
       let str .= '{' . tmp . ' }'
353 383
     endif
354  
-    if stridx(','.settings.html.empty_elements.',', ','.current.name.',') != -1 && len(current.value) == 0
  384
+    if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 && len(current.value) == 0
355 385
       let str .= "/"
356 386
     endif
357 387
 
@@ -382,6 +412,10 @@ function! s:zen_toString_haml(settings, current, type, inline, filters, itemno,
382 412
   return str
383 413
 endfunction
384 414
 
  415
+function! s:zen_toString_css(settings, current, type, inline, filters, itemno, indent)
  416
+  return ''
  417
+endfunction
  418
+
385 419
 function! s:zen_toString_html(settings, current, type, inline, filters, itemno, indent)
386 420
   let settings = a:settings
387 421
   let current = a:current
@@ -397,17 +431,18 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno,
397 431
   if s:zen_useFilter(filters, 'c')
398 432
     let comment_indent = substitute(str, '^.*\(\s*\)$', '\1', '')
399 433
   endif
400  
-  let tmp = '<' . current.name
  434
+  let current_name = current.name
  435
+  let current_name = substitute(current.name, '\$$', itemno+1, '')
  436
+  let tmp = '<' . current_name
401 437
   for attr in keys(current.attr)
402  
-    if current.name =~ '^\(xsl:with-param\|xsl:variable\)$' && s:zen_useFilter(filters, 'xsl') && len(current.child) && attr == 'select'
  438
+    if current_name =~ '^\(xsl:with-param\|xsl:variable\)$' && s:zen_useFilter(filters, 'xsl') && len(current.child) && attr == 'select'
403 439
       continue
404 440
     endif
405 441
     let val = current.attr[attr]
406  
-    if current.multiplier > 1
407  
-      while val =~ '\$\([^{]\|$\)'
408  
-        let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
409  
-      endwhile
410  
-    endif
  442
+    while val =~ '\$\([^#{]\|$\)'
  443
+      let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
  444
+    endwhile
  445
+    let attr = substitute(attr, '\$$', itemno+1, '')
411 446
     let tmp .= ' ' . attr . '="' . val . '"'
412 447
     if s:zen_useFilter(filters, 'c')
413 448
       if attr == 'id' | let comment .= '#' . val | endif
@@ -419,7 +454,7 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno,
419 454
   endif
420 455
   let str .= tmp
421 456
   let inner = current.value[1:-2]
422  
-  if stridx(','.settings.html.inline_elements.',', ','.current.name.',') != -1
  457
+  if stridx(','.settings.html.inline_elements.',', ','.current_name.',') != -1
423 458
     let child_inline = 1
424 459
   else
425 460
     let child_inline = 0
@@ -432,39 +467,43 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno,
432 467
     let inner .= html
433 468
   endfor
434 469
   if len(current.child) == 1 && current.child[0].name == ''
435  
-    if stridx(','.settings.html.inline_elements.',', ','.current.name.',') == -1
436  
-      let str .= ">" . inner . "</" . current.name . ">\n"
  470
+    if stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
  471
+      let str .= ">" . inner . "</" . current_name . ">\n"
437 472
     else
438  
-      let str .= ">" . inner . "</" . current.name . ">"
  473
+      let str .= ">" . inner . "</" . current_name . ">"
439 474
     endif
440 475
   elseif len(current.child)
441 476
     if inline == 0
442  
-      if stridx(','.settings.html.inline_elements.',', ','.current.name.',') == -1
443  
-        let inner = substitute(inner, "\n", "\n" . indent, 'g')
444  
-        let inner = substitute(inner, indent . "$", "", 'g')
445  
-        let str .= ">\n" . indent . inner . "</" . current.name . ">\n"
  477
+      if stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
  478
+        if inner =~ "\n$"
  479
+          let inner = substitute(inner, "\n", "\n" . indent, 'g')
  480
+          let inner = substitute(inner, indent . "$", "", 'g')
  481
+          let str .= ">\n" . indent . inner . "</" . current_name . ">\n"
  482
+        else
  483
+          let str .= ">\n" . indent . inner . indent . "\n</" . current_name . ">\n"
  484
+        endif
446 485
       else
447  
-        let str .= ">" . inner . "</" . current.name . ">\n"
  486
+        let str .= ">" . inner . "</" . current_name . ">\n"
448 487
       endif
449 488
     else
450  
-      let str .= ">" . inner . "</" . current.name . ">"
  489
+      let str .= ">" . inner . "</" . current_name . ">"
451 490
     endif
452 491
   else
453 492
     if inline == 0
454  
-      if stridx(','.settings.html.empty_elements.',', ','.current.name.',') != -1
  493
+      if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1
455 494
         let str .= " />\n"
456 495
       else
457  
-        if stridx(','.settings.html.inline_elements.',', ','.current.name.',') == -1 && len(current.child)
458  
-          let str .= ">\n" . inner . '${cursor}</' . current.name . ">\n"
  496
+        if stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1 && len(current.child)
  497
+          let str .= ">\n" . inner . '${cursor}</' . current_name . ">\n"
459 498
         else
460  
-          let str .= ">" . inner . '${cursor}</' . current.name . ">\n"
  499
+          let str .= ">" . inner . '${cursor}</' . current_name . ">\n"
461 500
         endif
462 501
       endif
463 502
     else
464  
-      if stridx(','.settings.html.empty_elements.',', ','.current.name.',') != -1
  503
+      if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1
465 504
         let str .= " />"
466 505
       else
467  
-        let str .= ">" . inner . '${cursor}</' . current.name . ">"
  506
+        let str .= ">" . inner . '${cursor}</' . current_name . ">"
468 507
       endif
469 508
     endif
470 509
   endif
@@ -507,15 +546,23 @@ function! s:zen_toString(...)
507 546
   endif
508 547
   let itemno = 0
509 548
   let str = ''
  549
+  let use_pipe_for_cursor = s:zen_getResource(type, 'use_pipe_for_cursor', 1)
510 550
   while itemno < current.multiplier
511 551
     if len(current.name)
  552
+      let inner = ''
512 553
       if exists('*g:zen_toString_'.type)
513  
-        let str .= function('g:zen_toString_'.type)(s:zen_settings, current, type, inline, filters, itemno, indent)
  554
+        let inner = function('g:zen_toString_'.type)(s:zen_settings, current, type, inline, filters, itemno, indent)
  555
+      elseif s:zen_isExtends(type, "css")
  556
+        let inner = s:zen_toString_css(s:zen_settings, current, type, inline, filters, itemno, indent)
514 557
       elseif s:zen_useFilter(filters, 'haml')
515  
-        let str .= s:zen_toString_haml(s:zen_settings, current, type, inline, filters, itemno, indent)
  558
+        let inner = s:zen_toString_haml(s:zen_settings, current, type, inline, filters, itemno, indent)
516 559
       else
517  
-        let str .= s:zen_toString_html(s:zen_settings, current, type, inline, filters, itemno, indent)
  560
+        let inner = s:zen_toString_html(s:zen_settings, current, type, inline, filters, itemno, indent)
  561
+      endif
  562
+      if current.multiplier > 1
  563
+        let inner = substitute(inner, '\$#', '$line'.(itemno+1).'$', 'g')
518 564
       endif
  565
+      let str .= inner
519 566
     else
520 567
       let snippet = current.snippet
521 568
       if len(current.snippet) == 0
@@ -525,10 +572,16 @@ function! s:zen_toString(...)
525 572
         endif
526 573
       endif
527 574
       if len(snippet) > 0
528  
-        let tmp = substitute(snippet, '|', '${cursor}', 'g')
  575
+        let tmp = snippet
  576
+        if use_pipe_for_cursor
  577
+          let tmp = substitute(tmp, '|', '${cursor}', 'g')
  578
+        endif
529 579
         let tmp = substitute(tmp, '\${zenname}', current.name, 'g')
530  
-        if type == 'css' && s:zen_useFilter(filters, 'fc')
531  
-          let tmp = substitute(tmp, '^\([^:]\+\):\(.*\)$', '\1: \2', '')
  580
+        if s:zen_isExtends(type, "css") && s:zen_useFilter(filters, 'fc')
  581
+          let tmp = substitute(tmp, '^\([^:]\+\):\([^;]*;\)', '\1: \2', '')
  582
+          if current.important
  583
+            let tmp = substitute(tmp, ';', ' !important;', '')
  584
+          endif
532 585
         endif
533 586
         for attr in keys(current.attr)
534 587
           let val = current.attr[attr]
@@ -569,7 +622,12 @@ function! s:zen_getResource(type, name, default)
569 622
   let ret = a:default
570 623
 
571 624
   if has_key(s:zen_settings[a:type], a:name)
572  
-    call s:zen_mergeConfig(ret, s:zen_settings[a:type][a:name])
  625
+    let v = s:zen_settings[a:type][a:name]
  626
+    if type(ret) == 3 || type(ret) == 4
  627
+      call s:zen_mergeConfig(ret, s:zen_settings[a:type][a:name])
  628
+    else
  629
+      let ret = s:zen_settings[a:type][a:name]
  630
+    endif
573 631
   endif
574 632
 
575 633
   if has_key(s:zen_settings[a:type], 'extends')
@@ -591,6 +649,9 @@ endfunction
591 649
 function! s:zen_getFileType()
592 650
   let type = &ft
593 651
   if type == 'xslt' | let type = 'xsl' | endif
  652
+  if type == 'htmldjango' | let type = 'html' | endif
  653
+  if type == 'html.django_template' | let type = 'html' | endif
  654
+  if type == 'scss' | let type = 'css' | endif
594 655
   if synIDattr(synID(line("."), col("."), 1), "name") =~ '^css'
595 656
     let type = 'css'
596 657
   endif
@@ -624,13 +685,16 @@ function! zencoding#expandAbbr(mode) range
624 685
     if len(leader) == 0
625 686
       return
626 687
     endif
627  
-    let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\)\s*,\{0,1}\s*\)*$'
  688
+    let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\|t\)\s*,\{0,1}\s*\)*$'
628 689
     if leader =~ mx
629 690
       let filters = split(matchstr(leader, mx)[1:], '\s*,\s*')
630 691
       let leader = substitute(leader, mx, '', '')
631 692
     endif
632 693
     if leader =~ '\*'
633  
-      let query = substitute(leader, '*', '*' . (a:lastline - a:firstline + 1), '') . '>{$line$}'
  694
+      let query = substitute(leader, '*', '*' . (a:lastline - a:firstline + 1), '')
  695
+      if query !~ '}\s*$'
  696
+        let query .= '>{$#}'
  697
+      endif
634 698
       let items = s:zen_parseIntoTree(query, type).child
635 699
       for item in items
636 700
         let expand .= s:zen_toString(item, type, 0, filters)
@@ -639,15 +703,17 @@ function! zencoding#expandAbbr(mode) range
639 703
       let part = substitute(line, '^\s*', '', '')
640 704
       for n in range(a:firstline, a:lastline)
641 705
         let lline = getline(n)
642  
-        let lpart = substitute(lline, '^\s*', '', '')
643  
-        let pos = stridx(expand, "$line$")
644  
-        if pos != -1
645  
-          let expand = expand[:pos-1] . lpart . expand[pos+6:]
  706
+        let lpart = substitute(lline, '^\s\+', '', '')
  707
+        if s:zen_useFilter(filters, 't')
  708
+          let lpart = substitute(lpart, '^[0-9.-]\+\s\+', '', '')
  709
+          let lpart = substitute(lpart, '\s\+$', '', '')
646 710
         endif
  711
+        let expand = substitute(expand, '\$line'.(n-a:firstline+1).'\$', lpart, 'g')
647 712
       endfor
  713
+      let expand = substitute(expand, '\$line\d*\$', '', 'g')
648 714
     else
649 715
       let str = ''
650  
-      if a:firstline != a:lastline
  716
+      if visualmode() ==# 'V'
651 717
         let line = getline(a:firstline)
652 718
         let part = substitute(line, '^\s*', '', '')
653 719
         for n in range(a:firstline, a:lastline)
@@ -658,23 +724,21 @@ function! zencoding#expandAbbr(mode) range
658 724
             let str .= lpart . "\n"
659 725
           endif
660 726
         endfor
661  
-        if len(leader)
662  
-          let items = s:zen_parseIntoTree(leader, type).child
663  
-          let items[0].value = "{\n".str."}"
664  
-        else
665  
-          let items = s:zen_parseIntoTree(leader, type).child
666  
-          let items[0].value = "{".str."}"
667  
-        endif
668  
-      else
669  
-        let str .= getline(a:firstline)
  727
+        let leader .= (str =~ "\n" ? ">{\n" : "{") . str . "}"
670 728
         let items = s:zen_parseIntoTree(leader, type).child
671  
-        let items[0].value = "{".str."}"
  729
+      else
  730
+        let save_regcont = @"
  731
+        let save_regtype = getregtype('"')
  732
+        silent! normal! gvygv
  733
+        let str = @"
  734
+        call setreg('"', save_regcont, save_regtype)
  735
+        "let str .= getline(a:firstline)
  736
+        let items = s:zen_parseIntoTree(leader . "{".str."}", type).child
672 737
       endif
673 738
       for item in items
674 739
         let expand .= s:zen_toString(item, type, 0, filters)
675 740
       endfor
676 741
     endif
677  
-    silent! exe "normal! gvc"
678 742
   else
679 743
     let line = getline('.')
680 744
     if col('.') < len(line)
@@ -684,10 +748,17 @@ function! zencoding#expandAbbr(mode) range
684 748
       let part = matchstr(line, '\([a-zA-Z0-9_\@:|]\+\)$')
685 749
     else
686 750
       let part = matchstr(line, '\(\S.*\)$')
  751
+      if s:zen_isExtends(type, "html")
  752
+        while part =~ '<.\{-}>'
  753
+          let part = substitute(part, '^.*<.\{-}>', '', '')
  754
+        endwhile
  755
+      elseif s:zen_isExtends(type, "css")
  756
+        let part = substitute(part, '^.*[;{]\s*', '', '')
  757
+      endif
687 758
     endif
688 759
     let rest = getline('.')[len(line):]
689 760
     let str = part
690  
-    let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\)\s*,\{0,1}\s*\)*$'
  761
+    let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\|t\)\s*,\{0,1}\s*\)*$'
691 762
     if str =~ mx
692 763
       let filters = split(matchstr(str, mx)[1:], '\s*,\s*')
693 764
       let str = substitute(str, mx, '', '')
@@ -696,6 +767,7 @@ function! zencoding#expandAbbr(mode) range
696 767
     for item in items
697 768
       let expand .= s:zen_toString(item, type, 0, filters)
698 769
     endfor
  770
+    let expand = substitute(expand, '\$line\([0-9]\+\)\$', '\=submatch(1)', 'g')
699 771
   endif
700 772
   if len(expand)
701 773
     if expand !~ '\${cursor}'
@@ -707,28 +779,51 @@ function! zencoding#expandAbbr(mode) range
707 779
     endif
708 780
     let expand = substitute(expand, '${lang}', s:zen_settings.lang, 'g')
709 781
     let expand = substitute(expand, '${charset}', s:zen_settings.charset, 'g')
710  
-    let expand = substitute(expand, '\${cursor}', '$cursor$', '')
711  
-    let expand = substitute(expand, '\${cursor}', '', 'g')
712 782
     if has_key(s:zen_settings, 'timezone') && len(s:zen_settings.timezone)
713 783
       let expand = substitute(expand, '${datetime}', strftime("%Y-%m-%dT%H:%M:%S") . s:zen_settings.timezone, 'g')
714 784
     else
715 785
       " TODO: on windows, %z/%Z is 'Tokyo(Standard)'
716 786
       let expand = substitute(expand, '${datetime}', strftime("%Y-%m-%dT%H:%M:%S %z"), 'g')
717 787
     endif
718  
-    if line[:-len(part)-1] =~ '^\s\+$'
719  
-      let indent = line[:-len(part)-1]
  788
+    if a:mode == 2 && visualmode() ==# 'v'
  789
+      if a:firstline == a:lastline
  790
+        let expand = substitute(expand, '\n\s*', '', 'g')
  791
+      else
  792
+        let expand = substitute(expand, '\n\s*', '\n', 'g')
  793
+        let expand = substitute(expand, '\n$', '', 'g')
  794
+      endif
  795
+      let expand = substitute(expand, '\${cursor}', '$cursor$', '')
  796
+      let expand = substitute(expand, '\${cursor}', '', 'g')
  797
+      silent! normal! gvc
  798
+      let line = getline('.')
  799
+      let lhs = matchstr(line, '.*\%'.col('.').'c.')
  800
+      let rhs = matchstr(line, '\%>'.col('.').'c.*')
  801
+      let expand = lhs.expand.rhs
  802
+      let lines = split(expand, '\n')
  803
+      call setline(line('.'), lines[0])
  804
+      if len(lines) > 1
  805
+        call append(line('.'), lines[1:])
  806
+      endif
720 807
     else
721  
-      let indent = ''
722  
-    endif
723  
-    let expand = substitute(expand, '\n\s*$', '', 'g')
724  
-    let expand = line[:-len(part)-1] . substitute(expand, "\n", "\n" . indent, 'g') . rest
725  
-    let lines = split(expand, '\n')
726  
-    call setline(line('.'), lines[0])
727  
-    if len(lines) > 1
728  
-      call append(line('.'), lines[1:])
  808
+      let expand = substitute(expand, '\${cursor}', '$cursor$', '')
  809
+      let expand = substitute(expand, '\${cursor}', '', 'g')
  810
+      if line[:-len(part)-1] =~ '^\s\+$'
  811
+        let indent = line[:-len(part)-1]
  812
+      else
  813
+        let indent = ''
  814
+      endif
  815
+      let expand = substitute(expand, '\n\s*$', '', 'g')
  816
+      let expand = line[:-len(part)-1] . substitute(expand, "\n", "\n" . indent, 'g') . rest
  817
+      let lines = split(expand, '\n')
  818
+      if a:mode == 2
  819
+        silent! exe "normal! gvc"
  820
+      endif
  821
+      call setline(line('.'), lines[0])
  822
+      if len(lines) > 1
  823
+        call append(line('.'), lines[1:])
  824
+      endif
729 825
     endif
730 826
   endif
731  
-  silent! exe "normal! ".len(part)."h"
732 827
   if search('\$cursor\$', 'e')
733 828
     let oldselection = &selection
734 829
     let &selection = 'inclusive'
@@ -768,7 +863,7 @@ function! zencoding#imageSize()
768 863
   if filereadable(fn)
769 864
     let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g')
770 865
   else
771  
-    let hex = substitute(system('curl -s "'.fn.'" | xxd -p'), '\n', '', 'g')
  866
+    let hex = substitute(system(g:zencoding_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g')
772 867
   endif
773 868
 
774 869
   if hex =~ '^89504e470d0a1a0a'
@@ -813,59 +908,63 @@ function! zencoding#toggleComment()
813 908
     return
814 909
   endif
815 910
 
  911
+  let orgpos = getpos('.')
816 912
   let curpos = getpos('.')
  913
+  let mx = '<\%#[^>]*>'
817 914
   while 1
818  
-    let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9]*\)[^>]*>'
819  
-    let pos1 = searchpos(mx, 'bcnW')
820  
-    let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
821  
-    let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9]*\).*$', '\1', '')
822  
-    let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
823  
-    if content[-2:] == '/>' && s:point_in_region(curpos[1:2], block)
824  
-      let comment_region = s:search_region('<!--', '-->')
825  
-      if !s:region_is_valid(comment_region) || !s:point_in_region(curpos[1:2], comment_region) || !(s:point_in_region(comment_region[0], block) && s:point_in_region(comment_region[1], block))
826  
-        let content = '<!-- ' . s:get_content(block) . ' -->'
827  
-        call s:change_content(block, content)
828  
-      else
829  
-        let content = s:get_content(comment_region)
830  
-        let content = substitute(content, '^<!--\s\(.*\)\s-->$', '\1', '')
831  
-        call s:change_content(comment_region, content)
832  
-      endif
  915
+    let block = s:search_region('<!--', '-->')
  916
+    if s:region_is_valid(block)
  917
+      let block[1][1] += 2
  918
+      let content = s:get_content(block)
  919
+      let content = substitute(content, '^<!--\s\(.*\)\s-->$', '\1', '')
  920
+      call s:change_content(block, content)
  921
+      silent! call setpos('.', orgpos)
833 922
       return
834  
-    else
835  
-      if tag_name[0] == '/'
836  
-        let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW')
837  
-        call setpos('.', [0, pos1[0], pos1[1], 0])
838  
-        let pos2 = searchpos('</' . tag_name[1:] . '>', 'cneW')
839  
-      else
840  
-        let pos2 = searchpos('</' . tag_name . '>', 'cneW')
841  
-      endif
842  
-      let block = [pos1, pos2]
843  
-      if !s:region_is_valid(block)
844  
-        call setpos('.', curpos)
845  
-        let block = s:search_region('<!', '-->')
846  
-        if !s:region_is_valid(block)
847  
-          return
848  
-        endif
  923
+    endif
  924
+    let block = s:search_region('<[^>]', '>')
  925
+    if !s:region_is_valid(block)
  926
+      let pos1 = searchpos('<', 'bcW')
  927
+      if pos1[0] == 0 && pos1[1] == 0
  928
+        return
849 929
       endif
850  
-      if s:point_in_region(curpos[1:2], block)
851  
-        let comment_region = s:search_region('<!--', '-->')
852  
-        if !s:region_is_valid(comment_region) || !s:point_in_region(curpos[1:2], comment_region) || !(s:point_in_region(comment_region[0], block) && s:point_in_region(comment_region[1], block))
853  
-          let content = '<!-- ' . s:get_content(block) . ' -->'
854  
-          call s:change_content(block, content)
855  
-        else
856  
-          let content = s:get_content(comment_region)
857  
-          let content = substitute(content, '^<!--\s\(.*\)\s-->$', '\1', '')
858  
-          call s:change_content(comment_region, content)
859  
-        endif
  930
+      let curpos = getpos('.')
  931
+      continue
  932
+    endif
  933
+    let pos1 = block[0]
  934
+    let pos2 = block[1]
  935
+    let content = s:get_content(block)
  936
+    let tag_name = matchstr(content, '^<\zs/\{0,1}[^ \r\n>]\+')
  937
+    if tag_name[0] == '/'
  938
+      call setpos('.', [0, pos1[0], pos1[1], 0])
  939
+      let pos2 = searchpairpos('<'. tag_name[1:] . '>', '', '</' . tag_name[1:] . '>', 'bnW')
  940
+      let pos1 = searchpos('>', 'cneW')
  941
+      let block = [pos2, pos1]
  942
+    elseif tag_name =~ '/$'
  943
+      if !s:point_in_region(orgpos[1:2], block)
  944
+        " it's broken tree
  945
+        call setpos('.', orgpos)
  946
+        let block = s:search_region('>', '<')
  947
+        let content = '><!-- ' . s:get_content(block)[1:-2] . ' --><'
  948
+        call s:change_content(block, content)
  949
+        silent! call setpos('.', orgpos)
860 950
         return
861  
-      else
862  
-        if block[0][0] > 0
863  
-          call setpos('.', [0, block[0][0]-1, block[0][1], 0])
864  
-        else
865  
-          call setpos('.', curpos)
866  
-          return
867  
-        endif
868 951
       endif
  952
+    else
  953
+      call setpos('.', [0, pos2[0], pos2[1], 0])
  954
+      let pos2 = searchpairpos('<'. tag_name . '>', '', '</' . tag_name . '>', 'nW')
  955
+      call setpos('.', [0, pos2[0], pos2[1], 0])
  956
+      let pos2 = searchpos('>', 'cneW')
  957
+      let block = [pos1, pos2]
  958
+    endif
  959
+    if !s:region_is_valid(block)
  960
+      silent! call setpos('.', orgpos)
  961
+      return
  962
+    endif
  963
+    if s:point_in_region(curpos[1:2], block)
  964
+      let content = '<!-- ' . s:get_content(block) . ' -->'
  965
+      call s:change_content(block, content)
  966
+      silent! call setpos('.', orgpos)
  967
+      return
869 968
     endif
870 969
   endwhile
871 970
 endfunction
@@ -873,10 +972,10 @@ endfunction
873 972
 function! zencoding#splitJoinTag()
874 973
   let curpos = getpos('.')
875 974
   while 1
876  
-    let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9]*\)[^>]*>'
  975
+    let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:]*\)[^>]*>'
877 976
     let pos1 = searchpos(mx, 'bcnW')
878 977
     let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
879  
-    let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9]*\).*$', '\1', '')
  978
+    let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:]*\).*$', '\1', '')
880 979
     let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
881 980
     if content[-2:] == '/>' && s:cursor_in_region(block)
882 981
       let content = content[:-3] . "></" . tag_name . '>'
@@ -910,6 +1009,13 @@ function! zencoding#splitJoinTag()
910 1009
   endwhile
911 1010
 endfunction
912 1011
 
  1012
+function! zencoding#mergeLines() range
  1013
+  let lines = join(map(getline(a:firstline, a:lastline), 'matchstr(v:val, "^\\s*\\zs.*\\ze\\s*$")'), '')
  1014
+  let indent = substitute(getline('.'), '^\(\s*\).*', '\1', '')
  1015
+  silent! exe "normal! gvc"
  1016
+  call setline('.', indent . lines)
  1017
+endfunction
  1018
+
913 1019
 function! zencoding#removeTag()
914 1020
   let curpos = getpos('.')
915 1021
   while 1
@@ -1037,11 +1143,15 @@ function! zencoding#anchorizeURL(flag)
1037 1143
     return
1038 1144
   endif
1039 1145
 
1040  
-  let content = s:get_content_from_url(url)
1041  
-  let content = substitute(content, '\n', '', 'g')
1042  
-  let content = substitute(content, '\n\s*\n', '\n', 'g')
1043  
-  let head = strpart(content, 0, stridx(content, '</head>'))
1044  
-  let title = substitute(head, '.*<title[^>]*>\([^<]\+\)<\/title[^>]*>.*', '\1', 'g')
  1146
+  let mx = '.*<title[^>]*>\s*\zs\([^<]\+\)\ze\s*<\/title[^>]*>.*'
  1147
+  let content = s:get_content_from_url(url, 0)
  1148
+  if len(matchstr(content, mx)) == 0
  1149
+    let content = s:get_content_from_url(url, 1)
  1150
+  endif
  1151
+  let content = substitute(content, '\r', '', 'g')
  1152
+  let content = substitute(content, '[ \n]\+', ' ', 'g')
  1153
+  let content = substitute(content, '<!--.\{-}-->', '', 'g')
  1154
+  let title = matchstr(content, mx)
1045 1155
 
1046 1156
   if a:flag == 0
1047 1157
     let a = s:zen_parseTag('<a>')
@@ -1076,9 +1186,13 @@ endfunction
1076 1186
 "==============================================================================
1077 1187
 " html utils
1078 1188
 "==============================================================================
1079  
-function! s:get_content_from_url(url)
  1189
+function! s:get_content_from_url(url, utf8)
1080 1190
   silent! new
1081  
-  silent! exec '0r!curl -s -L "'.substitute(a:url, '#.*', '', '').'"'
  1191
+  if a:utf8
  1192
+    silent! exec '0r ++enc=utf8 !'.g:zencoding_curl_command.' "'.substitute(a:url, '#.*', '', '').'"'
  1193
+  else
  1194
+    silent! exec '0r!'.g:zencoding_curl_command.' "'.substitute(a:url, '#.*', '', '').'"'
  1195
+  endif
1082 1196
   let ret = join(getline(1, '$'), "\n")
1083 1197
   silent! bw!
1084 1198
   return ret
@@ -1089,7 +1203,6 @@ function! s:get_text_from_html(buf)
1089 1203
   let threshold_per = 0.1
1090 1204
   let buf = a:buf
1091 1205
 
1092  
-  let buf = substitute(buf, '<!--.\{-}-->', '', 'g')
1093 1206
   let buf = strpart(buf, stridx(buf, '</head>'))
1094 1207
   let buf = substitute(buf, '<style[^>]*>.\{-}</style>', '', 'g')
1095 1208
   let buf = substitute(buf, '<script[^>]*>.\{-}</script>', '', 'g')
@@ -1099,7 +1212,7 @@ function! s:get_text_from_html(buf)
1099 1212
   let m = split(buf, mx)
1100 1213
   for str in m
1101 1214
     let c = split(str, '<[^>]*?>')
1102  
-    let str = substitute(str, '<[^>]\{-}>', '', 'g')
  1215
+    let str = substitute(str, '<[^>]\{-}>', ' ', 'g')
1103 1216
     let str = substitute(str, '&gt;', '>', 'g')
1104 1217
     let str = substitute(str, '&lt;', '<', 'g')
1105 1218
     let str = substitute(str, '&quot;', '"', 'g')
@@ -1111,10 +1224,10 @@ function! s:get_text_from_html(buf)
1111 1224
     let str = substitute(str, '\s\+', ' ', 'g')
1112 1225
     let l = len(str)
1113 1226
     if l > threshold_len
1114  
-      let per = len(c) / l
1115  
-      if max < l && per < threshold_per
1116  
-          let max = l
1117  
-          let res = str
  1227
+      let per = (l+0.0) / len(c)
  1228
+      if max < l && per > threshold_per
  1229
+        let max = l
  1230
+        let res = str
1118 1231
       endif
1119 1232
     endif
1120 1233
   endfor
@@ -1162,7 +1275,7 @@ endfunction
1162 1275
 "   baz:end
1163 1276
 "   --------------------
1164 1277
 function! s:change_content(region, content)
1165  
-  let newlines = split(a:content, '\n')
  1278
+  let newlines = split(a:content, '\n', 1)
1166 1279
   let oldlines = getline(a:region[0][0], a:region[1][0])
1167 1280
   call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
1168 1281
   silent! exe "delete ".(a:region[1][0] - a:region[0][0])
@@ -1171,7 +1284,7 @@ function! s:change_content(region, content)
1171 1284
     if a:region[0][1] > 1
1172 1285
       let tmp = oldlines[0][:a:region[0][1]-2]
1173 1286
     endif
1174  
-    if a:region[1][1] > 1
  1287
+    if a:region[1][1] >= 1
1175 1288
       let tmp .= oldlines[-1][a:region[1][1]:]
1176 1289
     endif
1177 1290
     call setline(line('.'), tmp)
@@ -1179,7 +1292,7 @@ function! s:change_content(region, content)
1179 1292
     if a:region[0][1] > 1
1180 1293
       let newlines[0] = oldlines[0][:a:region[0][1]-2] . newlines[0]
1181 1294
     endif
1182  
-    if a:region[1][1] > 1
  1295
+    if a:region[1][1] >= 1
1183 1296
       let newlines[0] .= oldlines[-1][a:region[1][1]:]
1184 1297
     endif
1185 1298
     call setline(line('.'), newlines[0])
@@ -1187,7 +1300,7 @@ function! s:change_content(region, content)
1187 1300
     if a:region[0][1] > 1
1188 1301
       let newlines[0] = oldlines[0][:a:region[0][1]-2] . newlines[0]
1189 1302
     endif
1190  
-    if a:region[1][1] > 1
  1303
+    if a:region[1][1] >= 1
1191 1304
       let newlines[-1] .= oldlines[-1][a:region[1][1]:]
1192 1305
     endif
1193 1306
     call setline(line('.'), newlines[0])
@@ -1232,7 +1345,7 @@ endfunction
1232 1345
 " search_region : make region from pattern which is composing start/end
1233 1346
 "   this function return array of position
1234 1347
 function! s:search_region(start, end)
1235  
-  return [searchpos(a:start, 'bcnW'), searchpos(a:end, 'cneW')]
  1348
+  return [searchpairpos(a:start, '', a:end, 'bcnW'), searchpairpos(a:start, '\%#', a:end, 'nW')]
1236 1349
 endfunction
1237 1350
 
1238 1351
 " get_content : get content in region
@@ -1268,7 +1381,7 @@ endfunction
1268 1381
 "==============================================================================
1269 1382
 
1270 1383
 function! zencoding#ExpandWord(abbr, type, orig)
1271  
-  let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\)\s*,\{0,1}\s*\)*$'
  1384
+  let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\|t\)\s*,\{0,1}\s*\)*$'
1272 1385
   let str = a:abbr
1273 1386
   let type = a:type
1274 1387
 
@@ -1546,11 +1659,13 @@ let s:zen_settings = {
1546 1659
 \            'bdls': 'border-left-style:|;',
1547 1660
 \            'bdls:n': 'border-left-style:none;',
1548 1661
 \            'bdlc': 'border-left-color:#000;',
1549  
-\            'bdrus': 'border-radius:|;',
1550  
-\            'bdtrrs': 'border-top-right-radius:|;',
1551  
-\            'bdtlrs': 'border-top-left-radius:|;',
1552  
-\            'bdbrrs': 'border-bottom-right-radius:|;',
1553  
-\            'bdblrs': 'border-bottom-left-radius:|;',
  1662
+\            'bdrz': 'border-radius:|;',
  1663
+\            'bdtrrz': 'border-top-right-radius:|;',
  1664
+\            'bdtlrz': 'border-top-left-radius:|;',
  1665
+\            'bdbrrz': 'border-bottom-right-radius:|;',
  1666
+\            'bdblrz': 'border-bottom-left-radius:|;',
  1667
+\            'bdrz:w': '-webkit-border-radius:|;',
  1668
+\            'bdrz:m': '-moz-border-radius:|;',
1554 1669
 \            'bg': 'background:|;',
1555 1670
 \            'bg+': 'background:#FFF url(|) 0 0 no-repeat;',
1556 1671
 \            'bg:n': 'background:none;',
@@ -1800,7 +1915,11 @@ let s:zen_settings = {
1800 1915
 \            'pgba:r': 'page-break-after:right;',
1801 1916
 \            'orp': 'orphans:|;',
1802 1917
 \            'wid': 'widows:|;'
1803  
-\        }
  1918
+\        },
  1919
+\        'filters': 'fc'
  1920
+\    },
  1921
+\    'sass': {
  1922
+\        'extends': 'css',
1804 1923
 \    },
1805 1924
 \    'html': {
1806 1925
 \        'snippets': {
@@ -2045,6 +2164,15 @@ let s:zen_settings = {
2045 2164
 \    },
2046 2165
 \    'mustache': {
2047 2166
 \        'extends': 'html'
  2167
+\    },
  2168
+\    'xsd': {
  2169
+\        'extends': 'html',
  2170
+\        'snippets': {
  2171
+\            'xsd:w3c': "<?xml version=\"1.0\"?>\n"
  2172
+\                    ."<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n"
  2173
+\                    ."    <xsd:element name=\"\" type=\"\"/>\n"
  2174
+\                    ."</xsd:schema>\n"
  2175
+\        }
2048 2176
 \    }
2049 2177
 \}
2050 2178
 
7  doc/zencoding.txt
@@ -146,7 +146,7 @@ You should copy this section and create new buffer, paste and write as
146 146
       <li class="list3"></li>
147 147
   </ul>
148 148
 <
149  
-  If cursor is at '*', |<C-Y>d| select from next letter of <ul> to previous
  149
+  If cursor is at '*', |<C-Y>D| select from next letter of <ul> to previous
150 150
   letter of </ul>.
151 151
   If cursor is at first of <li>, it select <li class="list1"></li>.
152 152
 
@@ -195,7 +195,8 @@ You should copy this section and create new buffer, paste and write as
195 195
       <li class="list3"></li>
196 196
   </ul>
197 197
 <
198  
-  If you select part of line include <li> and type |J|, it will be following.
  198
+  If you select part of line include <li> and type |<C-Y>m|, it will be
  199
+  following.
199 200
 >
200 201
   <ul>
201 202
       <li class="list1"></li><li class="list2"></li><li class="list3"></li>
@@ -368,7 +369,7 @@ CUSTOMIZE                                                  *zencoding-customize*
368 369
 <
369 370
 4. Complete Tag                                         *zencoding-complete-tag*
370 371
 
371  
-  If you want to complete tags using |ominifunc| then add this.
  372
+  If you want to complete tags using |omnifunc| then add this.
372 373
 >
373 374
   let g:use_zen_complete_tag = 1
374 375
 <
19  plugin/zencoding.vim
... ...
@@ -1,8 +1,8 @@
1 1
 "=============================================================================
2 2
 " File: zencoding.vim
3 3
 " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
4  
-" Last Change: 25-Jan-2011.
5  
-" Version: 0.53
  4
+" Last Change: 31-Jan-2012.
  5
+" Version: 0.59
6 6
 " WebPage: http://github.com/mattn/zencoding-vim
7 7
 " Description: vim plugins for HTML and CSS hi-speed coding.
8 8
 " SeeAlso: http://code.google.com/p/zen-coding/
@@ -78,6 +78,10 @@ if !exists('g:zencoding_debug')
78 78
   let g:zencoding_debug = 0
79 79
 endif
80 80
 
  81
+if !exists('g:zencoding_curl_command')
  82
+  let g:zencoding_curl_command = 'curl -s -L'
  83
+endif
  84
+
81 85
 if exists('g:use_zen_complete_tag') && g:use_zen_complete_tag
82 86
   setlocal omnifunc=zencoding#CompleteTag
83 87
 endif
@@ -107,6 +111,7 @@ function! s:install_plugin()
107 111
   \ {'mode': 'n', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': ':call zencoding#imageSize()<cr>'},
108 112
   \ {'mode': 'i', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': '<esc>:call zencoding#toggleComment()<cr>a'},
109 113
   \ {'mode': 'n', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zencoding#toggleComment()<cr>'},
  114
+  \ {'mode': 'v', 'var': 'user_zen_mergelines_key', 'key': 'm', 'plug': 'ZenCodingMergeLines', 'func': ':call zencoding#mergeLines()<cr>'},
110 115
   \ {'mode': 'i', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagInsert', 'func': '<esc>:call zencoding#splitJoinTag()<cr>a'},
111 116
   \ {'mode': 'n', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagNormal', 'func': ':call zencoding#splitJoinTag()<cr>'},
112 117
   \ {'mode': 'i', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': '<esc>:call zencoding#removeTag()<cr>a'},
@@ -121,10 +126,14 @@ function! s:install_plugin()
121 126
       exe item.mode . 'noremap <plug>' . item.plug . ' ' . item.func
122 127
     endif
123 128
     if !exists('g:' . item.var)
124  
-      exe 'let g:' . item.var . " = '" . g:user_zen_leader_key . item.key . "'"
125 129
     endif
126  
-    if len(maparg(eval('g:' . item.var), item.mode)) == 0
127  
-      exe item.mode . 'map <unique> ' . eval('g:' . item.var) . ' <plug>' . item.plug
  130
+    if exists('g:' . item.var)
  131
+      let key = eval('g:' . item.var)
  132
+    else
  133
+      let key = g:user_zen_leader_key . item.key
  134
+    endif
  135
+    if len(maparg(key, item.mode)) == 0
  136
+      exe item.mode . 'map <unique> ' . key . ' <plug>' . item.plug
128 137
     endif
129 138
   endfor
130 139
 endfunction

0 notes on commit 65a79f1

Please sign in to comment.
Something went wrong with that request. Please try again.