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

Interactive expansion doesn't work as expected when it matches a single entry then echos command 3 times #780

Closed
ashleybartlett opened this issue Apr 5, 2024 · 6 comments · Fixed by #785

Comments

@ashleybartlett
Copy link
Contributor

This was working, and no longer is. I'm still not a daily driver of zoxide, so can't report on when exactly it stopped working. I did do some upgrades of packages recently (using brew), so could be an incompatibility of new versions? Not sure what else could be causing the problem.

When using z path<SPACE><TAB> it cd's into that directory, and then echos the current directory:
SCR-20240405-khjf

Here are what are likely relevant package versions currently installed:

fzf 0.49.0
zoxide 0.9.4
zsh-autocomplete 23.07.13
zsh 5.9 (x86_64-apple-darwin23.0)

I'm using oh-my-zsh but not any plugins, i've got auto-complete being loaded in my .zshrc file, as below (in order)

source $ZSH/oh-my-zsh.sh
source $(brew --prefix)/share/zsh-autocomplete/zsh-autocomplete.plugin.zsh

eval "$(fzf --zsh)"
# Other auto-completions
eval "$(zoxide init zsh)"

Any ideas? Is this a bug? I can see that fzf is still working in my shell.

@argamanza
Copy link

Looks like the same issue I'm having #775

@ashleybartlett
Copy link
Contributor Author

Yeah, looks to be the same issue

@ashleybartlett
Copy link
Contributor Author

I ran again with setopt xtrace enabled, and the interesting thing is that is that it calls the _zoxide_z function, then _zoxide_cd. I can't see anything obvious wrong here.

I no longer suspect this is something to with fzf.

It's curious that it replaces my search word with an auto-completed entry, and then activates the command. I never hit enter.

@ashleybartlett
Copy link
Contributor Author

Further investigation shows that this appears to only be an issue where there is a single match in the database, and it tries to CD, rather than initiate the interactive mode.

@ashleybartlett ashleybartlett changed the title Interactive expansion does not invoke fzf, instead changes directory and echos command 3 times Interactive expansion doesn't work as expected when it matches a single entry then echos command 3 times Apr 8, 2024
@ashleybartlett
Copy link
Contributor Author

Uhh, I think i've found the problem, I put up a PR, but it's not the root problem. It looks like the zsh completions are being called multiple times causing the weirdness

@ashleybartlett
Copy link
Contributor Author

Raised a PR to fix this #785

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 a pull request may close this issue.

2 participants