zoxide icon indicating copy to clipboard operation
zoxide copied to clipboard

Add these 2 features in zoxide, 1. Add multiple directories path, 2. Remove multiple paths

Open rix4uni opened this issue 5 months ago • 9 comments

I deleted zoxide 2 times because it was not fast and i watched some youtube videos and found out i don't have any paths in zoxide database so i added all paths of those directories i regularly visit's using zpath_add and removed some paths that are not important using zpath_remove.

Now my zoxide setup 10x faster than before Please add these feature in zoxide it will more fast because zoxide written in rust.

zpath_add() {
  for base in "$@"; do
    find "$base" -type d -print0
  done | while IFS= read -r -d '' dir; do
    zoxide add "$dir"
    #echo "✅ Added: $dir"
  done
}
# zpath_add ~/.config ~/.garudrecon ~/some/other/path

# Recursive Add all directories path from input directories
~/.config
~/.config/waymore
~/.config/waymore/results
zpath_remove() {
  zoxide query -l | grep -E "$1" | while read -r dir; do
    zoxide remove "$dir"
    #echo "❌ Removed: $dir"
  done
}
# zpath_remove "~/.config|~/.garudrecon|sourcemapper"

# remove all paths anywhere input matches, e.g. "sourcemapper"
~/.garudrecon/scans/xyz.app/sourcemapper/cc-fe
~/.garudrecon/scans/xdfhfr.com/sourcemapper/gjh-pkj

rix4uni avatar Jul 10 '25 08:07 rix4uni

Maybe I'm missing something, but entering a new directory with z path/to/directory should add it to your zoxide database. Currently, zoxide add already takes list of directories as an argument, so I'm not really sure what the feature you're requesting is.

@ajeetdsouza Unless I'm missing something about what @rix4uni is asking, I think this issue should be closed.

azaleacolburn avatar Aug 10 '25 00:08 azaleacolburn

ls -l ~/.config
amass
chaos
favinfo

This will only add single directory path

zoxide add ~/.config

e.g.
~/.config

This will add all directory paths exists in ~/.config

zpath_add ~/.config

e.g.
~/.config/amass
~/.config/chaos
~/.config/favinfo

We don't have to add all directory manually.

rix4uni avatar Aug 10 '25 04:08 rix4uni

We could probably add a --recursive flag, but for now, you can do this easily within your shell:

zoxide add **/
zoxide remove **/

ajeetdsouza avatar Aug 10 '25 07:08 ajeetdsouza

I think zoxide add **/ going to add all of paths in /root, if yes it will not work for me because millions of temporary file exist in my system

zpath_add adds recursively for specific directory as per users need, you can implement later --recursive flag if you don't have time now

rix4uni avatar Aug 10 '25 08:08 rix4uni

@rix4uni **/ is a glob that means "recurse through every directory in my current directory".

i.e. if you cd /home/me/Documents and run this command, it will add every directory inside /home/me/Documents, same as writing /home/me/Documents/**/.

ajeetdsouza avatar Aug 10 '25 09:08 ajeetdsouza

Thanks bro

rix4uni avatar Aug 12 '25 02:08 rix4uni

Leaving this open since it's a valid feature request.

ajeetdsouza avatar Aug 12 '25 02:08 ajeetdsouza

Ok

rix4uni avatar Aug 12 '25 02:08 rix4uni

i can work on adding this.

w3irdrobot avatar Oct 03 '25 16:10 w3irdrobot