diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 61f70a0..3fbe549 100755 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -1110,8 +1110,9 @@ function! fzf#vim#tags(query, ...) endfor let opts = v2_limit < 0 ? ['--algo=v1'] : [] + let args = insert(map(tagfiles, 'fzf#shellescape(fnamemodify(v:val, ":p"))'), fzf#shellescape(a:query), 0) return s:fzf('tags', { - \ 'source': 'perl '.fzf#shellescape(s:bin.tags).' '.join(map(tagfiles, 'fzf#shellescape(fnamemodify(v:val, ":p"))')), + \ 'source': join(['perl', fzf#shellescape(s:bin.tags), join(args)]), \ 'sink*': s:function('s:tags_sink'), \ 'options': extend(opts, ['--nth', '1..2', '-m', '-d', '\t', '--tiebreak=begin', '--prompt', 'Tags> ', '--query', a:query])}, a:000) endfunction diff --git a/bin/tags.pl b/bin/tags.pl index 4208c16..9c6f009 100755 --- a/bin/tags.pl +++ b/bin/tags.pl @@ -2,8 +2,16 @@ use strict; +my $prefix = shift @ARGV; + foreach my $file (@ARGV) { - open my $lines, $file; + my $lines; + if ($prefix eq "") { + open $lines, $file; + } else { + # https://perldoc.perl.org/perlopentut#Expressing-the-command-as-a-list + open $lines, '-|', 'readtags', '-t', $file, '-e', '-p', $prefix; + } while (<$lines>) { unless (/^\!/) { s/^[^\t]*/sprintf("%-24s", $&)/e;