diff --git a/autoload/ctrlp/mixed.vim b/autoload/ctrlp/mixed.vim index 0314498..4fc4242 100644 --- a/autoload/ctrlp/mixed.vim +++ b/autoload/ctrlp/mixed.vim @@ -1,6 +1,6 @@ " ============================================================================= " File: autoload/ctrlp/mixed.vim -" Description: Files + MRU +" Description: Mixing Files + MRU + Buffers " Author: Kien Nguyen " ============================================================================= @@ -13,7 +13,7 @@ let [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0] let s:mixed_var = { \ 'init': 'ctrlp#mixed#init(s:compare_lim)', \ 'accept': 'ctrlp#acceptfile', - \ 'lname': 'fil + mru', + \ 'lname': 'fil + mru + buf', \ 'sname': 'mix', \ 'type': 'path', \ 'opmul': 1, @@ -40,11 +40,11 @@ fu! s:getnewmix(cwd, clim) en let g:ctrlp_lines = copy(ctrlp#files()) cal ctrlp#progress('Mixing...') - let mrufs = ctrlp#mrufiles#list('raw') + let mrufs = copy(ctrlp#mrufiles#list('raw')) if exists('+ssl') && &ssl cal map(mrufs, 'tr(v:val, "\\", "/")') en - if len(mrufs) > len(g:ctrlp_lines) || v:version < 702 + if len(mrufs) > len(g:ctrlp_lines) cal filter(mrufs, 'stridx(v:val, a:cwd)') el let cwd_mrufs = filter(copy(mrufs), '!stridx(v:val, a:cwd)') diff --git a/autoload/ctrlp/mrufiles.vim b/autoload/ctrlp/mrufiles.vim index 9fee6f8..afc552f 100644 --- a/autoload/ctrlp/mrufiles.vim +++ b/autoload/ctrlp/mrufiles.vim @@ -25,12 +25,12 @@ fu! s:excl(fn) retu !empty(s:ex) && a:fn =~# s:ex endf -fu! s:mergelists() +fu! s:mergelists(...) let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile()) - cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0') - let mrufs = s:mrufs + diskmrufs - if v:version < 702 | cal filter(mrufs, 'count(mrufs, v:val) == 1') | en - retu s:chop(mrufs) + let mrus = a:0 && a:1 == 'raw' ? s:mrbs : s:mrufs + cal filter(diskmrufs, 'index(mrus, v:val) < 0') + let mrua = mrus + diskmrufs + retu a:0 && a:1 == 'raw' ? mrua : s:chop(mrua) endf fu! s:chop(mrufs) @@ -50,13 +50,15 @@ fu! s:record(bufnr) if s:locked | retu | en let bufnr = a:bufnr + 0 if bufnr <= 0 | retu | en - let fn = fnamemodify(bufname(bufnr), ':p') + let bufname = bufname(bufnr) + if empty(bufname) | retu | en + let fn = fnamemodify(bufname, ':p') let fn = exists('+ssl') ? tr(fn, '/', '\') : fn + if empty(fn) || !empty(&bt) | retu | en cal filter(s:mrbs, 'v:val !='.s:csen.' fn') cal insert(s:mrbs, fn) - if empty(fn) || !empty(&bt) || ( !empty(s:in) && fn !~# s:in ) - \ || ( !empty(s:ex) && fn =~# s:ex ) || !filereadable(fn) - retu + if ( !empty(s:in) && fn !~# s:in ) || ( !empty(s:ex) && fn =~# s:ex ) + \ || !filereadable(fn) | retu en cal filter(s:mrufs, 'v:val !='.s:csen.' fn') cal insert(s:mrufs, fn) @@ -89,8 +91,7 @@ fu! ctrlp#mrufiles#remove(files) endf fu! ctrlp#mrufiles#list(...) - if a:0 && a:1 != 'raw' | retu | en - retu a:0 && a:1 == 'raw' ? s:mergelists() : s:reformat(s:mergelists()) + retu a:0 ? a:1 == 'raw' ? s:mergelists(a:1) : 0 : s:reformat(s:mergelists()) endf fu! ctrlp#mrufiles#bufs() diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index a98f59f..e5c1510 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -770,7 +770,7 @@ Available extensions:~ * Mixed mode:~ - Name: 'mixed' - Command: ':CtrlPMixed' - - Search in both files and MRU files. + - Search in files, buffers and MRU files. ------------------------------------------------------------------------------- Buffer Tag mode options:~ @@ -904,9 +904,9 @@ Special thanks:~ =============================================================================== CHANGELOG *ctrlp-changelog* - + Remove: g:ctrlp_mruf_last_entered, make it the default for MRU mode. + + Remove: g:ctrlp_mruf_last_entered, make it a default for MRU mode. + New commands: |:CtrlPLastMode|, open CtrlP in the last mode used. - |:CtrlPMixed|, search in both files and MRU files. + |:CtrlPMixed|, search in files, buffers and MRU files. Before 2012/03/31~