zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
31.41k stars 1.87k forks source link

Prompt is slow after multiple "source ~/.zshrc" #470

Open silverneko opened 5 years ago

silverneko commented 5 years ago

Describe the bug

zsh prompt becomes very slow after multiple times of "source ~/.zshrc". I suspect it's the widgets of "_zsh_autosuggest_bound_#n_*" slowing zsh down, because after every time I do "source ~/.zshrc" the number of these widgets increases. For example when a new shell starts only widgets of "_zsh_autosuggest_bound_1_*" are registered, and after a second "source ~/.zshrc" widgets of "_zsh_autosuggest_bound_2_*" are added. I use oh-my-zsh to load this plugin.

To Reproduce

Do this for 10 to 20 times:

$ source ~/.zshrc

Desktop

ericfreese commented 5 years ago

I could see this being an issue but will probably be low priority for me to fix since the issue is avoidable by not re-sourcing zshrc many times.

silverneko commented 5 years ago

You're right! It's not really a issue for normal users. I only encounter this issue because I'm testing with different .zshrc configurations thus sourcing .zshrc multiple times.

z0rc commented 5 years ago

Sourcing .zshrc isn't optimal in many ways and will break more than z-asug. Instead it's better to use exec zsh to completely reinit from clean state.

NightMachinery commented 4 years ago

@silverneko How do you check the list of all widgets?

silverneko commented 4 years ago

zle -l or if you have auto completion then _<tab>