ajeetdsouza/zoxide

need `z -b`

Closed this issue · 3 comments

z -b in z.lua is useful to go back to the root of git repo.

bew commented

Note that you can implement it easily by aliasing to:

cd "$(git rev-parse --show-toplevel)"

Note that you can implement it easily by aliasing to:

cd "$(git rev-parse --show-toplevel)"

Fantasy. Sometime I need to go back to the root with custom mark file .root

I achieve it without zoxide in powershell. zb will change directory to the parent directory with .root/.git.

    Function zb {
        $markFiles = (".root", ".git", ".svn", "package.json")
        $curDir = $(Get-Item ".")
        while ($curDir) {
            $dirName = $curDir.FullName
            ForEach($m in $markFiles) {
                If (Test-Path "$dirName/$m") {
                    cd $dirName 
                    return
                }
            }
            $curDir = $curDir.Parent
        }
        echo "No found upper .root"
    }