Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoload -U in default ~/.oh-my-zsh/oh-my-zsh.sh *runs* compinit #1002

Open
maxzinkus opened this issue Mar 19, 2023 · 4 comments
Open

autoload -U in default ~/.oh-my-zsh/oh-my-zsh.sh *runs* compinit #1002

maxzinkus opened this issue Mar 19, 2023 · 4 comments

Comments

@maxzinkus
Copy link

It is my understanding that autoload -U should pull in function definitions for later use, hence the pattern (suggested in man zshcompsys):

autoload -U compinit
compinit

However, (as determined by much manual testing with ~/.zshrc:1:zmodload zsh/zprof and ~/.zshrc:-1:zprof, with no other calls, compinit is called once per shell startup. Commenting out oh-my-zsh.sh:68:autoload -U compaudit compinit zrecompile brings this down to 0 and makes shell startup dramatically faster.

The issue is that I further update the fpath after omz is loaded, which means that at every shell startup compinit is run twice: once by omz because of the reduced count of fpath functions since last complete startup, and then again after my customizations.

This is wildly annoying and should be resolved with ZSH_DISABLE_COMPFIX -- which prevents omz's explicit compinit call. However, the autoload line still runs compinit for whatever reason.

@maxzinkus maxzinkus changed the title autoload -U in default ~/.oh-my-zsh/oh-my-zsh.sh **runs** compinit autoload -U in default ~/.oh-my-zsh/oh-my-zsh.sh runscompinit Mar 19, 2023
@maxzinkus maxzinkus changed the title autoload -U in default ~/.oh-my-zsh/oh-my-zsh.sh runscompinit autoload -U in default ~/.oh-my-zsh/oh-my-zsh.sh *runs* compinit Mar 19, 2023
@gandarez
Copy link

up

@msva
Copy link
Contributor

msva commented Apr 18, 2023

This repo has nothing to do with oh-my-zsh, and contains general zsh completions. It is not a part of o-m-z, and "compatibility" layers are provided only by good will.

Please, report o-m-z bugs to o-m-z.

@maxzinkus
Copy link
Author

It is true that I found this issue due to use of "o-m-z". However, as far as I can tell, the issue is with autoload and/or compinit. Your insight in nailing down which it is would be helpful and appreciated.

I could of course be totally wrong and this is purely an omz issue -- your explanation there would be appreciated as well.

@maxzinkus
Copy link
Author

Also, if there's a more appropriate place to discuss issues with zshcompsys -- please redirect me with my apologies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants