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

Custom widgets not working when widget name starts with autosuggest- #496

Closed
Dzordzu opened this issue Jan 15, 2020 · 1 comment
Closed
Labels

Comments

@Dzordzu
Copy link

Dzordzu commented Jan 15, 2020

Hi. I've tried to define a custom wiget for my zsh. Basically - it's not working, autocompletion does not work. Config is rather straightforward

function autosuggest-partial-accept {
   CURSOR+=1
}
zle -N autosuggest-partial-accept
bindkey -v '^g' autosuggest-partial-accept
ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=(
      autosuggest-partial-accept
)

What am I supposed to do, in order to get it to work? Thanks in advance

It's not actually a bug report, or a feature request. It's more like a requst for the help

@ericfreese
Copy link
Member

To get your code working now, you need to prefix your widget with something other than autosuggest-. That prefix is currently ignored when we wrap existing widgets with autosuggestion functionality so that we don't wrap our own widgets.

However, there's not really a good reason for this behavior. We should just be able to ignore the specific existing widgets (autosuggest-fetch, autosuggest-suggest, etc.) instead of all matching autosuggest-*.

Let's leave this open as a bug and I'll fix it at some point.

@ericfreese ericfreese changed the title Custom widgets not working Custom widgets not working when widget name starts with autosuggest- Jan 19, 2020
@ericfreese ericfreese added the bug label Jan 19, 2020
ericfreese added a commit that referenced this issue Jan 25, 2020
To avoid wrapping the built-in widgets (e.g. `autosuggest-fetch`,
`autosuggest-toggle`), we were ignoring all widgets whose names start
with `autosuggest-`. This had the downside of preventing wrapping of
user-defined widgets whose names happened to also start with that
prefix.

By being more specific about the exact built-in widgets we want to avoid
wrapping, we can allow users to define widgets whose names start with
`autosuggest-`.

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

No branches or pull requests

2 participants