[Lines] Allow multiple selections

This commit is contained in:
Junegunn Choi
2023-09-05 22:09:24 +09:00
parent 832a090870
commit 5c218e982d

View File

@@ -444,10 +444,19 @@ function! s:line_handler(lines)
if len(a:lines) < 2 if len(a:lines) < 2
return return
endif endif
let qfl = []
for line in a:lines[1:]
let chunks = split(line, "\t", 1)
call add(qfl, {'bufnr': str2nr(chunks[0]), 'lnum': str2nr(chunks[2]), 'text': join(chunks[3:], "\t")})
endfor
call s:action_for(a:lines[0]) call s:action_for(a:lines[0])
let keys = split(a:lines[1], '\t') if !s:fill_quickfix('lines', qfl)
execute 'buffer' keys[0] let chunks = split(a:lines[1], '\t')
execute keys[2] execute 'buffer' chunks[0]
execute chunks[2]
endif
normal! ^zvzz normal! ^zvzz
endfunction endfunction
@@ -498,7 +507,7 @@ function! fzf#vim#lines(...)
return s:fzf('lines', { return s:fzf('lines', {
\ 'source': lines, \ 'source': lines,
\ 'sink*': s:function('s:line_handler'), \ 'sink*': s:function('s:line_handler'),
\ 'options': s:reverse_list(['+m', '--tiebreak=index', '--prompt', 'Lines> ', '--ansi', '--extended', '--nth='.nth.'..', '--tabstop=1', '--query', query]) \ 'options': s:reverse_list(['--tiebreak=index', '--prompt', 'Lines> ', '--ansi', '--extended', '--nth='.nth.'..', '--tabstop=1', '--query', query, '--multi'])
\}, args) \}, args)
endfunction endfunction