jirutka / alpine-zsh-config

A sensible system-wide Zsh configuration for Alpine Linux
MIT License
14 stars 1 forks source link

Slow git completion #2

Closed mxkrsv closed 2 years ago

mxkrsv commented 2 years ago

Git completion becomes much slower then without alpine-zsh-config installed. Even for cli arguments. Branch completion is extremely slow, close to unusable. Wondering what it's caused by.

jirutka commented 2 years ago

What’s your setup? Do you use any Zsh plugins and/or Zsh frameworks such as Oh My Zsh?

mxkrsv commented 2 years ago

My setup is fairly simple and I don't touch anything about completion in my configs at all. I use fzf, zsh-autosuggestions and zsh-syntax-highlighting, all three from Alpine repos.

jirutka commented 2 years ago

Hm, that’s a very similar setup to mine (except fzf) and I don’t experience this problem (yet). So you type e.g. git checkout, press Tab and it takes a long time to load the completion? How did you initialize the completion system before using alpine-zsh-config?

Can you please comment out the following and report back? https://github.com/jirutka/alpine-zsh-config/blob/ee0a6841098d7f38c76177b0ec0537acb9dceb3a/zshrc.d/70-completion.zsh#L43

If that doesn’t help, try to disable 70-completion and initialize the completion system manually – add the folllowing line to your .zshenv (~/.config/zsh/.zshenv if you use Alpine defaults or ~/.zshenv if you have .zshrc or other startup files in ~/).

zshrc_blacklist=(70-completion)
mxkrsv commented 2 years ago

How did you initialize the completion system before using alpine-zsh-config?

zstyle :compinstall filename '${HOME}/.zshrc'
autoload -Uz compinit
compinit

So you type e.g. git checkout , press Tab and it takes a long time to load the completion?

Yes, it takes about 10 seconds in aports tree.

#zstyle ':completion:*' use-cache yes

Not helped.

try to disable 70-completion

It... Didn't take any effect. Even with my old configuration and with 70-completion disabled completion is still terribly slow. Looks like it's caused by something out of 70-completion.

mxkrsv commented 2 years ago

Disabling 50-command-not-found.zsh workarounds the issue.

mxkrsv commented 2 years ago

By adding echo "$@" >>~/log to 50-command-not-found.zsh I found that it's caused by missing locale from musl-locales.

mxkrsv commented 2 years ago

50-command-not-found.zsh also breaks man autocompleton because of missing manpath command, while it works greatly w/o manpath if 50-command-not-found.zsh is disabled.

jirutka commented 2 years ago

I’m still unable to reproduce this problem. Can you please provide me with your complete Zsh configuration? Also what Zsh version do you have installed?

mxkrsv commented 2 years ago

Can you please provide me with your complete Zsh configuration?

Sure, it's in https://git.sr.ht/~begs/dotfiles.

what Zsh version do you have installed?

Zsh package version is 5.8.1-r4.

I’m still unable to reproduce this problem.

Here's a minimal working example.

Just type git checkout and press Tab.

jirutka commented 2 years ago

I accidentally had musl-locales installed, that’s why I couldn’t reproduce it. Now I see it and I’ve fixed the problem in 2b4a1be. I’ll release a new version shortly.

Thanks for helping me figure out where’s the problem!

Sure, it's in https://git.sr.ht/~begs/dotfiles.

Do you know that you can just create .zshenv with ZSH_LOAD_SYSTEM_PLUGINS=yes or create symlinks for Zsh plugins in ~/.local/share/zsh/plugins to load Zsh plugins? Then you can remove the plugins section from your .zshrc.

mxkrsv commented 2 years ago

Thanks for helping me figure out where’s the problem!

Thanks for fixing the problem!

you can just create .zshenv with ZSH_LOAD_SYSTEM_PLUGINS=yes

Thanks, very useful as well, simplifies everything a bit.