From 1ed632f101591af830ddc5f5f3a81f51775c607f Mon Sep 17 00:00:00 2001 From: Kien N Date: Thu, 15 Mar 2012 09:52:10 +0700 Subject: [PATCH] Fix bugs related to ctrlp#buffers() --- autoload/ctrlp/buffertag.vim | 5 +++-- autoload/ctrlp/changes.vim | 3 ++- autoload/ctrlp/line.vim | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/autoload/ctrlp/buffertag.vim b/autoload/ctrlp/buffertag.vim index 0092c75..10d2ffb 100644 --- a/autoload/ctrlp/buffertag.vim +++ b/autoload/ctrlp/buffertag.vim @@ -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() diff --git a/autoload/ctrlp/changes.vim b/autoload/ctrlp/changes.vim index 6e1767f..e534ed8 100644 --- a/autoload/ctrlp/changes.vim +++ b/autoload/ctrlp/changes.vim @@ -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 diff --git a/autoload/ctrlp/line.vim b/autoload/ctrlp/line.vim index c6cfb71..28b81d6 100644 --- a/autoload/ctrlp/line.vim +++ b/autoload/ctrlp/line.vim @@ -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