Addendum fix for #136

- Apply --tabstop=1 to line completion
- Fix incorrect --nth

Related: #139, #136
This commit is contained in:
Junegunn Choi 2016-04-29 10:30:48 +09:00
parent 1a379acb0a
commit fcc798e99e
2 changed files with 9 additions and 5 deletions

View file

@ -253,14 +253,16 @@ function! fzf#vim#_lines(all)
\ '(!a:all && empty(v:val)) ? "" : printf(s:blue("%2d\t", "TabLine")."%s".s:yellow("\t%4d ", "LineNr")."\t%s", b, bufname, v:key + 1, v:val)'),
\ 'a:all || !empty(v:val)'))
endfor
return extend(cur, rest)
return [display_bufnames, extend(cur, rest)]
endfunction
function! fzf#vim#lines(...)
let [display_bufnames, lines] = fzf#vim#_lines(1)
let nth = display_bufnames ? 3 : 2
return s:fzf(fzf#vim#wrap({
\ 'source': fzf#vim#_lines(1),
\ 'source': lines,
\ 'sink*': s:function('s:line_handler'),
\ 'options': '+m --tiebreak=index --prompt "Lines> " --ansi --extended --nth=3.. --reverse --tabstop=1'
\ 'options': '+m --tiebreak=index --prompt "Lines> " --ansi --extended --nth='.nth.'.. --reverse --tabstop=1'
\}), a:000)
endfunction

View file

@ -141,10 +141,12 @@ endfunction
function! fzf#vim#complete#line(...)
let [display_bufnames, lines] = fzf#vim#_lines(0)
let nth = display_bufnames ? 4 : 3
return fzf#vim#complete(s:extend({
\ 'prefix': '^.*$',
\ 'source': fzf#vim#_lines(0),
\ 'options': '--tiebreak=index --ansi --nth 4..',
\ 'source': lines,
\ 'options': '--tiebreak=index --ansi --nth '.nth.'.. --tabstop=1',
\ 'reducer': s:function('s:reduce_line')}, get(a:000, 0, g:fzf#vim#default_layout)))
endfunction