zcomet icon indicating copy to clipboard operation
zcomet copied to clipboard

Feature request: "eval" function

Open eddyg opened this issue 2 years ago • 2 comments

Thanks for zcomet! It's easy to use and understand, and seems fast too.

Hopefully this idea is easy to understand.

Similar to zcomet snippet, it would be nice to be able to cache the output of slow commands that are normally eval'd. For example:

zcomet eval "$(/opt/homebrew/bin/brew shellenv)"
zcomet eval "$(pyenv init -)"
zcomet eval "$(pyenv virtualenv-init -)"

Open to other suggestions / alternatives, of course!

eddyg avatar Jun 14 '22 02:06 eddyg

Thanks for the suggestion!

Have you tried using mroth/evalcache? I haven’t tried it myself, but it looks as if it should do what you need.

agkozak avatar Jul 01 '22 16:07 agkozak

This is great! I was manually caching these kinds of things to files, like a chump :)

...

source "${HOME}/.local/share/zcomet/zcomet.zsh"

zcomet load mroth/evalcache
...
zcomet compinit

ZSH_EVALCACHE_DIR=${ZDOTDIR}/.zsh-evalcache

# hooks
_evalcache direnv hook zsh
_evalcache fasd --init auto
_evalcache pyenv init - --no-rehash zsh
_evalcache pyenv virtualenv-init - zsh

# completion
_evalcache pip completion --zsh
_evalcache register-python-argcomplete pytest pipx

...

joshbode avatar Jul 19 '22 11:07 joshbode