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

zi no longer uses fzf for completion #626

Open
hrouault opened this issue Sep 28, 2023 · 10 comments
Open

zi no longer uses fzf for completion #626

hrouault opened this issue Sep 28, 2023 · 10 comments

Comments

@hrouault
Copy link

It has been one or two months that zi no longer completes using fzf.

I installed zoxide (version 0.9.2) with cargo, and fzf was installed through homebrew (version 0.42.0 by homebrew on OSX).

zoxide is configured with "zoxide init fish | source".

Do you have any suggestions on how to debug this? I've tried to use the query command, which also does not use fzf.

Thanks

@vimkim
Copy link

vimkim commented Oct 4, 2023

This is exactly what I was curious about.

I'm using powershell 7 in Windows 11.

I upgraded winget, delete zoxide 0.9.2 and reinstalled both winget and choco version zoxide, uninstalled fzf v0.42 and force reinstalled and I could not make the fuzzy match work when using zi.

Fzf has no problem when used directly.

My profile.ps1 looks like this, which is a typical setting for a powershell user I guess.

Invoke-Expression (& {
        $hook = if ($PSVersionTable.PSVersion.Major -lt 6) { 'prompt' } else { 'pwd' }
    (zoxide init --hook $hook powershell | Out-String)
    })

@amsam0
Copy link

amsam0 commented Oct 7, 2023

I am also noticing this. fzf is on PATH but zi does not appear to use it.
It would also be nice if z used fzf for matching.

@ohai89
Copy link

ohai89 commented Oct 9, 2023

Zoxide 0.9.1 changed how fn get_fzf() uses args. (query.rs:76)
That update added Search mode --exact which to me seems to be the culprit here.
--exact means just that, exact match for fzf search, not a fuzzy one.

I don't know if that was done to fix some other functionality, I am not well-versed in Rust.
But with a quick test commenting that argument out, and rebuilding the package with cargo the omit of that flag returns fuzzy matching.

@amsam0
Copy link

amsam0 commented Oct 9, 2023

It was done to fix #514. I think a better fix would be to use fuzzy finding to match the directories, then rank them.

For now, you can set the _ZO_FZF_OPTS environment variable to --scheme=path --tiebreak=end,chunk,index --bind=ctrl-z:ignore,btab:up,tab:down --cycle --keep-right --border=sharp --height=45% --info=inline --layout=reverse --tabstop=1 --exit-0 --select-1 to revert to the old behavior.

@ajeetdsouza
Copy link
Owner

I've tried to use the query command, which also does not use fzf.

Hey @hrouault, you can use zoxide query -i to open up fzf. (This is just for debugging, it will not change your current directory).

To help me understand this issue better, could someone share a screenshot of the kind of queries you are making that rely on fuzzy search?

@fleimgruber
Copy link

fleimgruber commented Oct 13, 2023

I tried zoxide query -i with de<TAB> as argument for getting at .\dev\my-favorite-project, but only regular PowerShell completion is triggered.

Edit: after reading and thinking a bit more, I now see completion candidates. Please ignore my comment.

@ohai89
Copy link

ohai89 commented Oct 13, 2023

Hi @ajeetdsouza, please find an example query with fuzzy search active below.
fuzzy_search_example
Essentially I have a bunch of folders with same kind of names: project-language
With fuzzy search I can land on netops-python with query ntp and netops-go with ntg.
Without fuzzy search I'd have to write out the path more fully.
(mind that this is the output of latest zoxide version with the --exact commented out, and rebuilt via crate)

Yes, without exact search I could get to both folders by querying python or go directly, but in my mind I associate the project name quite heavily to be a part of the query, and tend to begin by writing that out.

In any case I have grown accustomed to fuzzy searching since I can't be bothered to write out the full name of folders most of the time :)

@michaelbeaumont
Copy link

To help me understand this issue better, could someone share a screenshot of the kind of queries you are making that rely on fuzzy search?

Is a screenshot necessary?

If I have a directory /../../work in my list and I type zi<ENTER>wrk, my /../../work directory isn't in fzf's results list. It seems blatantly more useful for my /../../work directory to be in the list.

Maybe I'm fundamentally misunderstanding what zoxide is for (or I haven't configured it properly?) for this not to clearly be a very breaking bug.
For that matter I'm at a loss to understand why supporting fuzzy search isn't part of the main z command but that's another issue.

Ultimately some directory paths are mentally easier to "type quickly" using letters that aren't a prefix of one of the path elements.

@amsam0
Copy link

amsam0 commented Oct 23, 2023

I agree, fuzzy finding on the main z command (in addition to zi) would be incredibly useful

@den-is
Copy link

den-is commented Apr 13, 2024

Any updates on this thread?
I'm not using zoxide interactive but only usual z in shell.
Similar issues mentioned in my original issue #638 sometime "make me" to switch back to autojump.
imho docs vs doc and other examples are annoying, time to time I have "to think" and "type query precisely" 🙃

tonysyu pushed a commit to tonysyu/dotfiles that referenced this issue Oct 15, 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

8 participants