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

Respect CDPATH #620

Open
robertmeta opened this issue Sep 17, 2023 · 5 comments
Open

Respect CDPATH #620

robertmeta opened this issue Sep 17, 2023 · 5 comments

Comments

@robertmeta
Copy link

Is there any reason it does not support CDPATH?

@GarySmith
Copy link

Without CDPATH support, zoxide is a step backward from the basic cd command provided in bash. Too bad

@naquad
Copy link

naquad commented Feb 29, 2024

zoxide is great and it has streamlined my workflow A LOT.

Although, in the times before it there were named directories, cdpath, and the completion of all this provided by zsh. While named directories are working as expected - no questions here, the cdpath + its completion is something I would highly appreciate as the muscle memory after years of typing still makes it appear faster than I can think about what I'm doing.

Please consider the option to process the cdpath to make zoxide even more awesome and let alias cd=z become a common default on every localhost out there :)

Thank you.

@fawaf
Copy link

fawaf commented Mar 22, 2024

+1 1000%, was very surprised when i was trying out zoxide that it did not support CDPATH

@DeadlySquad13
Copy link

DeadlySquad13 commented May 12, 2024

Currently found a workaround using builtin zoxide functions. I have all commonly visited places in ~/.bookmarks which is added in CDPATH. I just added all links into zoxide database from this directory:

zoxide add ~/.bookmarks/*

now all these links are in database as if I have visited them. And it's possible to jump to them using zoxide.

I think t's quite easy to develop a one liner iterating over all directories from CDPATH and adding items inside into database if you have a lot of entries.

It's not automatic, of course, and these directories will be purged from zoxide database over time if you don't enter them. But I think the whole idea of bookmarks is a little bit contradicting zoxide frictionless approach to navigating your filesystem. So I personally decided that this temporary workaround is enough for me and it's better to try to adapt zoxide system: over time all these bookmarks you were manually managing with CDPATH would get into zoxide anyway. And with proper priorities!

Anyway, from a project design view, it's bad when users get surprised: after all, it's quite strange that "smarted cd command" doesn't have some functionality of a cd. It would be so cool if zoxide would respect CDPATH so that users wouldn't need to change their workflow when making first steps in adapting zoxide. Anyway, thanks for your hard work making this cool project!

@beorn
Copy link

beorn commented Jun 12, 2024

A bit annoying for sure, but the workaround described above:

function add_cdpath_to_zoxide() {
  local pths = ()
  for pth in $cdpath ; do
    [[ -d "$pth" ]] && pths += ("${pth}"/*(/N))
  done
  if [[ ${#pths[@]} -gt 0 ]]; then
    zoxide add "${pths[@]}"
  fi
}

c=~/Code # example zsh named directory
cdpath=( ~c/*(/) ~/Desktop/*(/) ~/Documents/*(/) )

if (( $+commands[zoxide] )) ; then
  eval "$(zoxide init zsh)"
  add_cdpath_to_zoxide
fi

belminf added a commit to belminf/dotzsh that referenced this issue Aug 12, 2024
belminf added a commit to belminf/dotzsh that referenced this issue Aug 12, 2024
belminf added a commit to belminf/dotzsh that referenced this issue Aug 12, 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

6 participants