Reinit autocmds

This commit is contained in:
Kien N 2012-03-21 02:34:17 +07:00
parent cbbf03921e
commit 3d5eef8b4e
2 changed files with 28 additions and 16 deletions

View File

@ -225,6 +225,7 @@ endf
fu! ctrlp#reset() fu! ctrlp#reset()
cal s:opts() cal s:opts()
cal s:autocmds()
cal ctrlp#utils#opts() cal ctrlp#utils#opts()
cal ctrlp#mrufiles#opts() cal ctrlp#mrufiles#opts()
cal s:extvar('opts') cal s:extvar('opts')
@ -1578,16 +1579,27 @@ fu! ctrlp#init(type, ...)
cal ctrlp#setlines(a:type) cal ctrlp#setlines(a:type)
cal s:BuildPrompt(1) cal s:BuildPrompt(1)
endf endf
if has('autocmd') "{{{1 " - Autocmds {{{1
fu! s:autocmds()
if !has('autocmd') | retu | en
aug CtrlPAug aug CtrlPAug
au! au!
au BufEnter ControlP cal s:checkbuf() au BufEnter ControlP cal s:checkbuf()
au BufLeave ControlP cal s:Close() au BufLeave ControlP cal s:Close()
au VimLeavePre * cal s:leavepre() au VimLeavePre * cal s:leavepre()
if s:lazy
au CursorHold ControlP cal s:ForceUpdate()
en
aug END aug END
en "}}} if exists('CtrlPLaz')
au! CtrlPLaz
en
if s:lazy
aug CtrlPLaz
au!
au CursorHold ControlP cal s:ForceUpdate()
aug END
en
endf
cal s:autocmds()
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 " vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View File

@ -18,6 +18,9 @@ fu! ctrlp#mrufiles#opts()
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
endfo endfo
let [s:csen, s:mrbs] = [s:csen ? '#' : '?', []] let [s:csen, s:mrbs] = [s:csen ? '#' : '?', []]
if exists('s:locked')
cal ctrlp#mrufiles#init()
en
endf endf
cal ctrlp#mrufiles#opts() cal ctrlp#mrufiles#opts()
" Utilities {{{1 " Utilities {{{1
@ -83,9 +86,7 @@ fu! ctrlp#mrufiles#remove(files)
endf endf
fu! ctrlp#mrufiles#list(...) fu! ctrlp#mrufiles#list(...)
if a:0 if a:0 | cal s:record(a:1) | retu | en
cal s:record(a:1) | retu
en
retu s:reformat(s:readcache()) retu s:reformat(s:readcache())
endf endf
@ -102,6 +103,13 @@ fu! ctrlp#mrufiles#init()
au QuickFixCmdPre *vimgrep* let s:locked = 1 au QuickFixCmdPre *vimgrep* let s:locked = 1
au QuickFixCmdPost *vimgrep* let s:locked = 0 au QuickFixCmdPost *vimgrep* let s:locked = 0
aug END aug END
aug CtrlPMREB
au!
au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1), 1)
aug END
if exists('#CtrlPMREF')
au! CtrlPMREF
en
if s:mre if s:mre
aug CtrlPMREF aug CtrlPMREF
au! au!
@ -110,14 +118,6 @@ fu! ctrlp#mrufiles#init()
if exists('#CtrlPMREB') if exists('#CtrlPMREB')
au! CtrlPMREB au! CtrlPMREB
en en
el
if exists('#CtrlPMREF')
au! CtrlPMREF
en
aug CtrlPMREB
au!
au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1), 1)
aug END
en en
endf endf
"}}} "}}}