diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim index aabd2eea..31b58c44 100644 --- a/autoload/nerdtree/ui_glue.vim +++ b/autoload/nerdtree/ui_glue.vim @@ -108,24 +108,24 @@ function! s:customOpenBookmark(node) abort endfunction "FUNCTION: s:initCustomOpenArgs() {{{1 -" Make sure NERDTreeCustomOpenArgs has needed keys function! s:initCustomOpenArgs() abort let l:defaultOpenArgs = {'file': {'reuse': 'all', 'where': 'p'}, 'dir': {}} let l:customOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {}) - return extend(l:customOpenArgs, l:defaultOpenArgs, 'keep') - if v:false is# s:validateType(l:customOpenArgs, v:t_dict) + if !s:validateType(l:customOpenArgs, type({})) || empty(l:customOpenArgs) + let g:NERDTreeCustomOpenArgs = l:customOpenArgs return l:defaultOpenArgs endif for l:typeKey in keys(l:defaultOpenArgs) - if v:false is# s:validateType(get(l:customOpenArgs, l:typeKey, {}), v:t_dict) + if !s:validateType(get(l:customOpenArgs, l:typeKey, {}), type({})) + \ || !has_key(l:customOpenArgs, l:typeKey) let l:customOpenArgs[l:typeKey] = l:defaultOpenArgs[l:typeKey] continue endif for l:optionName in keys(l:defaultOpenArgs[l:typeKey]) - if s:validateType(get(l:customOpenArgs[l:typeKey], l:optionName, v:null), v:t_string) + if s:validateType(get(l:customOpenArgs[l:typeKey], l:optionName, v:null), type('')) continue endif let l:customOpenArgs[l:typeKey][l:optionName] = l:defaultOpenArgs[l:typeKey][l:optionName] @@ -138,7 +138,7 @@ function! s:initCustomOpenArgs() abort endfunction function! s:validateType(variable, type) abort - if type(a:variable) is# a:type + if type(a:variable) == a:type return v:true endif