Open rossmacarthur opened 3 years ago
Some notes about Znap:
znap clone
to download plugins in parallel. For example, you can add this at the top of your .zshrc
file or just run it once on the command line:
znap clone \
marlonrichert/{zcolors,zsh-autocomplete,zsh-edit,zsh-hist} \
zsh-user/{zsh-autosuggestions,zsh-completions,zsh-syntax-highlighting}
If a plugin is already there, then znap clone
will silently ignore it and not download it again.
When znap prompt
is executed, your prompt becomes visible instantly, even while the rest of your .zshrc
hasn't loaded yet. For example:
source ~/Git/zsh-snap/znap.zsh
znap prompt sindresorhus/pure # Prompt becomes visible _immediately_ at this point.
# Everything below happens while you are already typing at the prompt.
znap source marlonrichert/zsh-autocomplete
znap source zsh-users/zsh-autosuggestions
znap source zsh-users/zsh-syntax-highlighting
This way, it matters far less how long the rest of your .zshrc
takes to execute. Since your prompt is there and you're able to type, it feels like your shell has already finished starting up. If you're going to measure load time, you should also measure time-to-prompt.
eval
statements in their .zshrc
, like this one:
eval "$( pipenv --completion )"
This particular statement can take up to 0.5 seconds to execute. However, you can speed that up considerably by using znap eval
:
znap eval pipenv-completion 'pipenv --completion'
Now it takes only 2 milliseconds! If you really want to measure performance, then you should also include eval
statements, since these are typically what takes the most time in one's .zshrc
file.
See https://github.com/marlonrichert/zsh-snap