added trim filter.

This commit is contained in:
mattn
2011-12-16 09:35:08 +09:00
parent a386d41384
commit c9398065c8

View File

@@ -1,7 +1,7 @@
"=============================================================================
" zencoding.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 15-Dec-2011.
" Last Change: 16-Dec-2011.
let s:save_cpo = &cpo
set cpo&vim
@@ -684,7 +684,7 @@ function! zencoding#expandAbbr(mode) range
if len(leader) == 0
return
endif
let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\)\s*,\{0,1}\s*\)*$'
let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\|t\)\s*,\{0,1}\s*\)*$'
if leader =~ mx
let filters = split(matchstr(leader, mx)[1:], '\s*,\s*')
let leader = substitute(leader, mx, '', '')
@@ -702,7 +702,10 @@ function! zencoding#expandAbbr(mode) range
let part = substitute(line, '^\s*', '', '')
for n in range(a:firstline, a:lastline)
let lline = getline(n)
let lpart = substitute(lline, '^\s*', '', '')
let lpart = substitute(lline, '^\s\+', '', '')
if s:zen_useFilter(filters, 't')
let lpart = substitute(lline, '^[0-9.-]\+\s', '', '')
endif
let expand = substitute(expand, '\$line'.(n-a:firstline+1).'\$', lpart, 'g')
endfor
let expand = substitute(expand, '\$line\d*\$', '', 'g')
@@ -753,7 +756,7 @@ function! zencoding#expandAbbr(mode) range
endif
let rest = getline('.')[len(line):]
let str = part
let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\)\s*,\{0,1}\s*\)*$'
let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\|t\)\s*,\{0,1}\s*\)*$'
if str =~ mx
let filters = split(matchstr(str, mx)[1:], '\s*,\s*')
let str = substitute(str, mx, '', '')
@@ -1359,7 +1362,7 @@ endfunction
"==============================================================================
function! zencoding#ExpandWord(abbr, type, orig)
let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\)\s*,\{0,1}\s*\)*$'
let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\|t\)\s*,\{0,1}\s*\)*$'
let str = a:abbr
let type = a:type