Fix bugs related to ctrlp#buffers()

This commit is contained in:
Kien N 2012-03-15 09:52:10 +07:00
parent 607cc29d81
commit 1ed632f101
3 changed files with 7 additions and 4 deletions

View File

@ -218,8 +218,9 @@ fu! ctrlp#buffertag#init(fname)
\ : [exists('s:bufname') ? s:bufname : a:fname]
let lines = []
for each in bufs
let tftype = get(split(getbufvar(each, '&ft'), '\.'), 0, '')
cal extend(lines, s:process(each, tftype))
let bname = fnamemodify(each, ':p')
let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '')
cal extend(lines, s:process(bname, tftype))
endfo
if has('syntax') && exists('g:syntax_on')
cal s:syntax()

View File

@ -62,7 +62,8 @@ fu! ctrlp#changes#init(original_bufnr, fname)
let [swb, &swb] = [&swb, '']
let lines = []
for each in bufs
let [bufnr, fnamet] = [bufnr('^'.each.'$'), fnamemodify(each, ':t')]
let [bname, fnamet] = [fnamemodify(each, ':p'), fnamemodify(each, ':t')]
let bufnr = bufnr('^'.bname.'$')
if bufnr > 0
cal extend(lines, s:process(s:changelist(bufnr), bufnr, fnamet))
en

View File

@ -38,8 +38,9 @@ fu! ctrlp#line#init()
let [bufs, lines] = [filter(ctrlp#buffers(), 'filereadable(v:val)'), []]
for each in bufs
let [fnamet, from_file] = [fnamemodify(each, ':t'), readfile(each)]
let bname = fnamemodify(each, ':p')
cal map(from_file, 'tr(v:val, '' '', '' '')')
let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.each.'$')]
let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.bname.'$')]
wh id <= len_ff
let from_file[id-1] .= ' |'.fnamet.'|'.bufnr.':'.id.'|'
let id += 1