From 34733365bfe2e7e805e9ad0522262b2fbd4a29f1 Mon Sep 17 00:00:00 2001 From: mesmerx Date: Wed, 15 Jul 2020 11:08:22 -0300 Subject: [PATCH] remove autocomplete extra information --- bin/_j | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/_j b/bin/_j index 6cbd600..cd8759b 100644 --- a/bin/_j +++ b/bin/_j @@ -1,6 +1,18 @@ #compdef j cur=${words[2, -1]} -autojump --complete ${=cur[*]} | while read i; do - compadd -U "$i"; +integer i=1 +declare -A displayMap + +autojump --complete "${=cur[*]}" | while read c; do + hidden=$(echo "$c" | sed 's/\(.*__[0-9][0-9]*__\).*/\1/') + display=$(echo "$c" | sed 's/.*__[0-9][0-9]*__\(.*\)/\1/') + + (( $+displayMap[$display] )) && continue + displayMap[$display]=true + + compadd -V $i -U "$display"; + i=$((i+1)) done + +(( $i > 2 )) && compadd -V $i -U "${=cur[*]}"