{"action":"created","issue":{"url":"https://api.github.com/repos/robbyrussell/oh-my-zsh/issues/4614","labels_url":"https://api.github.com/repos/robbyrussell/oh-my-zsh/issues/4614/labels{/name}","comments_url":"https://api.github.com/repos/robbyrussell/oh-my-zsh/issues/4614/comments","events_url":"https://api.github.com/repos/robbyrussell/oh-my-zsh/issues/4614/events","html_url":"https://github.com/robbyrussell/oh-my-zsh/issues/4614","id":117120233,"number":4614,"title":"call compinit after sourcing plugins","user":{"login":"Konfekt","id":7195553,"avatar_url":"https://avatars.githubusercontent.com/u/7195553?v=3","gravatar_id":"","url":"https://api.github.com/users/Konfekt","html_url":"https://github.com/Konfekt","followers_url":"https://api.github.com/users/Konfekt/followers","following_url":"https://api.github.com/users/Konfekt/following{/other_user}","gists_url":"https://api.github.com/users/Konfekt/gists{/gist_id}","starred_url":"https://api.github.com/users/Konfekt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Konfekt/subscriptions","organizations_url":"https://api.github.com/users/Konfekt/orgs","repos_url":"https://api.github.com/users/Konfekt/repos","events_url":"https://api.github.com/users/Konfekt/events{/privacy}","received_events_url":"https://api.github.com/users/Konfekt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-11-16T13:12:02Z","updated_at":"2015-11-18T06:00:12Z","closed_at":null,"body":"https://github.com/zsh-users/zsh-completions erroneously says that to install `zsh-completions`, add\r\n\r\n```sh\r\nplugins+=(zsh-completions)\r\nautoload -Uz compinit && compinit -i\r\n\u001B\u001B```\r\nto `~/.zshrc.`\r\n\r\nHowever, correctly,\r\n```sh\r\nsource $ZSH/custom/plugins/zsh-completions/zsh-completions.plugin.zsh\r\n```\r\nmust instead be added, because `source $ZSH/oh-my-zsh.sh` FIRST calls `compinit -i -d \"${ZSH_COMPDUMP}\"` and only then sources the plugins.\r\n\r\nIf instead `compinit -i` is called again after  `source $ZSH/oh-my-zsh.sh` then zsh starts noticeably slower.\r\n"},"comment":{"url":"https://api.github.com/repos/robbyrussell/oh-my-zsh/issues/comments/157611824","html_url":"https://github.com/robbyrussell/oh-my-zsh/issues/4614#issuecomment-157611824","issue_url":"https://api.github.com/repos/robbyrussell/oh-my-zsh/issues/4614","id":157611824,"user":{"login":"apjanke","id":2618447,"avatar_url":"https://avatars.githubusercontent.com/u/2618447?v=3","gravatar_id":"","url":"https://api.github.com/users/apjanke","html_url":"https://github.com/apjanke","followers_url":"https://api.github.com/users/apjanke/followers","following_url":"https://api.github.com/users/apjanke/following{/other_user}","gists_url":"https://api.github.com/users/apjanke/gists{/gist_id}","starred_url":"https://api.github.com/users/apjanke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apjanke/subscriptions","organizations_url":"https://api.github.com/users/apjanke/orgs","repos_url":"https://api.github.com/users/apjanke/repos","events_url":"https://api.github.com/users/apjanke/events{/privacy}","received_events_url":"https://api.github.com/users/apjanke/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T06:00:11Z","updated_at":"2015-11-18T06:00:11Z","body":">  Suggested was that ohmyzsh itself calls compinit once after sourcinflg the plugins. So a single time. This still breaks things?\r\n\r\nYep, breaks all the same stuff. `compdef` and related commands depend on `compinit` already having been run.\r\n\r\n> Otherwise perhaps the best bet is to let ohmyzsh take inti account sourcing files from a src folder besides the main folder too\r\n\r\nThat sounds good to me. Would allow plugins more flexibility in setting themselves up, and would be easy for `zsh-completions` and so on to adapt to. I think it would make sense to use folders named `functions` or `completions`, since those are conventional `zsh` directory names for storing autoloadable functions in. (And they're the names already used by [core Oh My Zsh for supplementary functions](https://github.com/robbyrussell/oh-my-zsh/blob/135c3763ccfb07c4a5cde9a2529dfa8d6ba19b39/oh-my-zsh.sh#L9), even though the don't exist right now; see also #4102.)\r\n\r\nThen all `zsh-completions` would have to do is symlink `functions` to `src` in their repo and they'd be good to go, I think. Simply loading it as a normal plugin would work; no need for additional `compinit` calls. The main `zsh-completions.plugin.zsh` would be changed to be empty or just have a comment (since the existence of that file is used to determine if a plugin really is one.)"}}