mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-06 12:44:24 +08:00
[Tags] Use 'readtags' if query string is given
This pre-filtering is critical when working with large tag files. 'readtags' can perform a binary search for the given prefix string but fzf has to load the entire file into memory just to start searching. Close #1529 Close #1524
This commit is contained in:
10
bin/tags.pl
10
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;
|
||||
|
||||
Reference in New Issue
Block a user