ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
https://crates.io/crates/zoxide
MIT License
23.08k stars 557 forks source link

Cannot edit paths in the zoxide database #916

Open roobre opened 1 month ago

roobre commented 1 month ago

I recently renamed my home folder (e.g. from /home/old to /home/new). Unfortunately this rendered my precious zoxide database useless.

I'd like to be able to replace occurrences of /home/old to /home/new in the zoxide database, but I haven't figured out how.

What I've tried:

Something that allows editing the db as a plaintext file would be amazing for these cases.

roobre commented 1 month ago

For now I've worked around this in (probably) the worst way possible:

z () {
    __zoxide_z "$@"
    cwd=$(pwd)
    if [[ $cwd =~ "/home/old/*" ]]
    then
        zoxide remove "$cwd"
        cwd=${cwd/old/new}
        zoxide add "$cwd"
        cd "$cwd"
    fi
}