zsh-users
 help / color / mirror / code / Atom feed
* Adding a completion file has created a delay in ZSH startup time
@ 2021-09-29  9:43 Peter Slížik
  2021-09-29  9:54 ` Roman Perepelitsa
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Slížik @ 2021-09-29  9:43 UTC (permalink / raw)
  To: Zsh-Users List

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

Hello,

I'm trying to write my first completion file.

I've added ~/.zsh/completions to fpath:

fpath=(~/.zsh/autoload ~/.zsh/completions $fpath)

Then I created file ~/.zsh/completions/_myapp with the following content:

#compdef myapp
compadd start restart stop

However, this seemingly simple change has added 1 or 2 seconds to ZSH start
time. The start used to be almost immediate. Now there is an annoying delay.

What is the reason?

Best regards,
Peter

[-- Attachment #2: Type: text/html, Size: 1189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Adding a completion file has created a delay in ZSH startup time
  2021-09-29  9:43 Adding a completion file has created a delay in ZSH startup time Peter Slížik
@ 2021-09-29  9:54 ` Roman Perepelitsa
  0 siblings, 0 replies; 2+ messages in thread
From: Roman Perepelitsa @ 2021-09-29  9:54 UTC (permalink / raw)
  To: Peter Slížik; +Cc: Zsh-Users List

On Wed, Sep 29, 2021 at 11:45 AM Peter Slížik <peter.slizik@gmail.com> wrote:
>
> Hello,
>
> I've added ~/.zsh/completions to fpath:
>
> fpath=(~/.zsh/autoload ~/.zsh/completions $fpath)
>
> this seemingly simple change has added 1 or 2 seconds to ZSH start time.

This usually happens when compinit is invoked before and after you
modify fpath. The biggest offender here is Ubuntu. Its global zshrc
has this awfulness:

    # If you don't want compinit called here, place the line
    # skip_global_compinit=1
    # in your $ZDOTDIR/.zshenv
    if grep -q '^ID.*=.*ubuntu' /etc/os-release && [[ -z
"$skip_global_compinit" ]]; then
     autoload -U compinit
     compinit
    fi

The solution is to add skip_global_compinit=1 to ~/.zshenv.

Naturally, you also need to ensure that your own rc files invoke
compinit only once, after all changes to fpath.

Roman.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-29  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29  9:43 Adding a completion file has created a delay in ZSH startup time Peter Slížik
2021-09-29  9:54 ` Roman Perepelitsa

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).