diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 7b2ba29..08c13d7 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -225,6 +225,7 @@ endf fu! ctrlp#reset() cal s:opts() + cal s:autocmds() cal ctrlp#utils#opts() cal ctrlp#mrufiles#opts() cal s:extvar('opts') @@ -1578,16 +1579,27 @@ fu! ctrlp#init(type, ...) cal ctrlp#setlines(a:type) cal s:BuildPrompt(1) endf -if has('autocmd') "{{{1 +" - Autocmds {{{1 +fu! s:autocmds() + if !has('autocmd') | retu | en aug CtrlPAug au! au BufEnter ControlP cal s:checkbuf() au BufLeave ControlP cal s:Close() au VimLeavePre * cal s:leavepre() - if s:lazy - au CursorHold ControlP cal s:ForceUpdate() - en 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 diff --git a/autoload/ctrlp/mrufiles.vim b/autoload/ctrlp/mrufiles.vim index 26da2f5..f8c3048 100644 --- a/autoload/ctrlp/mrufiles.vim +++ b/autoload/ctrlp/mrufiles.vim @@ -18,6 +18,9 @@ fu! ctrlp#mrufiles#opts() exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) endfo let [s:csen, s:mrbs] = [s:csen ? '#' : '?', []] + if exists('s:locked') + cal ctrlp#mrufiles#init() + en endf cal ctrlp#mrufiles#opts() " Utilities {{{1 @@ -83,9 +86,7 @@ fu! ctrlp#mrufiles#remove(files) endf fu! ctrlp#mrufiles#list(...) - if a:0 - cal s:record(a:1) | retu - en + if a:0 | cal s:record(a:1) | retu | en retu s:reformat(s:readcache()) endf @@ -102,6 +103,13 @@ fu! ctrlp#mrufiles#init() au QuickFixCmdPre *vimgrep* let s:locked = 1 au QuickFixCmdPost *vimgrep* let s:locked = 0 aug END + aug CtrlPMREB + au! + au BufEnter,BufUnload * cal s:record(expand('', 1), 1) + aug END + if exists('#CtrlPMREF') + au! CtrlPMREF + en if s:mre aug CtrlPMREF au! @@ -110,14 +118,6 @@ fu! ctrlp#mrufiles#init() if exists('#CtrlPMREB') au! CtrlPMREB en - el - if exists('#CtrlPMREF') - au! CtrlPMREF - en - aug CtrlPMREB - au! - au BufEnter,BufUnload * cal s:record(expand('', 1), 1) - aug END en endf "}}}