zsh-users
 help / color / mirror / code / Atom feed
* Lazy loading completions
@ 2013-04-18 22:23 Nicholas Riley
  2013-04-18 23:37 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Riley @ 2013-04-18 22:23 UTC (permalink / raw)
  To: zsh-users

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@illinois.edu>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-18 23:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-18 22:23 Lazy loading completions Nicholas Riley
2013-04-18 23:37 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).