mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-09 03:54:47 +08:00
added trim filter.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" zencoding.vim
|
" zencoding.vim
|
||||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||||
" Last Change: 15-Dec-2011.
|
" Last Change: 16-Dec-2011.
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
@@ -684,7 +684,7 @@ function! zencoding#expandAbbr(mode) range
|
|||||||
if len(leader) == 0
|
if len(leader) == 0
|
||||||
return
|
return
|
||||||
endif
|
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
|
if leader =~ mx
|
||||||
let filters = split(matchstr(leader, mx)[1:], '\s*,\s*')
|
let filters = split(matchstr(leader, mx)[1:], '\s*,\s*')
|
||||||
let leader = substitute(leader, mx, '', '')
|
let leader = substitute(leader, mx, '', '')
|
||||||
@@ -702,7 +702,10 @@ function! zencoding#expandAbbr(mode) range
|
|||||||
let part = substitute(line, '^\s*', '', '')
|
let part = substitute(line, '^\s*', '', '')
|
||||||
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\+', '', '')
|
||||||
|
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')
|
let expand = substitute(expand, '\$line'.(n-a:firstline+1).'\$', lpart, 'g')
|
||||||
endfor
|
endfor
|
||||||
let expand = substitute(expand, '\$line\d*\$', '', 'g')
|
let expand = substitute(expand, '\$line\d*\$', '', 'g')
|
||||||
@@ -753,7 +756,7 @@ function! zencoding#expandAbbr(mode) range
|
|||||||
endif
|
endif
|
||||||
let rest = getline('.')[len(line):]
|
let rest = getline('.')[len(line):]
|
||||||
let str = part
|
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
|
if str =~ mx
|
||||||
let filters = split(matchstr(str, mx)[1:], '\s*,\s*')
|
let filters = split(matchstr(str, mx)[1:], '\s*,\s*')
|
||||||
let str = substitute(str, mx, '', '')
|
let str = substitute(str, mx, '', '')
|
||||||
@@ -1359,7 +1362,7 @@ endfunction
|
|||||||
"==============================================================================
|
"==============================================================================
|
||||||
|
|
||||||
function! zencoding#ExpandWord(abbr, type, orig)
|
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 str = a:abbr
|
||||||
let type = a:type
|
let type = a:type
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user