Get lines from buffers first
This commit is contained in:
parent
d39b7b014d
commit
fa2d745b5d
@ -30,17 +30,17 @@ fu! s:syntax()
|
|||||||
endf
|
endf
|
||||||
" Public {{{1
|
" Public {{{1
|
||||||
fu! ctrlp#line#init()
|
fu! ctrlp#line#init()
|
||||||
let [bufs, lines] = [filter(ctrlp#buffers(), 'filereadable(v:val)'), []]
|
let [bufs, lines] = [ctrlp#buffers('id'), []]
|
||||||
for each in bufs
|
for bufnr in bufs
|
||||||
let [fnamet, ff] = [fnamemodify(each, ':t'), readfile(each)]
|
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
|
||||||
let bname = fnamemodify(each, ':p')
|
let lfb = lfb == [] ? ctrlp#utils#readfile(fnamemodify(bufn, ':p')) : lfb
|
||||||
cal map(ff, 'tr(v:val, '' '', '' '')')
|
cal map(lfb, 'tr(v:val, '' '', '' '')')
|
||||||
let [id, len_ff, bufnr] = [1, len(ff), bufnr('^'.bname.'$')]
|
let [linenr, len_lfb, buft] = [1, len(lfb), fnamemodify(bufn, ':t')]
|
||||||
wh id <= len_ff
|
wh linenr <= len_lfb
|
||||||
let ff[id-1] .= ' |'.fnamet.'|'.bufnr.':'.id.'|'
|
let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|'
|
||||||
let id += 1
|
let linenr += 1
|
||||||
endw
|
endw
|
||||||
cal extend(lines, filter(ff, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$'''))
|
cal extend(lines, filter(lfb, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$'''))
|
||||||
endfo
|
endfo
|
||||||
cal s:syntax()
|
cal s:syntax()
|
||||||
retu lines
|
retu lines
|
||||||
|
Loading…
Reference in New Issue
Block a user