summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-11-16 13:34:44 +0000
committerMaxime Coste <frrrwww@gmail.com>2015-11-16 13:34:44 +0000
commitf028e6e8bb158b013f35f7fd8debef7582d521fd (patch)
tree2a9761b79f0baf9ef1dae77348b332e3d62e4b6f
parent92e81b422f38e680b8f1b1516979e52c91e68626 (diff)
Improve escaping in ctags.kak and complete using ctagsfiles option
-rw-r--r--rc/ctags.kak14
1 files changed, 9 insertions, 5 deletions
diff --git a/rc/ctags.kak b/rc/ctags.kak
index 06b56119..35f26b69 100644
--- a/rc/ctags.kak
+++ b/rc/ctags.kak
@@ -6,7 +6,10 @@
decl str-list ctagsfiles 'tags'
def -shell-params \
- -shell-completion 'readtags -p "$1" | cut -f 1 | sort | uniq' \
+ -shell-completion '
+ ( for tags in $(echo "${kak_opt_ctagsfiles}" | tr \':\' \'\n\');
+ do readtags -t "${tags}" -p "$1"
+ done ) | cut -f 1 | sort | uniq' \
-docstring 'Jump to tag definition' \
tag \
%{ %sh{
@@ -16,12 +19,13 @@ def -shell-params \
readtags -t "${tags}" ${tagname}
done
) | awk -F '\t|\n' -e '
- /[^\t]+\t[^\t]+\t\/\^.*\$\// {
- re=$0; sub(".*\t/\\^", "", re); sub("\\$/.*", "", re); gsub("(\\{|\\}).*$", "", re);
- keys=re; gsub(/</, "<lt>", keys);
+ /[^\t]+\t[^\t]+\t\/\^.*\$?\// {
+ re=$0;
+ sub(".*\t/\\^", "", re); sub("\\$?/$", "", re); gsub("(\\{|\\}|\\\\E).*$", "", re);
+ keys=re; gsub(/</, "<lt>", keys); gsub(/\t/, "<c-v><c-i>", keys);
out = out " %{" $2 " {MenuInfo}" re "} %{try %{ edit %{" $2 "}; exec %{/\\Q" keys "<ret>vc} } catch %{ echo %{unable to find tag} } }"
}
- /[^\t]+\t[^\t]+\t([0-9]+)/ { out = out " %{" $2 ":" $3 "} %{edit %{" $2 "} %{" $3 "}}" }
+ /[^\t]+\t[^\t]+\t[0-9]+/ { out = out " %{" $2 ":" $3 "} %{edit %{" $2 "} %{" $3 "}}" }
END { print length(out) == 0 ? "echo -color Error no such tag " ENVIRON["tagname"] : "menu -markup -auto-single " out }'
}}