1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-08-17 00:30:26 +03:00

Remove sorting of tags results

It is not an obviously better result than just displaying results
from each tag file, so remove sorting to take advantage of live
completion updates

As discussed in #5081
This commit is contained in:
Maxime Coste 2024-01-17 21:17:09 +11:00
parent b0119b0696
commit 0674311945

View File

@ -16,22 +16,17 @@ define-command -params ..1 \
-shell-script-candidates %{
realpath() { ( cd "$(dirname "$1")"; printf "%s/%s\n" "$(pwd -P)" "$(basename "$1")" ) }
eval "set -- $kak_quoted_opt_ctagsfiles"
files=$(
for candidate in "$@"; do
[ -f "$candidate" ] && realpath "$candidate"
done |
awk '!x[$0]++; # remove duplicates
END { if (length(x) == 1) { exit 1; } }'
)
[ $? -eq 1 ] && sort=cat || sort=sort
printf %s\\n "$files" |
for candidate in "$@"; do
[ -f "$candidate" ] && realpath "$candidate"
done | awk '!x[$0]++;' | # remove duplicates
while read -r tags; do
namecache="${tags%/*}/.kak.${tags##*/}.namecache"
if [ -z "$(find "$namecache" -prune -newer "$tags")" ]; then
cut -f 1 "$tags" | grep -v '^!' | uniq > "$namecache"
fi
cat "$namecache"
done | "$sort" } \
done
} \
-docstring %{
ctags-search [<symbol>]: jump to a symbol's definition
If no symbol is passed then the current selection is used as symbol name