Skip to content

fix(completions): preserve _abbr completion function [#210] - #211

Open
ybiquitous wants to merge 2 commits into
olets:mainfrom
ybiquitous:fix-issue-210-completion
Open

fix(completions): preserve _abbr completion function [#210]#211
ybiquitous wants to merge 2 commits into
olets:mainfrom
ybiquitous:fix-issue-210-completion

Conversation

@ybiquitous

Copy link
Copy Markdown

Fixes #210

The unfunction -m _abbr in the post-init cleanup was clobbering the shipped completion function completions/_abbr that the user's compinit had autoloaded. The plugin never defines a function named _abbr itself.

The `unfunction -m _abbr` in the post-init cleanup was clobbering
the shipped completion function `completions/_abbr` that the user's
`compinit` had autoloaded. The plugin never defines a function
named `_abbr` itself.

@olets olets left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a test 💯

Couple inline suggestions, because I'm fine relying on the commit message to reference the bug report (as you did) - no need to tag it in the code.

And one inline question.

Comment thread tests/index.ztr.zsh Outdated
Comment thread tests/index.ztr.zsh Outdated
Comment thread tests/index.ztr.zsh
# Autoload the shipped completion function (regression guard for #210).
# The fpath addition persists for the rest of the suite; harmless.
fpath=( $abbr_dir/completions $fpath )
autoload -Uz _abbr

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary? (Still afk, otherwise I'd check!)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, ztr test '(( $+functions[_abbr] ))' checks only true after autoload -Uz _abbr marks function. But there may be another better way.

Comment thread zsh-abbr.zsh Outdated
Comment thread tests/_completion.ztr.zsh Outdated
Co-authored-by: Henry Bley-Vroman <bley.vroman@gmail.com>
@ybiquitous
ybiquitous requested a review from olets May 11, 2026 13:00
@ybiquitous

Copy link
Copy Markdown
Author

Hi @olets, this is a friendly reminder.
If you have some time, could you take a quick look? Thanks.

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

Successfully merging this pull request may close these issues.

[Bug report] abbr <TAB> errors with command not found: _abbr because zsh-abbr.zsh unfunction _abbr completion function

2 participants