diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index c832820..fc197c9 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -154,21 +154,23 @@ function! s:line_handler(lines) normal! ^zz endfunction -function! fzf#vim#_lines() +function! fzf#vim#_lines(all) let cur = [] let rest = [] let buf = bufnr('') for b in s:buflisted() call extend(b == buf ? cur : rest, - \ map(getbufline(b, 1, "$"), - \ 'printf("[%s]\t%s:\t%s", s:blue(b), s:yellow(v:key + 1), v:val)')) + \ filter( + \ map(getbufline(b, 1, "$"), + \ '(!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 return extend(cur, rest) endfunction function! fzf#vim#lines(...) call s:fzf({ - \ 'source': fzf#vim#_lines(), + \ 'source': fzf#vim#_lines(1), \ 'sink*': function('s:line_handler'), \ 'options': '+m --tiebreak=index --prompt "Lines> " --ansi --extended --nth=3..'.s:expect() \}, a:000) diff --git a/autoload/fzf/vim/complete.vim b/autoload/fzf/vim/complete.vim index 2d9afc7..cd5147d 100644 --- a/autoload/fzf/vim/complete.vim +++ b/autoload/fzf/vim/complete.vim @@ -121,7 +121,7 @@ endfunction function! fzf#vim#complete#line(...) return fzf#vim#complete(extend({ \ 'prefix': '^.*$', - \ 'source': fzf#vim#_lines(), + \ 'source': fzf#vim#_lines(0), \ 'options': '--tiebreak=index --ansi --nth 3..', \ 'reducer': function('s:reduce_line')}, get(a:000, 0, g:fzf#vim#default_layout))) endfunction