Generalize getting extension vars

This commit is contained in:
Kien N 2012-04-08 12:08:01 +07:00
parent 194987f331
commit 349e5afc4f

View File

@ -818,8 +818,7 @@ fu! s:AcceptSelection(mode)
en en
if empty(line) | retu | en if empty(line) | retu | en
" Do something with it " Do something with it
let actfunc = s:itemtype < 3 ? 'ctrlp#acceptfile' let actfunc = s:itemtype < 3 ? 'ctrlp#acceptfile' : s:getextvar('accept')
\ : g:ctrlp_ext_vars[s:itemtype - 3]['accept']
cal call(actfunc, [a:mode, line]) cal call(actfunc, [a:mode, line])
endf endf
" - CreateNewFile() {{{1 " - CreateNewFile() {{{1
@ -1115,8 +1114,7 @@ fu! s:lash(...)
endf endf
fu! s:ispathitem() fu! s:ispathitem()
retu s:itemtype < 3 || retu s:itemtype < 3 || ( s:itemtype > 2 && s:getextvar('type') == 'path' )
\ ( s:itemtype > 2 && g:ctrlp_ext_vars[s:itemtype - 3]['type'] == 'path' )
endf endf
fu! ctrlp#dirnfile(entries) fu! ctrlp#dirnfile(entries)
@ -1586,8 +1584,7 @@ fu! s:insertcache(str)
endf endf
" Extensions {{{2 " Extensions {{{2
fu! s:mtype() fu! s:mtype()
retu s:itemtype > 2 retu s:itemtype > 2 ? s:getextvar('type') : 'path'
\ ? g:ctrlp_ext_vars[s:itemtype - 3]['type'] : 'path'
endf endf
fu! s:execextvar(key) fu! s:execextvar(key)