Re-inventing muscle memory with zoxide

Going down the rabbit hole of updating my terminal, I came across zoxide. In a nutshell, it’s a modern replacement for cd. It seems both a gift from heaven and hell.

From their README.md:

zoxide

1
z foo # cd into highest ranked directory matching foo
2
z foo bar # cd into highest ranked directory matching foo and bar
3
z foo / # cd into a subdirectory starting with foo
4
5
z ~/foo # z also works like a regular cd command
6
z foo/ # cd into relative path
7
z .. # cd one level up
8
z - # cd into previous directory
9
10
zi foo # cd with interactive selection (using fzf)
11
12
z foo<SPACE><TAB> # show interactive completions (zoxide v0.8.0+, bash 4.4+/fish/zsh only)

On the one hand, it makes digging through long directory trees faster. On the other hand, I came across a YouTube video saying they aliased cd for z. Seems like a recipe for disaster when you run bash scripts with expand_aliases, where previously working scripts would suddenly execute commands on the wrong directory.

As for me, I’m getting used to re-wiring my muscle memory around the z command and how I navigate directory trees. So far, despite the extra convenience it offers, I’m still a bit slower than using just plain cd.