zoxide
A Python re-implementation of zoxide, the "smarter cd command" — it tracks the directories you actually use and lets you jump to them with a few keystrokes, ranked by frecency (frequency + recency).
z proj # jump to your most "frecent" directory matching "proj"
z proj web # multiple keywords narrow the match
zi proj # interactively pick from matches (uses fzf if installed)
z - # like `cd -`
z # go home
How it works
- Every time you
cd, a shell hook callszoxide add -- "$PWD", bumping that path's rank in a small JSON database (~/.local/share/zoxide/db.json, or$XDG_DATA_HOME/zoxide/db.json). zoxide query <keywords>searches the database: every keyword must be a case-insensitive substring of the path, and the last keyword must match the final path component — this is the same rule the original zoxide uses, soz fooprefers/home/me/foo-projectover some deeply nested unrelated match that merely contains "foo" earlier in the path.- Ranking combines rank (times visited, incremented on each
add) with recency (a multiplier: 4x if visited in the last hour, 2x in the last day, 0.5x in the last week, 0.25x older) — again mirroring upstream zoxide's aging algorithm. When the sum of all ranks crosses a threshold, every entry's rank is scaled down (aging out unused directories) instead of using a hard entry-count cap.
Install
cd zoxide
pip install -e .
This installs a zoxide executable (equivalent to the real zoxide binary).
Shell integration
Add one line to your shell config, exactly like the real zoxide:
# ~/.bashrc
eval "$(zoxide init bash)"
# ~/.zshrc
eval "$(zoxide init zsh)"
# ~/.config/fish/config.fish
zoxide init fish | source
This defines:
z— the jump command (customize the name with--cmd j)zi— interactive jump viafzfif available, else a numbered fallback prompt- an automatic hook that calls
zoxide addon every directory change (PROMPT_COMMANDin bash,precmd_functionsin zsh,--on-variable PWDin fish)
A minimal posix template is also available for sh/dash (jump function
only — no automatic tracking hook, since that requires shell-specific prompt
support).
CLI reference
zoxide add <path>... # add/bump one or more paths
zoxide query [-l] [-s] [-i] <kw>... # search (-l list all, -s show score, -i interactive)
zoxide query --exclude <path> <kw>.. # exclude a path (used internally by `z`)
zoxide remove <path> # remove an entry
zoxide remove -i # interactively pick an entry to remove
zoxide edit <path> <score> # directly set an entry's rank
zoxide import <file> [--merge] # import from a z.sh/autojump-style dump
zoxide init <bash|zsh|fish|posix> # print shell integration script
Differences from the original (Rust) zoxide
- Database is plain JSON, not bincode — easy to inspect/edit by hand, but less compact for very large histories.
- No PowerShell/Nushell templates (only bash/zsh/fish/posix).
importsupports two simple text formats (autojump'sweight<TAB>pathand z.sh'spath|rank|epoch) rather than reading the original zoxide's binary database directly.
Tests
python3 -m unittest discover -s tests -v
Metadata
Release files for zoxide 1.4.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zoxide-1.4.7-py3-none-any.whl | Python 3 | none | any | Details |
Release files / zoxide-1.4.7-py3-none-any.whl
| Download URL | zoxide-1.4.7-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
892363a63af861add75c78c53fb93b6483f9759c300b1d03a2d3c62f08624a5c
|
|
BLAKE2b-256 checksum How to use checksums |
d2a36bf5558ccfc8a1dd233f52b1277de6cf399db2768b6df2c5ce8f05f642a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|