4

So I wanted to get away from oh-my-zsh because it made my shell startup lag noticeably (>0.1s). Indeed, after removing oh-my-zsh the startup time went to 0.02s but now I started adding features manually back in. First and foremost, the case insensitive tab completion. For this reason I added something like

autoload -U compinit compinit zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}'

to my .zshrc. However, this one small feature alone increased my startuptime almost threefold, whereas other feature like syntax highlighting or autosuggestions don't seem to impact the startup time at all.

In bash I can get the desired case insensitive completion simply via bind 'set completion-ignore-case on' without any performance decrease (startup time ~ 0.01s).

I have no idea what compinit does, but is there no way to get case insensitive completion in zsh without slowing down startup significantly?

0

You could add the "compinit" references on the .zlogin instead of .zshrc, in my case the loading time improved a lot. I also have a test to recompile the compinit only once a day.

autoload -Uz zrecompile
autoload -Uz compinit
dump=$ZSH_COMPDUMP

# http://zsh.sourceforge.net/Doc/Release/Conditional-Expressions.html
if [[ -s $dump(#qN.mh+24) && (! -s "$dump.zwc" || "$dump" -nt "$dump.zwc") ]]; then
    compinit -i d $ZSH_COMPDUMP
    zrecompile $ZSH_COMPDUMP
fi
compinit -C

On my .zshenv I have this to avoid loading global configuration:

unsetopt GLOBAL_RCS
skip_global_compinit=1
setopt noglobalrcs
  • I added the two code chunks to their respective files and removed the compinit reference from my .zshrc, but now all the features are gone (even after reboot). – xel May 16 at 15:10
  • I readded only the "autoload -Uz compinit" on my .zshrc with some time gain. – SergioAraujo May 16 at 18:31
  • even if I put autoload -Uz compinit but not compinit in my .zshrc, none of the expected features work.. – xel May 17 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.