mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2025-12-07 21:24:50 +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
|
let value = exists(name) ? eval(name) : a:default
|
||||||
|
|
||||||
if a:name == 'config'
|
if a:name == 'config'
|
||||||
let value = s:MergeDefaultWithConfig(value)
|
let value = s:MergeDefaultWithUserConfig(value)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return value
|
return value
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:MergeDefaultWithConfig(user)
|
function! s:MergeDefaultWithUserConfig(user)
|
||||||
let default = {
|
let default = {
|
||||||
\'syntax': {
|
\'syntax': {
|
||||||
\ 'script': ['javascript'],
|
\ 'script': ['javascript'],
|
||||||
@@ -34,6 +34,16 @@ function! s:MergeDefaultWithConfig(user)
|
|||||||
let default[key] = user[key]
|
let default[key] = user[key]
|
||||||
endif
|
endif
|
||||||
endfor
|
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
|
return default
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,9 @@ let s:config = vue#GetConfig('config', {})
|
|||||||
let s:keyword = s:config.keyword
|
let s:keyword = s:config.keyword
|
||||||
let s:initial_indent = s:config.initial_indent
|
let s:initial_indent = s:config.initial_indent
|
||||||
|
|
||||||
let s:enable_initial_indent = 0
|
let s:enable_initial_indent = count(s:initial_indent, 'script')
|
||||||
for item in s:initial_indent
|
\ || count(s:initial_indent, 'javascript')
|
||||||
if match(item, 'script') != -1
|
\ || count(s:initial_indent, 'script.javascript')
|
||||||
let s:enable_initial_indent = 1
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|||||||
Reference in New Issue
Block a user