From 843e99c883c2f4fa15d8ca18a6172cc174cb6604 Mon Sep 17 00:00:00 2001 From: mattn Date: Tue, 5 Jun 2012 01:15:02 +0900 Subject: [PATCH] fix behavour to toggle. --- autoload/zencoding/lang/haml.vim | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/autoload/zencoding/lang/haml.vim b/autoload/zencoding/lang/haml.vim index cd067db..06192c7 100644 --- a/autoload/zencoding/lang/haml.vim +++ b/autoload/zencoding/lang/haml.vim @@ -202,24 +202,29 @@ function! zencoding#lang#haml#splitJoinTag() while n > 0 if getline(n) =~ '^\s*\ze%[a-z]' let line = getline(n) - call setline(n, matchstr(line, '^\s*%\w\+\s*{[^}]*}')) + call setline(n, substitute(line, '^\s*%\w\+\%(\s*{[^}]*}\|\s\)\zs.*', '', '')) let sn = n let n += 1 let ml = len(matchstr(getline(n), '^\s*%[a-z]')) - if getline(n) =~ '^\s*|' - while n < line('$') + if len(matchstr(getline(n), '^\s*')) > ml + while n <= line('$') let l = len(matchstr(getline(n), '^\s*')) if l <= ml break endif exe n "delete" - let n += 1 endwhile call setpos('.', [0, sn, 1, 0]) else + let tag = matchstr(getline(sn), '^\s*%\zs\(\w\+\)') let spaces = matchstr(getline(sn), '^\s*') - call append(sn, spaces . ' | ') - call setpos('.', [0, sn+1, 1, 0]) + let settings = zencoding#getSettings() + if stridx(','.settings.html.inline_elements.',', ','.tag.',') == -1 + call append(sn, spaces . ' ') + call setpos('.', [0, sn+1, 1, 0]) + else + call setpos('.', [0, sn, 1, 0]) + endif startinsert! endif break