Add neosnippet#util#get_buffer_config()

This commit is contained in:
Shougo Matsushita 2016-01-18 11:50:11 +09:00
parent b8a1f3a70e
commit 3db55f354d

View File

@ -138,6 +138,20 @@ function! neosnippet#util#parse_options(args, options_list) "{{{
return [args, options]
endfunction"}}}
function! neosnippet#util#get_buffer_config(
\ filetype, buffer_var, user_var, default_var, ...) abort "{{{
let default_val = get(a:000, 0, '')
if exists(a:buffer_var)
return {a:buffer_var}
endif
let filetype = !has_key({a:user_var}, a:filetype)
\ && !has_key(eval(a:default_var), a:filetype) ? '_' : a:filetype
return get({a:user_var}, filetype,
\ get(eval(a:default_var), filetype, default_val))
endfunction"}}}
" Sudo check.
function! neosnippet#util#is_sudo() "{{{