zoxide icon indicating copy to clipboard operation
zoxide copied to clipboard

zi does not understand ~

Open Gorthog opened this issue 3 years ago • 7 comments

image

z does image

Gorthog avatar Aug 15 '22 10:08 Gorthog

@adamnejm this is not related to the current issue, can you create a separate issue for it? Also:

  • Can you verify that this is happening on the latest version of zoxide?
  • What version of fish are you using?
  • Can you post your configuration?

ajeetdsouza avatar Sep 03 '22 21:09 ajeetdsouza

@ajeetdsouza It was in fact stupid misconfiguration on my part. I accidentally swapped places of sourcing zoxide and cd alias definition. This is not an issue nor related to this thread in any way, so I removed my previous comment. Sorry!

adamnejm avatar Sep 03 '22 22:09 adamnejm

Can repro.

zoxide v0.8.2 (zoxide-0:0.8.2-1.fc36.x86_64) bash 5.2.2 Fedora 36 Default config — no zoxide env vars are set, no options for zoxide init, just eval "$(/usr/bin/zoxide init bash)"


It's not about ~, that is expanded by the shell before it reaches zoxide.

zi fails on the user's home dir where z doesn't:

$ cd /tmp #to make sure it isn't about being in the same dir
$ zi ~
zoxide: no match found
$ zi "${HOME}"
zoxide: no match found
$ zi /home/jn
zoxide: no match found
$ z ~ #works

According to the README, _ZO_EXCLUDE_DIRS is set to $HOME by default, but I think it's reasonable for the user to expect zi to work the same as z in this case.

Testing that it's related to _ZO_EXCLUDE_DIRS:

  • Set _ZO_EXCLUDE_DIRS to blank value (or any other value) by adding to shell rc:
    export _ZO_EXCLUDE_DIRS=
    
  • Start new shell
  • Populate the db:
    $ zoxide add /home/jn
    
  • Now zi ~ works

jn64 avatar Nov 19 '22 09:11 jn64

@Gorthog @jn64 why would you use zi ~ when you have z ~?

ajeetdsouza avatar Nov 19 '22 15:11 ajeetdsouza

I wouldn't use either.

jn64 avatar Nov 19 '22 16:11 jn64

@ajeetdsouza I find zi behavior more efficient. when it has just a single match, it just jumps, when it has several matches, it shows me a list and i can choose. z just picks the first every time and it's not always what i want. i don't want to press space + tab every time, because when there is a single match there is no need for it

Gorthog avatar Nov 19 '22 17:11 Gorthog

@Gorthog @jn64 why would you use zi ~ when you have z ~?

@ajeetdsouza It sounds reasonable to me to use zi all the time if one likes the way it works, not having to mentally switch to z only in some cases.

memark avatar Dec 11 '22 20:12 memark

Then un-exclude your home folder as explained above.

Anyway even z ~ is redundant. Just do z without arguments (like cd without arguments).

jn64 avatar Dec 12 '22 04:12 jn64