Make s:g() return default optional values. Close #186.

This commit is contained in:
Israel Chauca Fuentes
2014-11-30 11:40:19 -05:00
parent eafd832c04
commit 4c13ed6aee
2 changed files with 10 additions and 10 deletions

View File

@@ -29,14 +29,14 @@ function! s:s(name, value, ...) "{{{
endfunction "}}} endfunction "}}}
function! s:g(name, ...) "{{{ function! s:g(name, ...) "{{{
let scope = a:0 ? a:1 : 's' if a:0 == 2
if scope == 's' return deepcopy(get(a:2, 'delimitMate_' . a:name, a:1))
let bufnr = bufnr('%') elseif a:0 == 1
let name = 'options.' . bufnr . '.' . a:name let bufoptions = get(s:options, bufnr('%'), {})
return deepcopy(get(bufoptions, a:name, a:1))
else else
let name = 'delimitMate_' . a:name return deepcopy(eval('s:options.' . bufnr('%') . '.' . a:name))
endif endif
return deepcopy(eval(scope . ':' . name))
endfunction "}}} endfunction "}}}
function! s:exists(name, ...) "{{{ function! s:exists(name, ...) "{{{

View File

@@ -182,10 +182,10 @@ endfunction "}}} Map()
function! s:Unmap() " {{{ function! s:Unmap() " {{{
let imaps = let imaps =
\ s:g('right_delims') + \ s:g('right_delims', []) +
\ s:g('left_delims') + \ s:g('left_delims', []) +
\ s:g('quotes_list') + \ s:g('quotes_list', []) +
\ s:g('apostrophes_list') + \ s:g('apostrophes_list', []) +
\ ['<BS>', '<C-h>', '<S-BS>', '<Del>', '<CR>', '<Space>', '<S-Tab>', '<Esc>'] + \ ['<BS>', '<C-h>', '<S-BS>', '<Del>', '<CR>', '<Space>', '<S-Tab>', '<Esc>'] +
\ ['<Up>', '<Down>', '<Left>', '<Right>', '<LeftMouse>', '<RightMouse>'] + \ ['<Up>', '<Down>', '<Left>', '<Right>', '<LeftMouse>', '<RightMouse>'] +
\ ['<C-Left>', '<C-Right>'] + \ ['<C-Left>', '<C-Right>'] +