Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: rsync --progress stops completion



On 09/21/2014 08:52 PM, Yuri D'Elia wrote:
> On 09/21/2014 07:20 PM, Bart Schaefer wrote:
>> To permit zstyle customizations it might also be useful to set up the
>> "compcontext" parameter and call _complete instead of "_normal -s".
>> There aren't any good examples of this except Functions/Misc/nslookup.
> 
> So here's what I got so far:

Some obvious typos in the last post.

#autoload

_complete_fallback_cleanup()
{
  precmd_functions=_complete_fallback_precmd
  unset _complete_fallback_precmd
}

_complete_fallback()
{
  if [[ $LASTWIDGET = *complete* || -n $_complete_fallback_precmd ]]
  then
    if [[ -z $_complete_fallback_precmd ]]
    then
      _complete_fallback_precmd=precmd_functions
      precmd_functions+=( _complete_fallback_cleanup )
    fi

    [[ $compstate[context] = command && $CURRENT -gt 2 ]] || return 1
    words=("$words[1]" "${(@)words[$CURRENT,-1]}")
    CURRENT=2
    local curcontext="${curcontext%:*}:fallback"
    _compskip=default
    _complete
  fi
}

_complete_fallback "$@"




Messages sorted by: Reverse Date, Date, Thread, Author