mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2025-12-07 13:14:34 +08:00
Backwards compatibility with init_indent
This commit is contained in:
@@ -7,13 +7,13 @@ function! s:GetConfig(name, default)
|
||||
let value = exists(name) ? eval(name) : a:default
|
||||
|
||||
if a:name == 'config'
|
||||
let value = s:MergeDefaultWithConfig(value)
|
||||
let value = s:MergeDefaultWithUserConfig(value)
|
||||
endif
|
||||
|
||||
return value
|
||||
endfunction
|
||||
|
||||
function! s:MergeDefaultWithConfig(user)
|
||||
function! s:MergeDefaultWithUserConfig(user)
|
||||
let default = {
|
||||
\'syntax': {
|
||||
\ 'script': ['javascript'],
|
||||
@@ -34,6 +34,16 @@ function! s:MergeDefaultWithConfig(user)
|
||||
let default[key] = user[key]
|
||||
endif
|
||||
endfor
|
||||
|
||||
" For backwards compatibility with 'init_indent'
|
||||
if !has_key(user, 'initial_indent')
|
||||
if has_key(user, 'init_indent')
|
||||
\ ? user.init_indent
|
||||
\ : expand('%:e') == 'wpy'
|
||||
let default.initial_indent = ['script', 'style']
|
||||
endif
|
||||
endif
|
||||
|
||||
return default
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -7,13 +7,9 @@ let s:config = vue#GetConfig('config', {})
|
||||
let s:keyword = s:config.keyword
|
||||
let s:initial_indent = s:config.initial_indent
|
||||
|
||||
let s:enable_initial_indent = 0
|
||||
for item in s:initial_indent
|
||||
if match(item, 'script') != -1
|
||||
let s:enable_initial_indent = 1
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
let s:enable_initial_indent = count(s:initial_indent, 'script')
|
||||
\ || count(s:initial_indent, 'javascript')
|
||||
\ || count(s:initial_indent, 'script.javascript')
|
||||
"}}}
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Reference in New Issue
Block a user