From 3ce2d835be9728d6fc6996dd57c40347fc46c2cc Mon Sep 17 00:00:00 2001 From: rabidpraxis Date: Sun, 1 May 2011 08:43:30 -0700 Subject: [PATCH] added sass compatibilty --- autoload/zencoding.vim | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/autoload/zencoding.vim b/autoload/zencoding.vim index 790f7ed..dcd0e91 100644 --- a/autoload/zencoding.vim +++ b/autoload/zencoding.vim @@ -317,6 +317,10 @@ function! s:zen_mergeConfig(lhs, rhs) endfunction +function! s:zen_toString_sass(settings, current, type, inline, filters, itemno, indent) + return 'sassed' +endfunction + function! s:zen_toString_haml(settings, current, type, inline, filters, itemno, indent) let settings = a:settings let current = a:current @@ -536,9 +540,13 @@ function! s:zen_toString(...) if len(snippet) > 0 let tmp = substitute(snippet, '|', '${cursor}', 'g') let tmp = substitute(tmp, '\${zenname}', current.name, 'g') + echo type if type == 'css' && s:zen_useFilter(filters, 'fc') let tmp = substitute(tmp, '^\([^:]\+\):\(.*\)$', '\1: \2', '') endif + if type == 'sass' && s:zen_useFilter(filters, 'sass') + let tmp = substitute(tmp, '^\([^:]\+\):\([^;]*\);$', '\1: \2', '') + endif for attr in keys(current.attr) let val = current.attr[attr] let tmp = substitute(tmp, '\${' . attr . '}', val, 'g') @@ -636,7 +644,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 = '|\(\%(sass\|html\|haml\|e\|c\|fc\|xsl\)\s*,\{0,1}\s*\)*$' if leader =~ mx let filters = split(matchstr(leader, mx)[1:], '\s*,\s*') let leader = substitute(leader, mx, '', '') @@ -707,7 +715,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 = '|\(\%(sass\|html\|haml\|e\|c\|fc\|xsl\)\s*,\{0,1}\s*\)*$' if str =~ mx let filters = split(matchstr(str, mx)[1:], '\s*,\s*') let str = substitute(str, mx, '', '') @@ -1295,7 +1303,7 @@ endfunction "============================================================================== function! zencoding#ExpandWord(abbr, type, orig) - let mx = '|\(\%(html\|haml\|e\|c\|fc\|xsl\)\s*,\{0,1}\s*\)*$' + let mx = '|\(\%(sass\|html\|haml\|e\|c\|fc\|xsl\)\s*,\{0,1}\s*\)*$' let str = a:abbr let type = a:type