Tweak MRU mode's autocmds

This commit is contained in:
Kien N 2012-03-16 03:11:55 +07:00
parent a82a75c134
commit 9dfda30843
2 changed files with 20 additions and 11 deletions

View File

@ -5,7 +5,7 @@
" Version: 1.7.3 " Version: 1.7.3
" ============================================================================= " =============================================================================
" Static variables {{{1 " * Static variables {{{1
fu! s:opts() fu! s:opts()
" Options " Options
let hst = exists('+hi') ? &hi : 20 let hst = exists('+hi') ? &hi : 20
@ -308,7 +308,7 @@ fu! s:lsCmd()
retu cmd['types'][key][1] retu cmd['types'][key][1]
en en
endf endf
" Buffers {{{1 " - Buffers {{{1
fu! ctrlp#buffers() fu! ctrlp#buffers()
retu map(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))' retu map(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))'
\ .' && getbufvar(v:val, "&bl") && strlen(bufname(v:val))'), \ .' && 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) let s:matches = len(newitems)
retu newitems retu newitems
endf endf
fu! s:SplitPattern(str) "{{{1
fu! s:SplitPattern(str)
let str = a:str let str = a:str
if s:migemo && s:regexp && len(str) > 0 && executable('cmigemo') if s:migemo && s:regexp && len(str) > 0 && executable('cmigemo')
let str = s:migemo(str) let str = s:migemo(str)
@ -712,7 +713,8 @@ fu! s:PrtSwitcher()
cal s:BuildPrompt(1, s:Focus()) cal s:BuildPrompt(1, s:Focus())
unl s:force unl s:force
endf endf
fu! s:SetWD(...) "{{{1 " - SetWD() {{{1
fu! s:SetWD(...)
let pathmode = s:wpmode let pathmode = s:wpmode
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
if a:0 && strlen(a:1) | if type(a:1) 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'] \ : g:ctrlp_ext_vars[s:itemtype - ( g:ctrlp_builtins + 1 )]['accept']
cal call(actfunc, [a:mode, line]) cal call(actfunc, [a:mode, line])
endf endf
fu! s:CreateNewFile(...) "{{{1 " - CreateNewFile() {{{1
fu! s:CreateNewFile(...)
let [md, str] = ['', join(s:prompt, '')] let [md, str] = ['', join(s:prompt, '')]
if empty(str) | retu | en if empty(str) | retu | en
if s:argmap && !a:0 if s:argmap && !a:0

View File

@ -82,7 +82,7 @@ fu! ctrlp#mrufiles#remove(files)
retu map(mrufs, 'fnamemodify(v:val, '':.'')') retu map(mrufs, 'fnamemodify(v:val, '':.'')')
endf endf
fu! ctrlp#mrufiles#list() fu! ctrlp#mrufiles#list(...)
if a:0 if a:0
cal s:record(a:1) | retu cal s:record(a:1) | retu
en en
@ -99,19 +99,25 @@ fu! ctrlp#mrufiles#init()
aug CtrlPMRUF aug CtrlPMRUF
au! au!
au BufReadPost,BufNewFile,BufWritePost * cal s:record(expand('<abuf>', 1)) au BufReadPost,BufNewFile,BufWritePost * cal s:record(expand('<abuf>', 1))
au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1), 1)
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
if s:mre if s:mre
aug CtrlPMRE aug CtrlPMREF
au! au!
au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1)) au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1))
aug END aug END
el if exists('#CtrlPMREB')
if exists('#CtrlPMRE') au! CtrlPMREB
au! CtrlPMRE
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
"}}} "}}}