From be01b64586e8a99362ed0c2e016c9c866106a17a Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 19 Feb 2016 00:29:24 +0900 Subject: [PATCH] [Lines] Use readfile() if buffer is not yet loaded Close #86 --- autoload/fzf/vim.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 00feaf1..f64e2a5 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -194,9 +194,14 @@ function! fzf#vim#_lines(all) let rest = [] let buf = bufnr('') for b in s:buflisted() + let lines = getbufline(b, 1, "$") + if empty(lines) + let path = fnamemodify(bufname(b), ':p') + let lines = filereadable(path) ? readfile(path) : [] + endif call extend(b == buf ? cur : rest, \ filter( - \ map(getbufline(b, 1, "$"), + \ map(lines, \ '(!a:all && empty(v:val)) ? "" : printf("[%s]\t%s:\t%s", s:blue(b), s:yellow(v:key + 1), v:val)'), \ 'a:all || !empty(v:val)')) endfor