I have a custom ZSH tab-completion function for one of my tools. It works well, however sometimes it takes a long time for the tool to answer; is there a way to display some sort of indication that something is happening while the tool is running (and before it completes running)?
For example, is it possible to make it show a message below the current line, like:
prompt$ pypath /providers/conf<TAB>
Completing...
The challenge here is that the cursor must return to its previous position (where I hit 'TAB') once completion candidates are available. I know ZSH can do this, but can it display a message BEFORE the tool finishes running?
Here's my current completion script:
#compdef pypath
# This does not work; it is only added when the whole thing ends
# _message -r "Completing..."
IFS=$'\n' path_candidates=($(pypath "${PREFIX}*" | sed 's|.*/||' | sort -u))
compset -P '*/'
if [ -z "$path_candidates" ]; then
compadd -x "No matches found."
else
compadd -q -S '/' $path_candidates
fi