zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
31.57k stars 1.88k forks source link

Conflict with atuin and completion strategies #797

Open sainttttt opened 4 months ago

sainttttt commented 4 months ago

Like other users I've noticed that the completion strategy was never working, so I tried to do some debugging to see what was going on. I noticed that ZSH_AUTOSUGGEST_STRATEGY variable was getting inserted with atuin when being called in the _zsh_autosuggest_fetch_suggestion function.

So here in strategies=(${=ZSH_AUTOSUGGEST_STRATEGY}), It would print out as (atuin completion). Doing some more debugging I found out that somehow this gets injected right at _zsh_autosuggest_start. Before this the variable seems fine.

So one fix I did was removing the first entry in the array with a slice, but also using another variable, like strategies=(${=ZSH_AUTOSUGGEST_STRATEGY_2}) and setting ZSH_AUTOSUGGEST_STRATEGY_2 in my zshrc also works. atuin doesn't get injected into the other variable and it works fine. I have no idea how or why atuin is getting injected into the variable and was hoping that you could possibly help me debug this further. As it stands, using the variable name change works and the completions now work as expected, but it would be nice to have a permanent fix.

Oh also in case you are not familiar, atuin is a shell plugin which gives you better command history and searching and is somewhat popular.

Please let me know if there is more information you need, Thanks!

bpeetz commented 1 month ago

atuin injects itself when it notices, that you are using zsh-autosuggestions: https://github.com/atuinsh/atuin/blob/5c29057e9ac8af4cb94edd0819057e2b2dd34557/crates/atuin/src/shell/atuin.zsh#L21

So I think that is intentional behavior of atuin.