Allow manually adding MRU entries
This commit is contained in:
parent
398f6036a8
commit
08375f24d2
@ -208,7 +208,7 @@ fu! ctrlp#buffertag#init(fname)
|
||||
let lines = []
|
||||
for each in bufs
|
||||
let bname = fnamemodify(each, ':p')
|
||||
let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '')
|
||||
let tftype = get(split(getbufvar('^'.bname.'$', '&ft'), '\.'), 0, '')
|
||||
cal extend(lines, s:process(bname, tftype))
|
||||
endfo
|
||||
cal s:syntax()
|
||||
|
@ -48,15 +48,19 @@ endf
|
||||
fu! s:record(bufnr)
|
||||
if s:locked | retu | en
|
||||
let bufnr = a:bufnr + 0
|
||||
if bufnr <= 0 | retu | en
|
||||
let bufname = bufname(bufnr)
|
||||
if empty(bufname) | retu | en
|
||||
let fn = fnamemodify(bufname, ':p')
|
||||
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
||||
if bufnr > 0 && !empty(bufname)
|
||||
cal filter(s:mrbs, 'v:val != bufnr')
|
||||
cal insert(s:mrbs, bufnr)
|
||||
cal s:addtomrufs(bufname)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:addtomrufs(fname)
|
||||
let fn = fnamemodify(a:fname, ':p')
|
||||
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
||||
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
|
||||
\ || !empty(&bt) || !filereadable(fn) | retu
|
||||
\ || !empty(getbufvar('^'.fn.'$', '&bt')) || !filereadable(fn) | retu
|
||||
en
|
||||
cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
|
||||
cal insert(s:mrufs, fn)
|
||||
@ -87,6 +91,12 @@ fu! ctrlp#mrufiles#remove(files)
|
||||
retu s:reformat(copy(s:mrufs))
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#add(fn)
|
||||
if !empty(a:fn)
|
||||
cal s:addtomrufs(a:fn)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#list(...)
|
||||
retu a:0 ? a:1 == 'raw' ? s:mergelists() : 0 : s:reformat(s:mergelists())
|
||||
endf
|
||||
|
Loading…
Reference in New Issue
Block a user