8000 Completion for ZSH doesn't work in default path · Issue #38 · adaszko/complgen · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Completion for ZSH doesn't work in default path #38

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

Closed
meator opened this issue Jan 5, 2024 · 7 comments
Closed

Completion for ZSH doesn't work in default path #38

meator opened this issue Jan 5, 2024 · 7 comments

Comments

@meator
Copy link
Contributor
meator 8000 commented Jan 5, 2024

I have converted the usage/complgen.usage to ZSH completion script and put it into the standard ZSH completions directory, /usr/share/zsh/site-functions/_complgen. It doesn't work. It doesn't generate any warnings nor errors, but by looking around, I came across this warning:

/usr/share/zsh/site-functions/_complgen:377: command not found: compdef

All of the other completions in /usr/share/zsh/site-functions begin with #compdef ..., but not complgen. Are complgen's ZSH completion scripts incompatible with this type of completion script distribution?

I should note that I am not familiar with the completion systems of the major shells. I have hoped that this program would spare me from this.

@adaszko
Copy link
Owner
adaszko commented Jan 6, 2024

Under ZSH, the completion system needs to be initialized first to use any completion script, not just those generated by complgen.

Take a look at https://unix.stackexchange.com/a/477909

@meator
Copy link
Contributor Author
meator commented Jan 6, 2024

All other completion scripts in that directory are fully functional. I believe the completion system is initialised well. But the complgen's one is the odd one out. I believe this could be related to the #compldef line.

@adaszko
Copy link
Owner
adaszko commented Jan 7, 2024

I don't think that's the problem. I won't be at a physical keyboard for another week or so but AFAIR there are two forms allowed -- with and without the compdef comment line.

That same completion script works fine when installed via homebrew.

Check if that completion script works if you source the generated file.

Make sure the said directory is listed in the $fpath zsh variable.

You may also need to rm ~/.zcompdump after putting the script in that directory.

If all the above fails, see if the completion works if you manually add the compdef line.

@meator
Copy link
Contributor Author
meator commented Jan 7, 2024

Check if that completion script works if you source the generated file.

It works when sourcing manually with source or ..

Make sure the said directory is listed in the $fpath zsh variable.

/usr/share/zsh/site-functions is a standard ZSH directory for completions. All other completions in that directory are fully functional. /usr/share/zsh/site-functions is in my $fpath.

You may also need to rm ~/.zcompdump after putting the script in that directory.

I have tried this and it didn't change anything.

If all the above fails, see if the completion works if you manually add the compdef line.

When

#compdef complgen

is added to the beginning of that file, it starts working.

@adaszko
Copy link
Owner
adaszko commented Jan 9, 2024

That's strange. Looks like complgen needs a specific end-to-end test for that case. Current ones test generated scripts by sourcing them. I'll get to it when I'm at a physical keyboard again. Thanks for reporting.

@adaszko
Copy link
Owner
adaszko commented Jan 22, 2024

The generated zsh completions scripts should now work both when autoloaded or sourced. I want to implement on more new feature (aot fallbacks) and will then make a new release. Thanks again @meator!

@meator
Copy link
Contributor Author
meator commented Jan 22, 2024

Ok, thanks!

nikitabobko added a commit to nikitabobko/AeroSpace that referenced this issue Jul 9, 2024
nikitabobko added a commit to nikitabobko/AeroSpace that referenced this issue Jul 9, 2024
jakenvac pushed a commit to jakenvac/AeroSpace that referenced this issue Aug 16, 2024
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

2 participants
0