nicholas85 / z-a-eval Goto Github PK
View Code? Open in Web Editor NEWA Zsh-Zinit annex (i.e. an extension), which caches arbitrarily slow command output to speed up shell startup.
License: Other
A Zsh-Zinit annex (i.e. an extension), which caches arbitrarily slow command output to speed up shell startup.
License: Other
I've used your plugin and I'm satisfied.
There is a possibility that I used it incorrectly, but I found the wrong case.
prev setting:
_tldr-setting() {
tldr --update
local comp="$(tldr 2>/dev/null --list)"
echo "complete -W \"$comp\" tldr" > init.zsh
}
zinit ice wait"2" as"command" from"gh-r" lucid \
mv"tldr* -> tldr" atclone"_tldr-setting" pick"init.zsh" \
atpull"%atclone" atload"alias man=tldr"
zinit light dbrgn/tealdeer
init.zsh
result: so long..
https://gist.github.com/black7375/48cc53f92b29c94629c6930d2b95c381
complete -W "2to3
7z
7za
7zr
R
...
zramctl
zsh
zstd
zsteg
zypper"
> tldr
z-a-eval setting:
zinit ice wait"2" as"command" from"gh-r" lucid \
mv"tldr* -> tldr" atclone"./tldr --update" atpull"%atclone" \
eval"echo complete -W $(./tldr 2>/dev/null --list) tldr" atload"alias man=tldr"
zinit light dbrgn/tealdeer
evalcache.zsh
result:
# echo\ complete\ -W\ \ tldr
# generated with z-a-eval annex
if (( ZINIT_Z_A_EVAL_SOURCED )) { return; }
typeset -i ZINIT_Z_A_EVAL_SOURCED=1
complete -W tldr
Additional context
https://github.com/zdharma/zinit/issues/487
Thank you again for your hard work.
❯ tree -L 1 gnubin zinit/plugins
gnubin
└── gnubin.sh
zinit/plugins
└── _local---gnubin -> ../../gnubin
$ cat gnubin.sh
GNUBIN=$(find -L /usr/local/opt -type d -name gnubin | paste -sd':' -)
GNUMAN=$(find -L /usr/local/opt -type d -name gnuman | paste -sd':' -)
[ ! -z "$GNUBIN" ] && echo "export PATH=\"$GNUBIN:\$PATH\""
[ ! -z "$GNUMAN" ] && echo "export MANPATH=\"$GNUMAN:\$PATH\""
$ cat .zshrc
# ...
zinit depth'3' light-mode for \
NICHOLAS85/z-a-eval
zinit light eval'./gnubin.sh' _local/gnubin
# ...
Output:
Downloading eval./gnubin.sh/_local/gnubin…
Cloning into '/root/.dotfiles/zsh/zinit/plugins/eval.---gnubin.sh---_local---gnubin'...
remote: Not Found
fatal: repository 'https://github.com/eval./gnubin.sh/_local/gnubin/' not found
Clone failed (code: 128).
I think this is useful and worth mentioning in the official document.
Before/After
It's intuitive what kind of situation you need.
Null Plugin Eval
It is good to have an example when caching non-plugin things. (like with id-as
)
# before
zinit lucid wait has'pyenv-virtualenv-init' atclone'pyenv virtualenv-init - > pyenv-venv.zsh' atpull'%atclone' pick'pyenv-venv.zsh' nocompile'!' id-as'pyenv-venv2' for @zdharma-continuum/null
Downloading zdharma-continuum/null… (at label: pyenv-venv2…)
Cloning into '$HOME/.local/share/zinit/plugins/pyenv-venv2'...
==> Compiling pyenv-venv.zsh [OK]
# after
zinit lucid wait has'pyenv-virtualenv-init' eval'pyenv virtualenv-init -' id-as'pyenv-venv1' for @zdharma-continuum/null
Downloading zdharma-continuum/null… (at label: pyenv-venv1…)
Cloning into '$HOME/.local/share/zinit/plugins/pyenv-venv1'...
==> No files for compilation found
Warning: ∞zinit-compile-plugin-hook hook returned with 1
[eval] Caching output of (`pyenv virtualenv-init -…')
I notice the "No files for compilation found" warning when using the eval
ice. However, the zwc
file does exist:
ls $HOME/.local/share/zinit/plugins/pyenv-venv1
LICENSE.md evalcache.zsh evalcache.zsh.zwc readme.md
Is there a way to make sure zinit loaded the complied version? Is this error benign / can it be fixed?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.