diff --git a/README.md b/README.md index 35bdefc4..d924d5e9 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ so you can omit it if you use a plugin manager that doesn't support hooks. - `Ag` requires [The Silver Searcher (ag)][ag] - `Rg` requires [ripgrep (rg)][rg] - `Tags` and `Helptags` require Perl -- `Tags PREFIX` requires `readtags` command from [Universal Ctags](https://ctags.io/) +- `Tags QUERY` requires `readtags` command from [Universal Ctags](https://ctags.io/) ```sh # Installing dependencies using Homebrew @@ -93,7 +93,7 @@ Commands | `:RG [PATTERN]` | [rg][rg] search result; relaunch ripgrep on every keystroke | | `:Lines [QUERY]` | Lines in loaded buffers | | `:BLines [QUERY]` | Lines in the current buffer | -| `:Tags [PREFIX]` | Tags in the project (`ctags -R`) | +| `:Tags [QUERY]` | Tags in the project (`ctags -R`) | | `:BTags [QUERY]` | Tags in the current buffer | | `:Changes` | Changelist across all open buffers | | `:Marks` | Marks | diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 8a7788f7..001b1634 100755 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -1148,7 +1148,7 @@ function! fzf#vim#tags(query, ...) return s:warn('Tags command requires perl') endif if len(a:query) && !executable('readtags') - return s:warn('readtags from universal-ctags is required to pre-filter tags with a prefix') + return s:warn('readtags from universal-ctags is required to pre-filter tags with a query') endif if empty(tagfiles()) diff --git a/bin/tags.pl b/bin/tags.pl index 7ed72c18..9f1d5f07 100755 --- a/bin/tags.pl +++ b/bin/tags.pl @@ -2,15 +2,15 @@ use strict; -my $prefix = shift @ARGV; +my $query = shift @ARGV; foreach my $file (@ARGV) { my $lines; - if ($prefix eq "") { + if ($query eq "") { open $lines, $file; } else { # https://perldoc.perl.org/perlopentut#Expressing-the-command-as-a-list - open $lines, '-|', 'readtags', '-t', $file, '-e', '-p', '-', $prefix; + open $lines, '-|', 'readtags', '-t', $file, '-e', '-p', '-Q', "(#/^[^[:space:]]*$query\$/ \$name)", '-l'; } while (<$lines>) { unless (/^\!/) {