mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-07 21:24:40 +08:00
[[B]Tags] Allow multi-selection and populate quickfix list
This commit is contained in:
@@ -442,7 +442,17 @@ function! s:btags_sink(lines)
|
|||||||
if !empty(cmd)
|
if !empty(cmd)
|
||||||
execute 'silent' cmd '%'
|
execute 'silent' cmd '%'
|
||||||
endif
|
endif
|
||||||
execute split(a:lines[1], "\t")[2]
|
let qfl = []
|
||||||
|
for line in a:lines[1:]
|
||||||
|
execute split(line, "\t")[2]
|
||||||
|
call add(qfl, {'filename': expand('%'), 'lnum': line('.'), 'text': getline('.')})
|
||||||
|
endfor
|
||||||
|
if len(qfl) > 1
|
||||||
|
call setqflist(qfl)
|
||||||
|
copen
|
||||||
|
wincmd p
|
||||||
|
cfirst
|
||||||
|
endif
|
||||||
normal! zz
|
normal! zz
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -451,7 +461,7 @@ function! fzf#vim#buffer_tags(...)
|
|||||||
call s:fzf(fzf#vim#wrap({
|
call s:fzf(fzf#vim#wrap({
|
||||||
\ 'source': s:btags_source(),
|
\ 'source': s:btags_source(),
|
||||||
\ 'sink*': s:function('s:btags_sink'),
|
\ 'sink*': s:function('s:btags_sink'),
|
||||||
\ 'options': '+m -d "\t" --with-nth 1,4.. -n 1 --prompt "BTags> "'}), a:000)
|
\ 'options': '-m -d "\t" --with-nth 1,4.. -n 1 --prompt "BTags> "'}), a:000)
|
||||||
catch
|
catch
|
||||||
call s:warn(v:exception)
|
call s:warn(v:exception)
|
||||||
endtry
|
endtry
|
||||||
@@ -464,13 +474,23 @@ function! s:tags_sink(lines)
|
|||||||
if len(a:lines) < 2
|
if len(a:lines) < 2
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
let qfl = []
|
||||||
let cmd = get(get(g:, 'fzf_action', s:default_action), a:lines[0], 'e')
|
let cmd = get(get(g:, 'fzf_action', s:default_action), a:lines[0], 'e')
|
||||||
let parts = split(a:lines[1], '\t\zs')
|
|
||||||
let excmd = matchstr(join(parts[2:], ''), '^.*\ze;"\t')
|
|
||||||
execute cmd s:escape(parts[1][:-2])
|
|
||||||
let [magic, &magic] = [&magic, 0]
|
let [magic, &magic] = [&magic, 0]
|
||||||
execute excmd
|
for line in a:lines[1:]
|
||||||
|
let parts = split(line, '\t\zs')
|
||||||
|
let excmd = matchstr(join(parts[2:], ''), '^.*\ze;"\t')
|
||||||
|
execute cmd s:escape(parts[1][:-2])
|
||||||
|
execute excmd
|
||||||
|
call add(qfl, {'filename': expand('%'), 'lnum': line('.'), 'text': getline('.')})
|
||||||
|
endfor
|
||||||
let &magic = magic
|
let &magic = magic
|
||||||
|
if len(qfl) > 1
|
||||||
|
call setqflist(qfl)
|
||||||
|
copen
|
||||||
|
wincmd p
|
||||||
|
clast
|
||||||
|
endif
|
||||||
normal! zz
|
normal! zz
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -494,7 +514,7 @@ function! fzf#vim#tags(...)
|
|||||||
\ 'source': proc.shellescape(fnamemodify(tagfile, ':t')),
|
\ 'source': proc.shellescape(fnamemodify(tagfile, ':t')),
|
||||||
\ 'sink*': s:function('s:tags_sink'),
|
\ 'sink*': s:function('s:tags_sink'),
|
||||||
\ 'dir': fnamemodify(tagfile, ':h'),
|
\ 'dir': fnamemodify(tagfile, ':h'),
|
||||||
\ 'options': copt.'+m --tiebreak=begin --prompt "Tags> "'}), a:000)
|
\ 'options': copt.'-m --tiebreak=begin --prompt "Tags> "'}), a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user