5

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?

1
  • 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, 2020 at 3:48

2 Answers 2

1

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.

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
3
  • 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, 2019 at 15:10
  • I readded only the "autoload -Uz compinit" on my .zshrc with some time gain. May 16, 2019 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, 2019 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .