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?

  • I have the same problem but at the end at decided to ignore zsh's completion feature, all I want from it is partial-word and case-insensitive but it cost too much, I use fzf ctrl-t instead, cost me more 1 keystroke when fuzzy files but I'm okay with more 1-2 keystrokes. – Tuyen Pham Jun 12 at 3:48

Just use Powerlevel10k's instant prompt feature and you'll be able to add whatever you like to your .zshrc without slowing down your startup time.

| improve this answer | |

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

# 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
compinit -C

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

unsetopt GLOBAL_RCS
setopt noglobalrcs
| improve this answer | |
  • 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 '19 at 15:10
  • I readded only the "autoload -Uz compinit" on my .zshrc with some time gain. – SergioAraujo May 16 '19 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 '19 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.