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

If the exact name is specified, choose that dir. #956

Open
dev-ardi opened this issue Dec 13, 2024 · 2 comments
Open

If the exact name is specified, choose that dir. #956

dev-ardi opened this issue Dec 13, 2024 · 2 comments

Comments

@dev-ardi
Copy link

dev-ardi commented Dec 13, 2024

I have 2 directories:

│ ▌  308.0 /home/ardi/repos/prust
│     57.5 /home/ardi/repos/prust/mailbox
│     36.0 /home/ardi/repos/rust
                                                                                                                 

If I type in rust it goes to prust because it has more score. I'd like it to go to rust because it's the exact mach.

weirdly enough, if I type rust/ it goes to prust/mailbox
cc: #876

@antoyo
Copy link

antoyo commented Jan 13, 2025

I have a similar issue.

An alternative option (that could be behind a config) would be to take into account what is typed to choose the default directory selected.

I work on three projects that share part of their name:

  • rust
  • rustc_codegen_gcc
  • gcc

I would like the following behavior:

z rust # Goes to rust
z rustc # Goes to rustc_codegen_gcc
z gcc # Goes to gcc

Currently, all three options have the chance to go to the directory rustc_codegen_gcc.

@dev-ardi: Would that behavior suits you as well (you could type rust to go to rust and prust to go to prust)?

@SeeStarz
Copy link

SeeStarz commented Feb 15, 2025

This is related to #260
You can take a look at my PR #980 (added zoxide cli flag -e or --exact for exact match)
I don't have much experience, I don't really know why the tests fail or how I can integrate shell aliases, for now you can probably do bandaid solution like:

ze() {
  cd "$(zoxide query -e $@)"
}

On your .bashrc or similar

edit: You probably can take a look at the defaults for a shell and adjust it, for me I use fish and I just pretty much copied most of it

function ze -d "Z jump exact"
    set -l argc (builtin count $argv)
    if test $argc -eq 0
        __zoxide_cd $HOME
    else if test "$argv" = -
        __zoxide_cd -
    else if test $argc -eq 1 -a -d $argv[1]
        __zoxide_cd $argv[1]
    else if test $argc -eq 2 -a $argv[1] = --
        __zoxide_cd -- $argv[2]
    else
        set -l result (command zoxide query --exclude (__zoxide_pwd) -e -- $argv)
        and __zoxide_cd $result
    end
end

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

3 participants