Add support for a ctagsfiles option that lists all tags to read from

Results from all tags will be merged

Fixes #22
This commit is contained in:
Maxime Coste 2014-10-12 18:51:27 +01:00
parent ff27b385d2
commit 7a2afbcf48

View File

@ -3,13 +3,20 @@
# This script requires the readtags command available in ctags source but # This script requires the readtags command available in ctags source but
# not installed by default # not installed by default
decl str-list ctagsfiles 'tags'
def -shell-params \ def -shell-params \
-shell-completion 'readtags -p "$1" | cut -f 1 | sort | uniq' \ -shell-completion 'readtags -p "$1" | cut -f 1 | sort | uniq' \
-docstring 'jump to tag definition' \ -docstring 'jump to tag definition' \
tag \ tag \
%{ %sh{ %{ %sh{
export tagname=${1:-${kak_selection}} export tagname=${1:-${kak_selection}}
readtags ${tagname} | awk -F '\t|\n' -e ' (
IFS=':'
for tags in ${kak_opt_ctagsfiles}; do
readtags -t "${tags}" ${tagname}
done
) | awk -F '\t|\n' -e '
/[^\t]+\t[^\t]+\t\/\^.*\$\// { /[^\t]+\t[^\t]+\t\/\^.*\$\// {
re=$0; sub(".*\t/\\^", "", re); sub("\\$/.*", "", re); gsub("(\\{|\\}).*$", "", re); re=$0; sub(".*\t/\\^", "", re); sub("\\$/.*", "", re); gsub("(\\{|\\}).*$", "", re);
out = out " %{" $2 " [" re "]} %{try %{ edit %{" $2 "}; exec %{/\\Q" re "<ret>vc} } catch %{ echo %{unable to find tag} } }" out = out " %{" $2 " [" re "]} %{try %{ edit %{" $2 "}; exec %{/\\Q" re "<ret>vc} } catch %{ echo %{unable to find tag} } }"