z will keep track of the directories you visit and store the calculation of each “frecency” (frequency + recency) at $Z_DATA. After some learning, typing z name will take you to the most appropriate directory whose path most closely matches name.

Use tab completion

Provided by fish shell, tab completion works seamlessly with z. when you press the tab key after typing z (z and a space), fish will display available paths that were recently visited.

References