mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 03:04:27 +08:00
calculate 'indentation' from shiftwidth. close #78
This commit is contained in:
@@ -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': {
|
||||
|
||||
@@ -7,12 +7,7 @@ function! zencoding#lang#css#parseIntoTree(abbr, type)
|
||||
let type = a:type
|
||||
|
||||
let settings = zencoding#getSettings()
|
||||
|
||||
if has_key(settings[type], 'indentation')
|
||||
let indent = settings[type].indentation
|
||||
else
|
||||
let indent = settings.indentation
|
||||
endif
|
||||
let indent = zencoding#getIndentation(type)
|
||||
|
||||
let root = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0 }
|
||||
|
||||
|
||||
@@ -41,12 +41,7 @@ function! zencoding#lang#html#parseIntoTree(abbr, type)
|
||||
if len(type) == 0 | let type = 'html' | endif
|
||||
|
||||
let settings = zencoding#getSettings()
|
||||
|
||||
if has_key(settings[type], 'indentation')
|
||||
let indent = settings[type].indentation
|
||||
else
|
||||
let indent = settings.indentation
|
||||
endif
|
||||
let indent = zencoding#getIndentation(type)
|
||||
|
||||
" try 'foo' to (foo-x)
|
||||
let rabbr = zencoding#getExpandos(type, abbr)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
if exists('g:user_zen_settings')
|
||||
let s:old_user_zen_settings = g:user_zen_settings
|
||||
unlet! g:user_zen_settings
|
||||
let g:user_zen_settings = { 'indentation': "\t" }
|
||||
endif
|
||||
|
||||
function! s:reload(d)
|
||||
@@ -97,13 +97,13 @@ function! s:testExpandAbbr()
|
||||
unlet! res | let res = zencoding#ExpandWord(query, type, 0)
|
||||
endif
|
||||
if stridx(result, '$$$$') != -1
|
||||
if res == result
|
||||
if res ==# result
|
||||
call s:show_ok()
|
||||
else
|
||||
call s:show_ng(n+1, result, res)
|
||||
endif
|
||||
else
|
||||
if res == result
|
||||
if res ==# result
|
||||
call s:show_ok()
|
||||
else
|
||||
call s:show_ng(n+1, result, res)
|
||||
|
||||
Reference in New Issue
Block a user