calculate 'indentation' from shiftwidth. close #78

This commit is contained in:
mattn
2012-06-04 16:37:24 +09:00
parent 3d3ae065eb
commit d3f4db7367
4 changed files with 23 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
"=============================================================================
" zencoding.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 03-Jun-2012.
" Last Change: 04-Jun-2012.
let s:save_cpo = &cpo
set cpo&vim
@@ -23,6 +23,22 @@ function! zencoding#useFilter(filters, filter)
return 0
endfunction
function! zencoding#getIndentation(...)
if a:0 > 0
let type = a:1
else
let type = zencoding#getFileType()
endif
if has_key(s:zen_settings, type) && has_key(s:zen_settings[type], 'indentation')
let indent = s:zen_settings[type].indentation
elseif has_key(s:zen_settings, 'indentation')
let indent = s:zen_settings.indentation
else
let indent = (&l:expandtab || &l:tabstop != &l:shiftwidth) ? repeat(' ', &l:shiftwidth) : "\t"
endif
return indent
endfunction
function! zencoding#isExtends(type, extend)
if a:type == a:extend
return 1
@@ -106,11 +122,7 @@ function! zencoding#toString(...)
let filters = ['html']
endif
if has_key(s:zen_settings, type) && has_key(s:zen_settings[type], 'indentation')
let indent = s:zen_settings[type].indentation
else
let indent = s:zen_settings.indentation
endif
let indent = zencoding#getIndentation(type)
let itemno = 0
let str = ''
let use_pipe_for_cursor = zencoding#getResource(type, 'use_pipe_for_cursor', 1)
@@ -599,7 +611,6 @@ endfunction
unlet! s:zen_settings
let s:zen_settings = {
\ 'indentation': "\t",
\ 'lang': "en",
\ 'charset': "UTF-8",
\ 'css': {