The previous post about fast navigation involved getting to the right directory in the file explorer. Zoxide achieves that functionality for the terminal.
To install, run the following. (fzf, fuzzy finder, is optional.)
sudo pacman -S zoxide fzf
Next, initialize the shell. For Fish, add the following to ~/.config/fish/config.fish.
zoxide init fish | source
This step differs for other shells:
| Shell | File | Line |
|---|---|---|
| Bash | ~/.bashrc |
eval "$(zoxide init bash)" |
| Zsh | ~/.zshrc |
eval "$(zoxide init zsh)" |
| Fish | ~/.config/fish/config.fish |
zoxide init fish | source |
Once configured, Zoxide will note your use of cd. It will remember the places you visited. You will be able to then jump straight to the relevant directory.
Instead of
cd ~/Desktop/Apple/Basket/Crocodile
you will be able to navigate to the folder using just
z Cro
Recently visited locations are assigned greater weight, which improves the shortcut effectiveness.
To change the command from z to something else, modify the rc file entry as follows.
zoxide init fish --cmd j | source
Now, you can use j instead of z.