From 9dfda308431091dbaaeb31b90033f9c4e3cc8f63 Mon Sep 17 00:00:00 2001 From: Kien N Date: Fri, 16 Mar 2012 03:11:55 +0700 Subject: [PATCH] Tweak MRU mode's autocmds --- autoload/ctrlp.vim | 13 ++++++++----- autoload/ctrlp/mrufiles.vim | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 7b94fc5..2d6824a 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -5,7 +5,7 @@ " Version: 1.7.3 " ============================================================================= -" Static variables {{{1 +" * Static variables {{{1 fu! s:opts() " Options let hst = exists('+hi') ? &hi : 20 @@ -308,7 +308,7 @@ fu! s:lsCmd() retu cmd['types'][key][1] en endf -" Buffers {{{1 +" - Buffers {{{1 fu! ctrlp#buffers() retu map(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))' \ .' && getbufvar(v:val, "&bl") && strlen(bufname(v:val))'), @@ -349,7 +349,8 @@ fu! s:MatchedItems(items, str, pat, limit, ipt) let s:matches = len(newitems) retu newitems endf -fu! s:SplitPattern(str) "{{{1 + +fu! s:SplitPattern(str) let str = a:str if s:migemo && s:regexp && len(str) > 0 && executable('cmigemo') let str = s:migemo(str) @@ -712,7 +713,8 @@ fu! s:PrtSwitcher() cal s:BuildPrompt(1, s:Focus()) unl s:force endf -fu! s:SetWD(...) "{{{1 +" - SetWD() {{{1 +fu! s:SetWD(...) let pathmode = s:wpmode let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] if a:0 && strlen(a:1) | if type(a:1) @@ -811,7 +813,8 @@ fu! s:AcceptSelection(mode) \ : g:ctrlp_ext_vars[s:itemtype - ( g:ctrlp_builtins + 1 )]['accept'] cal call(actfunc, [a:mode, line]) endf -fu! s:CreateNewFile(...) "{{{1 +" - CreateNewFile() {{{1 +fu! s:CreateNewFile(...) let [md, str] = ['', join(s:prompt, '')] if empty(str) | retu | en if s:argmap && !a:0 diff --git a/autoload/ctrlp/mrufiles.vim b/autoload/ctrlp/mrufiles.vim index 07df3f6..26da2f5 100644 --- a/autoload/ctrlp/mrufiles.vim +++ b/autoload/ctrlp/mrufiles.vim @@ -82,7 +82,7 @@ fu! ctrlp#mrufiles#remove(files) retu map(mrufs, 'fnamemodify(v:val, '':.'')') endf -fu! ctrlp#mrufiles#list() +fu! ctrlp#mrufiles#list(...) if a:0 cal s:record(a:1) | retu en @@ -99,19 +99,25 @@ fu! ctrlp#mrufiles#init() aug CtrlPMRUF au! au BufReadPost,BufNewFile,BufWritePost * cal s:record(expand('', 1)) - au BufEnter,BufUnload * cal s:record(expand('', 1), 1) au QuickFixCmdPre *vimgrep* let s:locked = 1 au QuickFixCmdPost *vimgrep* let s:locked = 0 aug END if s:mre - aug CtrlPMRE + aug CtrlPMREF au! au BufEnter,BufUnload * cal s:record(expand('', 1)) aug END - el - if exists('#CtrlPMRE') - au! CtrlPMRE + 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 "}}}