“Initializing stuff like fasd etc.” — well, doing complex things is bound to take some time.
Here are a few generic tips to speed up zsh startup:
- Only run commands you actually need. Don't use huge generic frameworks like oh-my-zsh that define yet another configuration layer that pretends to cater for everyone (but actually doesn't, anyway).
- Avoid running subprocesses. For short string manipulation, use zsh's built-in constructs, not
- Use byte-compiled files for anything large.
- Make sure that completion information is cached: pass
- Load things lazily, i.e. on first use. Use
To find what's taking so long, profile your
- You can get some measurements from the zsh profiler. Add
zmodload zsh/zprof at the top of your
.zshrc and run
- You can trace what zsh is doing (note that the tracing itself will slow things down, but in a mostly-uniform manner). Add
setopt prompt_subst; zmodload zsh/datetime; PS4='+[$EPOCHREALTIME]%N:%i> '; set -x at the top of your