Introduction
Zoxide is a smarter cd command ! This is the kind of tool that takes you 15 minutes to install and learn, has very basic features, it's instantly useful, and you'll not be able to live without it ! It provides a small but very nice improvement to your life in the terminal...
Demo
# Let's say we want to visit the chess game developed in POO
sam> cd HEIG/year2/POO/projects/l8-echecs/
l8-echecs> pwd
/home/sam/HEIG/year2/POO/projects/l8-echecs
That's painful right ?
To solve this, you may have configured a few shell aliases like these
alias echecs="cd ~/HEIG/year2/POO/projects/l8-echecs/"
alias tetris2="cd ~/HEIG/year2/WEB/projects/3-tetris-2-interaction-wednesday-untrucrigolo"
but this is very limited and you have to name and create new aliases frequently...
... so now, be prepared to say goodbye to your aliases and to long and complex cd sequences like this one...
Get back to $HOME and let's try again with zoxide
sam> z echecs
l8-echecs> pwd
/home/sam/HEIG/year2/POO/projects/l8-echecs
BAM, we are in !
What if we don't have a specific name for the folder, but we know its number ? We would like to jump into labo3 from anywhere...
> ls HEIG/year2/PCO/projects # listing folders in PCO/projects
l1
l2
labo3
labo4
labo5Coiffure
labo6Engines
Zoxide uses a fuzzy search, as long as a known path match the given patterns in given order, it will find it, it is case insensitive.
sam> z pco pro 3
labo3> pwd
/home/sam/HEIG/year2/PCO/projects/labo3
It works because /home/sam/HEIG/year2/PCO/projects/labo3 can be matched by the 3 patterns pco pro 3.
If several folders have the same name and you don't know how to match it you can choose between them interactively with zi, with a fzf prompt
> zi sye
┌───────────────────────────────────────────────────────────────┐
│ > < 3/3 ────────────────────────────────────────────────── │
│ ▌ 20.5 /home/sam/code/productivity/HEIG/SYE │
│ 7.5 /home/sam/HEIG/year2/SYE │
│ 1.0 /home/sam/HEIG/betterheig/SYE/sye_roland_samuel │
We can see a score attributed to each path, this score augments when you jump into it.
Convinced ? Let's continue...