diff --git a/zencoding.vim b/zencoding.vim index f1368c1..3a98ffe 100644 --- a/zencoding.vim +++ b/zencoding.vim @@ -86,7 +86,8 @@ for item in [ \ {'mode': 'n', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutward', 'func': ':call zen_balanceTag(1)'}, \ {'mode': 'i', 'var': 'user_zen_next_key', 'key': 'n', 'plug': 'ZenCodingNext', 'func': ':call zen_moveNextPrev(0)'}, \ {'mode': 'i', 'var': 'user_zen_prev_key', 'key': 'N', 'plug': 'ZenCodingPrev', 'func': ':call zen_moveNextPrev(1)'}, -\ {'mode': 'i', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': ':call zen_imageSize()'}, +\ {'mode': 'i', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': ':call zen_imageSize()a'}, +\ {'mode': 'n', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': ':call zen_imageSize()'}, \ {'mode': 'i', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zen_toggleComment()a'}, \ {'mode': 'n', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zen_toggleComment()'}, \ {'mode': 'i', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagInsert', 'func': ':call zen_splitJoinTag()a'}, @@ -1384,8 +1385,19 @@ function! s:zen_balanceTag(flag) call s:select_region(block) else if tag_name[0] == '/' - let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW') - let pos2 = searchpos('', 'cneW') + let tag_name = tag_name[1:] + let pos1 = searchpos('<' . tag_name . '[^a-zA-Z0-9]*[^>]*>', 'bcnW') + let mx = '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>' + endif + if a:flag + let l = getline(pos1[0]) + let content = matchstr(l[pos1[1]-1:], mx) + if pos1[1] + len(content) > len(l) + let pos1[0] += 1 + else + let pos1[1] += len(content) + 1 + endif + let pos2 = searchpos('\n\{0,1}', 'cnW') else let pos2 = searchpos('', 'cneW') endif