no mru if disabled

This commit is contained in:
Kien N 2011-09-08 00:47:31 +07:00
parent 8f9e9b598e
commit 194d78dede

View File

@ -703,20 +703,14 @@ endfunc
func! s:walker(max, pos, dir, ...) func! s:walker(max, pos, dir, ...)
if a:dir == 1 if a:dir == 1
if a:pos < a:max let pos = a:pos < a:max ? a:pos + 1 : 0
let pos = a:pos + 1
elseif a:pos == a:max
let pos = 0
endif
elseif a:dir == -1 elseif a:dir == -1
if a:pos > 0 let pos = a:pos > 0 ? a:pos - 1 : a:max
let pos = a:pos - 1
elseif a:pos == 0
let pos = a:max
endif
endif endif
if g:ctrlp_mru_files == 0 && pos == 2 && !exists('a:1') if g:ctrlp_mru_files == 0 && pos == 2
let pos = a:pos == 1 ? 3 : 1 \ && !exists('a:1')
let jmp = pos == a:max ? 0 : 3
let pos = a:pos == 1 ? jmp : 1
endif endif
retu pos retu pos
endfunc endfunc
@ -727,6 +721,9 @@ func! s:statusline(...)
\ 1: ['buffers', 'buf'], \ 1: ['buffers', 'buf'],
\ 2: ['recent\ files', 'mru'], \ 2: ['recent\ files', 'mru'],
\ } \ }
if g:ctrlp_mru_files == 0
cal remove(itemtypes, 2)
endif
let max = len(itemtypes) - 1 let max = len(itemtypes) - 1
let next = s:walker(max, s:itemtype, 1, 1) let next = s:walker(max, s:itemtype, 1, 1)
let prev = s:walker(max, s:itemtype, -1, 1) let prev = s:walker(max, s:itemtype, -1, 1)
@ -735,7 +732,8 @@ func! s:statusline(...)
let regex = s:regexp ? '[regex]' : '' let regex = s:regexp ? '[regex]' : ''
let byfname = s:byfname ? '[file]' : '[path]' let byfname = s:byfname ? '[file]' : '[path]'
let focus = s:Focus() ? '[prt]' : '[win]' let focus = s:Focus() ? '[prt]' : '[win]'
exe 'setl stl='.focus.byfname.regex.'--('.prev.')-[['.itemtypes[s:itemtype][0].']]-('.next.')--' let item = itemtypes[s:itemtype][0]
exe 'setl stl='.focus.byfname.regex.'+-('.prev.')-[['.item.']]-('.next.')-+'
endfunc endfunc
func! s:matchsubstr(item, pat) func! s:matchsubstr(item, pat)