Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Lazy loading completions
- X-seq: zsh-users 17759
- From: Nicholas Riley <njriley@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Lazy loading completions
- Date: Thu, 18 Apr 2013 17:23:11 -0500
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: University of Illinois College of Medicine at Urbana-Champaign
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