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

Lazy loading completions



I noticed that virtualenvwrapper was taking about 90% of my shell's 
startup time, so I switched to a lazy-loading version. However, it 
doesn't handle completions all that well, with the following:

compctl -K virtualenvwrapper_load $(echo ${_VIRTUALENVWRAPPER_API})

This loads on the first completion request then works on the second one, 
and breaks completions on other commands - $_VIRTUALENVWRAPPER_API is a 
superset of the functions for which completions are defined.

I tried this:

    source /usr/local/bin/virtualenvwrapper_lazy.sh
    _virtualenvwrapper_load_compctl() {
      compctl + ${=_VIRTUALENVWRAPPER_API}
      virtualenvwrapper_load
      eval ${$(compctl | egrep '^'$_comp_command1' -K')[3]}
    }
    compctl -K _virtualenvwrapper_load_compctl ${=_VIRTUALENVWRAPPER_API}

It works much better, except it still requires two completion requests 
for functions for which completions are *not* defined, since the eval 
does nothing in that case. Short of making my own version of 
_VIRTUALENVWRAPPER_API, is there a way to return the default completion 
result in this case?  (Or more generally, can I replace the eval 
entirely?)

Thanks,
-- 
Nicholas Riley <njriley@xxxxxxxxxxxx>



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