From 1119d00a965294c3070ccd0fc25240045f729b0c Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 6 Aug 2016 06:51:33 +0100 Subject: [PATCH] Use shell-candidates for ctags completion, and cache tag names in a separate file --- rc/base/ctags.kak | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rc/base/ctags.kak b/rc/base/ctags.kak index 58995a9e..96c93f80 100644 --- a/rc/base/ctags.kak +++ b/rc/base/ctags.kak @@ -6,10 +6,14 @@ decl str-list ctagsfiles 'tags' def -params 0..1 \ - -shell-completion ' - ( for tags in $(printf %s\\n "${kak_opt_ctagsfiles}" | tr \':\' \'\n\'); - do readtags -t "${tags}" -p "$1" - done ) | cut -f 1 | sort | uniq' \ + -shell-candidates ' + ( for tags in $(printf %s\\n "${kak_opt_ctagsfiles}" | tr \':\' \'\n\'); do + namecache=$(dirname ${tags})/.kak.$(basename ${tags}).namecache + if [ -z "$(find ${namecache} -prune -newer ${tags})" ]; then + cat ${tags} | cut -f 1 | uniq > ${namecache} + fi + cat ${namecache} + done )' \ -docstring 'Jump to tag definition' \ tag \ %{ %sh{