Improve completion descriptions
Following #127
This add an hook to be able to enrich the description of completion
Icons
Git status

What is left to do
- [ ] How to set custom color ? it seem that if set in
$__dscrthey get escaped no matter what So I can do something like
instead of

- [ ] How to get the start input,
git checkout <TAB>and have the stringgit checkoutsomewhere this is to match against a custom snippets file and would work a bit like bit https://github.com/chriswalz/bit but with all completion (like a real ide snippet !)
-
This is difficult... You can reset the color, but you have no way to restore it.
-
There is an array
$wordswhich contains the words on the command line. But it is editable so some completion function may remove some of its content...
- This is difficult... You can reset the color, but you have no way to restore it.
How can I do that ? it seems that the colors are getting escaped when I try to insert some inside the completion
fzf_tab_compadd_hook() {
# $expl - explicit group name
# $__hits - list of orginal completions
# $__dscr - list of transformed and described completions
# $PREFIX - text that already got completed before
# (grep "\b$expl" ~/.config/clisnippets)
case $_fzf_tab_curcontext in
# All context
(*)
# Line by line icon assignements
for i in {1..$#__hits}; do
word=$__hits[i] dscr=$__dscr[i]
if [[ -n $dscr ]]; then
dscr=${dscr//$'\n'}
elif [[ -n $word ]]; then
dscr=$word
fi
case "$expl" in
(*) icon="" ;;
esac
icon="$icon "
RED='\033[0;31m'
NC='\033[0m' # No Color
__dscr[i]="${RED}$icon $dscr"
done
;;
esac
}

How can I do that ? it seems that the colors are getting escaped when I try to insert some inside the completion
You need to use $'\033[0m'
Hello, I saw that this wasnt merged and Im still using the modified branch, I managed to do most of what I aimed for, beside color that did not work. However I found out you rewrote it all in C.
Here is what I have at the moment on https://github.com/adelin-b/fzf-tab/tree/improve_completion_description

It is on the old code so It might get me a while to move it to C. Maybe you already implemented the way to do it exposing different variable name?
Oh sorry I haven't implement it in C. I will take a look at it in these days.