Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
New zplugin feature (was: Re: How completions work, do they require fpath?)
- X-seq: zsh-users 21262
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: New zplugin feature (was: Re: How completions work, do they require fpath?)
- Date: Wed, 10 Feb 2016 10:08:48 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=8etTcPOnsRotLQ2PxLzMKq+WbPM3sNS5a7DhtV3hCfM=; b=Ki75dfwiDL0YeHkUibNroBXoob5Rt6hjmrTIH54t910ynmV+yNhoUc0LCSsO6g5sDt /f2uVI0hoHVsTcmi+fZDTydDV8totb5aDsyQXMoK3NBBIHpdPkee/ny/xlclpfVai31f NeDeFHxE4RvkpxOK9bnQjcsbFkm8tlNodzVRMa0dIPO5/0rv+O8wDURtIfBo4xt1+q2p 4iGo4d4lchn4o+UvSUAoBThXLsy4KyE6K0zyNg4Ryn6PD8OOO9s4KyD3tvB6sJFrWR8C qr/lQ8SpNG1Rho4ILzndvPFfGO9ifaMsYhjJnbqNobyJC6xrXLSAlOJ7qoYPPpoBQ9bh bZnw==
- 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
On 31 January 2016 at 20:26, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> You could try this: Define your own "compdef" whose only action is
> to cache its arguments somewhere. Load all the plugins, then after
> compinit is run, play back the cached compdef arguments with the real
> compdef.
I realized how great that idea is. Implemented it in zplugin, thus an
idiom is possible:
source '/Users/sgniazdowski/.zplugin/bin/zplugin.zsh'
zplugin load "some1/plugin1"
zplugin load "some2/plugin2"
...
zplugin load "some3/plugin3"
autoload -Uz compinit
compinit
zplugin cdreplay -q # -q is quiet
The difference between running compinit once and twice is huge,
following time differences are possible:
zsh -i -c exit 0,73s user 0,25s system 99% cpu 0,980 total
zsh -i -c exit 0,11s user 0,04s system 97% cpu 0,156 total
(for 3 plugins)
zsh -i -c exit 1,24s user 0,41s system 99% cpu 1,667 total
zsh -i -c exit 0,48s user 0,18s system 98% cpu 0,668 total
(for 40 plugins)
This is a very innovative, great thing. All current plugin managers
drifted towards double compinit calling, by force of lack of
shadowing:
https://github.com/tarjoilija/zgen/blob/master/zgen.zsh#L471-L475
https://github.com/zsh-users/antigen/blob/master/antigen.zsh#L441-L462
OMZ slowness is I guess also result of this.
Fun example:
% unfunction compdef
% zplg dtrace
% compdef _ls cp
% zplg dstop
% zplg cdlist
Recorded compdefs:
compdef _ls cp
% zplg cdreplay
Compinit isn't loaded, cannot do compdef replay
% autoload -Uz compinit
% compinit
% zplg cdreplay
Running compdef _ls cp
% echo $_comps[cp]
_ls
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author