Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: rsync --progress stops completion
On 09/21/2014 11:08 PM, Bart Schaefer wrote:
> Declaring "local -a _complete_fallback_precmd" will mean that it goes
> away after the autoload of _complete_fallback is finished; so after
> that point you're just manipulating an undeclared global.
Can you explain a bit in more detail what is the difference between an
undeclared global and typeset -g? The manpage wasn't clear to me.
> Also I don't think the assignments to/from precmd_functions are going
> to do what you want, and there's no reason to do anything if the
> context isn't "command" (is there?).
Right.
> _complete_fallback()
> {
> [[ $compstate[context] = command && $CURRENT -gt 2 ]] || return 1
>
> if [[ -z $_complete_fallback_precmd || $LASTWIDGET != *complete* ]]
> then
> _complete_fallback_precmd=precmd
> add-zsh-hook precmd _complete_fallback_cleanup
> compadd -x "Completion failed, press ${${(V)KEYS}:s/\\t/TAB} for fallbacks"
> return 0
> fi
>
> if [[ $LASTWIDGET = *complete* ]]
> then
> words=("$words[1]" "${(@)words[$CURRENT,-1]}")
> CURRENT=2
> compadd -x "fallback: enabled"
> _compskip=default
> _complete
> fi
> }
Installing the handler immediately on the first go wasn't exactly "user
friendly" for me, since I would like a warning before the handler is
installed.
I would rather wrap _complete as originally suggested to say "completion
failed", but the tab thrice(tm) feels good.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author